:root {
    --primary: #5fa7b3;
    --primary-hover: #4d8a94;
    --secondary: #d99f0b;
    /* Gold from logo */
    --bg-color: #F8FAFC;
    --card-bg: #FFFFFF;
    --text-main: #334155;
    --text-muted: #64748B;
    --border: #E2E8F0;
    --danger: #EF4444;
    --success: #10B981;
    --sidebar-width: 260px;
    --header-height: 60px;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    margin: 0;
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Mobile Sidebar & Header */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: white;
    border-bottom: 1px solid var(--border);
    z-index: 50;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
}

.mobile-logo {
    height: 35px;
}

.menu-toggle {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: white;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100%;
    transition: transform 0.3s ease;
    z-index: 40;
}

.sidebar-header {
    padding: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.sidebar-logo {
    max-width: 100%;
    height: auto;
    max-height: 50px;
}

.nav-links {
    list-style: none;
    padding: 1rem;
    margin: 0;
    flex: 1;
    overflow-y: auto;
}

.btn-search,
.btn-new-clinic,
.btn-clear {
    width: 100%;
    height: 50px;
}

/* Premium Drawer (Side Panel) Styles */
.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.1);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: none;
    z-index: 1000;
    transition: all 0.3s ease;
}

.drawer-overlay.active {
    display: block;
}

.drawer-content {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    max-width: 450px;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: -10px 0 25px -5px rgba(0, 0, 0, 0.1);
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    z-index: 1001;
}

.drawer-overlay.active+.drawer-content,
.drawer-content.active {
    right: 0;
}

.drawer-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.drawer-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-main);
}

.drawer-body {
    padding: 2rem 1.5rem;
    flex: 1;
    overflow-y: auto;
}

/* Soft Icon Buttons for Navigation */
.btn-icon-soft {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: white;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.btn-icon-soft:hover {
    background: #f8fafc;
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
}

.btn-icon-soft-close {
    background: #f1f5f9;
    border: none;
    color: var(--text-muted);
}

.btn-icon-soft-close:hover {
    background: #e2e8f0;
    color: var(--danger);
}

/* Redesigned Sidebar Close */
.close-menu {
    display: none;
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 100;
}

@media (max-width: 768px) {
    .close-menu {
        display: flex;
    }
}

.nav-links li {
    margin-bottom: 0.25rem;
}

.nav-category {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 1.5rem 1rem 0.5rem 1rem;
    opacity: 0.6;
}

.nav-category:first-child {
    padding-top: 0.5rem;
}

.nav-links a {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 0.5rem;
    transition: all 0.2s;
    font-weight: 500;
}

.nav-links a:hover,
.nav-links a.active {
    background-color: #f0f9fa;
    color: var(--primary);
}

.sidebar-icon {
    width: 18px;
    height: 18px;
    margin-right: 0.75rem;
    stroke-width: 2.5px;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--border);
}

.btn-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--danger);
    text-decoration: none;
    padding: 0.75rem;
    font-size: 0.9rem;
    background: #FEF2F2;
    border-radius: 0.5rem;
    transition: background 0.2s;
}

.btn-logout:hover {
    background: #FEE2E2;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 2rem;
    transition: margin-left 0.3s ease;
    width: 100%;
}

.header {
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-title {
    font-size: 1.875rem;
    font-weight: 600;
    color: var(--text-main);
    margin: 0;
}

/* Cards & Bento Grid */
.card {
    background: var(--card-bg);
    border-radius: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border);
}

.bento-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: minmax(160px, auto);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.bento-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 1.25rem;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
    width: 100%;
    /* Ensure full width inside grid cell */
}

.bento-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.bento-card.primary {
    background-color: var(--primary);
    color: white;
    border: none;
}

.bento-card.secondary {
    background-color: var(--secondary);
    color: white;
    border: none;
}

.bento-card.dark {
    background-color: var(--text-main);
    color: white;
    border: none;
}

.bento-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
}

.bento-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.bento-card.primary .bento-icon-wrapper {
    background: rgba(255, 255, 255, 0.2);
}

.bento-card:not(.primary) .bento-icon-wrapper {
    background: #f0f9fa;
    color: var(--primary);
}

.bento-label {
    font-size: 0.95rem;
    font-weight: 600;
    margin-top: 1rem;
    opacity: 0.9;
}

.bento-value {
    font-size: 2.25rem;
    font-weight: 700;
    margin-top: 0.25rem;
}

.bento-desc {
    font-size: 0.85rem;
    margin-top: 0.5rem;
    opacity: 0.8;
}

/* Span classes */
.col-span-1 {
    grid-column: span 1;
}

.col-span-2 {
    grid-column: span 2;
}

.col-span-3 {
    grid-column: span 3;
}

.row-span-2 {
    grid-row: span 2;
}

/* Dashboard Actions */
.dashboard-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    flex-wrap: wrap;
    gap: 1rem;
}

.search-container {
    flex: 1;
    min-width: 250px;
}

.search-form {
    display: flex;
    gap: 0.5rem;
    width: 100%;
}

.search-input-wrapper {
    position: relative;
    flex: 2;
    /* Stronger priority to the input */
    min-width: 150px;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    color: var(--text-muted);
}

.search-input {
    padding-left: 40px;
    margin-bottom: 0;
    width: 100%;
}

.btn-search {
    padding: 0 1.5rem;
    flex-shrink: 0;
}

/* Forms & Inputs */
.form-group {
    margin-bottom: 1.25rem;
}

label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

input,
select,
textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fff;
    font-family: inherit;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(95, 167, 179, 0.15);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: white;
    border: 1px solid var(--border);
    color: var(--text-main);
}

/* Quick Action Buttons Grid */
.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    width: 100%;
}

.action-btn {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 1.25rem;
    text-decoration: none;
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.2s;
}

.action-btn:hover {
    background: white;
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-3px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.action-btn-icon {
    width: 32px;
    height: 32px;
}

/* Visibility Utilities */
.desktop-only {
    display: block;
}

.mobile-only {
    display: none;
}

/* Responsive Clinic Cards */
.clinic-card-mobile {
    background: white;
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
    width: 100%;
}

.clinic-card-name {
    display: block;
    font-weight: 600;
    font-size: 1.15rem;
    margin: 0 0 0.5rem 0;
    color: var(--text-main);
}

.clinic-card-date {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Tables - Bento Style */
.table-container {
    width: 100%;
    margin-top: 0.5rem;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

th {
    text-align: left;
    padding: 1rem 0;
    font-size: 0.85rem;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
}

td {
    padding: 1.25rem 0;
    border-bottom: 1px solid var(--border);
    color: var(--text-main);
    vertical-align: middle;
}

/* Mobile Responsive */
@media (max-width: 992px) {
    .bento-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    body {
        flex-direction: column;
        padding-top: var(--header-height);
    }

    .mobile-header {
        display: flex;
    }

    .sidebar {
        transform: translateX(-100%);
        width: 100%;
        top: var(--header-height);
        height: calc(100vh - var(--header-height));
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .close-menu {
        display: flex;
        position: absolute;
        top: 1rem;
        right: 1rem;
        background: none;
        border: none;
        color: var(--text-main);
        cursor: pointer;
    }

    .main-content {
        margin-left: 0;
        padding: 1.5rem;
    }

    .sidebar-header {
        display: none;
    }

    .desktop-only {
        display: none !important;
    }

    .mobile-only {
        display: block !important;
    }

    .header {
        margin-bottom: 1.5rem;
    }

    .page-title {
        font-size: 1.5rem;
    }

    /* Bento Grid Mobile */
    .bento-grid {
        grid-template-columns: 1fr;
        grid-auto-rows: auto;
    }

    .col-span-2,
    .col-span-3 {
        grid-column: span 1;
    }

    .bento-card {
        padding: 1.5rem;
    }

    /* Stacking Actions on Mobile */
    .dashboard-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .search-container {
        min-width: 0;
        width: 100%;
    }

    .search-form {
        flex-direction: column;
        gap: 0.75rem;
    }

    .btn-search,
    .btn-new-clinic,
    .btn-clear {
        width: 100%;
        height: 50px;
    }
}