:root {
    --navy-blue: #10273d;
    --navy-blue-dark: #e03197;
    --navy-blue-light: #e03197;
    --grey-bg: oklab(99.557% 0.00203 0.00052);
    --white: #ffffff;
    --text-dark: #7c0e6e;
    --text-light: #a33f9e;
    --sidebar-width: 250px;
    --header-height: 60px;
    --primary-color: #f0dff1;
    --secondary-color: #ac49ca;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--grey-bg);
    color: var(--text-dark);
    overflow-x: hidden;
    width: 100%;
}

/* Login Page Styles */
.login-body {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--grey-bg);
}

.login-card {
    background: var(--white);
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    border-top: 5px solid var(--navy-blue);
}

.login-card h2 {
    color: var(--navy-blue);
    text-align: center;
    margin-bottom: 2rem;
    font-size: 1.8rem;
    font-weight: 700;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
    font-weight: 600;
}

.form-control {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    outline: none;
    transition: border-color 0.3s;
}

.form-control:focus {
    border-color: var(--navy-blue);
}

.btn-login {
    width: 100%;
    padding: 0.8rem;
    background-color: var(--navy-blue);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    transition: background-color 0.3s;
}

.btn-login:hover {
    background-color: var(--navy-blue-dark);
}

/* Dashboard Layout */
.wrapper {
    display: flex;
    min-height: 100vh;
    max-width: 100%;
    overflow-x: hidden;
}

/* Sidebar */
.sidebar {
    width: 60px;
    background-color: var(--navy-blue);
    color: white;
    transition: width 0.3s ease;
    flex-shrink: 0;
    overflow-x: hidden;
    white-space: nowrap;
    z-index: 1000;
}

.sidebar.open {
    width: var(--sidebar-width);
}

.sidebar-header {
    padding: 20px;
    background-color: var(--navy-blue-dark);
    text-align: center;
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.sidebar-header h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    transition: opacity 0.3s;
}

.sidebar:not(.open) .sidebar-header h3,
.sidebar:not(.open) .sidebar-header img {
    opacity: 0;
    width: 0;
    height: 0;
}

.sidebar-menu {
    list-style: none;
    padding: 20px 0;
}

.menu-item {
    padding: 12px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    text-decoration: none;
    color: white;
    transition: all 0.3s;
    overflow: hidden;
}

.menu-item:hover,
.menu-item.active {
    background-color: var(--navy-blue-light);
    color: white;
}

.menu-item i {
    margin-right: 15px;
    width: 25px;
    text-align: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.sidebar:not(.open) .menu-item {
    color: transparent !important;
    /* Hides the text without changing HTML */
    padding: 12px 17px;
    /* Centers the 25px icon in the 60px sidebar (17+25+18=60) */
}

.sidebar:not(.open) .menu-item i {
    color: white;
    margin-right: 50px;
    /* Pushes transparent text further out of view */
}

.submenu {
    list-style: none;
    padding-left: 0;
    background-color: rgba(230, 35, 126, 0.1);
    display: none;
}

.sidebar:not(.open) .submenu {
    display: none !important;
}

.menu-item.has-submenu::after {
    content: '\f105';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    margin-left: auto;
    transition: transform 0.3s;
}

.menu-item.has-submenu.open::after {
    transform: rotate(90deg);
}

.sidebar:not(.open) .menu-item.has-submenu::after {
    display: none;
}

.submenu a {
    padding: 10px 20px 10px 65px;
    font-size: 0.9rem;
    color: #ffffff;
    text-decoration: none;
    display: block;
    transition: all 0.3s;
}

.submenu a:hover {
    background-color: var(--navy-blue-light);
}

/* Main Content */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.header {
    height: var(--header-height);
    background-color: var(--white);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.content-body {
    padding: 30px;
    overflow-y: auto;
}

/* Dashboard Cards */
.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.dashboard-cards .card {
    background: white;
    padding: 18px;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    height: 105px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    border-left: 5px solid transparent;
}

.dashboard-cards .card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
}

.dashboard-cards .card-title {
    font-size: 14px;
    font-weight: 500;
    color: #444;
    margin-bottom: 8px;
}

.dashboard-cards .card-value {
    font-size: 28px;
    font-weight: bold;
    color: var(--navy-blue);
}

/* Card Themes */
.dashboard-cards .card.theme-blue {
    background: #e8f4fd;
    border-left-color: #4e73df;
}

.dashboard-cards .card.theme-blue .card-value {
    color: #4e73df;
}

.dashboard-cards .card.theme-yellow {
    background: #fff3cd;
    border-left-color: #f6c23e;
}

.dashboard-cards .card.theme-yellow .card-value {
    color: #b78a0f;
}

.dashboard-cards .card.theme-green {
    background: #d4edda;
    border-left-color: #1cc88a;
}

.dashboard-cards .card.theme-green .card-value {
    color: #1cc88a;
}

.dashboard-cards .card.theme-red {
    background: #f8d7da;
    border-left-color: #e74a3b;
}

.dashboard-cards .card.theme-red .card-value {
    color: #dc3545;
}

.dashboard-cards .card.theme-teal {
    background: #d1ecf1;
    border-left-color: #17a2b8;
}

.dashboard-cards .card.theme-teal .card-value {
    color: #17a2b8;
}

.dashboard-cards .card.theme-purple {
    background: #f3e8fd;
    border-left-color: #6f42c1;
}

.dashboard-cards .card.theme-purple .card-value {
    color: #6f42c1;
}

.dashboard-cards .card.theme-orange {
    background: #ffebd6;
    border-left-color: #fd7e14;
}

.dashboard-cards .card.theme-orange .card-value {
    color: #fd7e14;
}

.dashboard-cards .card.theme-gray {
    background: #f8f9fa;
    border-left-color: #6c757d;
}

.dashboard-cards .card.theme-gray .card-value {
    color: #5a5c69;
}

/* Form Styles in Dashboard */
.form-card {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.form-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--navy-blue);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.form-actions {
    margin-top: 30px;
    border-top: 1px solid #ddd;
    padding-top: 20px;
    display: flex;
    justify-content: flex-end;
    gap: 15px;
}

.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -10px;
}

.col {
    padding: 0 10px;
    margin-bottom: 15px;
}

.col-3 {
    flex: 0 0 25%;
    max-width: 25%;
}

.col-4 {
    flex: 0 0 33.33%;
    max-width: 33.33%;
}

.col-6 {
    flex: 0 0 50%;
    max-width: 50%;
}

.col-9 {
    flex: 0 0 75%;
    max-width: 75%;
}

.col-12 {
    flex: 0 0 100%;
    max-width: 100%;
}

/* Dashboard Cards Mobile Layout */
@media screen and (max-width: 768px) {
    .dashboard-cards {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 12px;
    }
}

@media screen and (max-width: 400px) {
    .dashboard-cards {
        grid-template-columns: 1fr;
    }
}

.card-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: white;
    margin-bottom: 10px;
}

/* Tablet Layout */
@media screen and (max-width: 1024px) {

    .col-3,
    .col-4 {
        flex: 0 0 50%;
        max-width: 50%;
    }
}

/* Table Styles */
.table-container {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    margin-top: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 12px 15px;
    background-color: #f8f9fa;
    color: var(--navy-blue);
    font-weight: 600;
    border-bottom: 2px solid #eee;
}

td {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}

.btn {
    padding: 8px 15px;
    border-radius: 5px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s;
}

.btn-primary {
    background: var(--navy-blue);
    color: white;
}

.btn-primary:hover {
    background: var(--navy-blue-dark);
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-info {
    background: var(--info-color);
    color: white;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    width: 90%;
    max-width: 800px;
    border-radius: 10px;
    padding: 25px;
}

/* Print Styles */
@media print {

    .sidebar,
    .header,
    .btn,
    .no-print {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
    }

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

    body {
        background-color: white;
    }
}

.print-only {
    display: none;
}

/* Responsive Design for Mobile / Android */
.toggle-sidebar {
    display: block;
    font-size: 1.5rem;
    color: var(--navy-blue);
    padding: 10px;
    transition: transform 0.3s;
}

.sidebar.open~.main-content .toggle-sidebar i {
    /* If we want to change icon, React will handle it, or we can rotate */
}

.mobile-close-btn {
    display: none;
}

@media screen and (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -250px;
        margin-left: 0;
        top: 0;
        height: 100vh;
        width: 250px !important;
        z-index: 1001;
        overflow-y: auto;
        box-shadow: 2px 0 5px rgba(0, 0, 0, 0.2);
        transition: left 0.3s ease;
    }

    .sidebar-header h3,
    .sidebar-header img {
        opacity: 1 !important;
        width: auto !important;
        height: auto !important;
    }

    .menu-item.has-submenu::after {
        display: block !important;
    }

    .sidebar.open {
        left: 0;
        margin-left: 0;
    }

    /* Sidebar Overlay for Mobile */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1000;
        display: none;
    }

    .sidebar-overlay.open {
        display: block;
    }

    .mobile-close-btn {
        display: block;
        color: white;
    }

    .wrapper {
        flex-direction: column;
    }

    .main-content {
        margin-left: 0;
        width: 100%;
    }

    .header {
        padding: 0 10px;
        flex-wrap: wrap;
        height: auto;
        min-height: var(--header-height);
    }

    /* Header Controls Mobile Optimizations */
    .header-right-controls {
        gap: 8px !important;
        flex-wrap: wrap !important;
        justify-content: flex-end;
        width: 100%;
        margin-top: 5px;
        padding-bottom: 10px;
    }

    .header-right-controls .branch-switcher,
    .header-right-controls .client-switcher {
        padding: 4px 8px !important;
        max-width: 130px;
    }

    .header-right-controls .branch-switcher select,
    .header-right-controls .client-switcher select {
        max-width: 80px;
        text-overflow: ellipsis;
        white-space: nowrap;
        overflow: hidden;
    }

    .header-right-controls .ai-btn-text,
    .header-right-controls .welcome-text {
        display: none !important;
    }

    .col-2,
    .col-3,
    .col-4,
    .col-6,
    .col-9 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .dashboard-cards {
        grid-template-columns: 1fr;
    }

    .table-container {
        padding: 10px;
        overflow-x: auto;
        width: 100%;
        box-sizing: border-box;
    }

    .content-body {
        padding: 15px;
    }

    .modal-content {
        width: 95%;
        padding: 15px;
        max-height: 90vh;
        overflow-y: auto;
    }

    .form-card {
        padding: 15px;
    }

    table {
        display: block;
        width: 100%;
        overflow-x: auto;
        white-space: nowrap;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .search-bar-mobile {
        flex-direction: column;
        width: 100% !important;
    }

    .global-search-wrapper {
        width: 100% !important;
        margin: 10px 0 !important;
        order: 3; /* Push search below header controls if needed, or just let it stack */
    }

    .header-right-controls {
        order: 2;
    }
}

/* 4-Column Responsive Grid for Patient Registration */
.registration-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 20px;
    align-items: end;
    /* Aligns inputs nicely if labels have different heights */
}

.registration-grid .form-group {
    margin-bottom: 0;
    width: 100%;
}

.grid-full-width {
    grid-column: 1 / -1;
}

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

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

/* Sticky Header */
.sticky-header {
    position: sticky;
    top: 60px;
    /* Below the top header */
    background: #fff;
    z-index: 10;
    padding: 10px 0;
    border-bottom: 2px solid #eee;
    margin-bottom: 15px;
}

/* Tablet Layout (2 columns) */
@media screen and (max-width: 1024px) {
    .registration-grid {
        grid-template-columns: repeat(2, 1fr);
    }

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

/* Mobile Layout (1 column) */
@media screen and (max-width: 768px) {
    .registration-grid {
        grid-template-columns: 1fr;
    }

    .sticky-header {
        top: 0px;
    }
}