@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #0077B6;
    --secondary: #00B4D8;
    --accent: #48CAE4;
    --light: #F0F8FF;
    --dark: #023E8A;
    --white: #FFFFFF;
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background: linear-gradient(180deg, #F0F8FF 0%, #E8F4F8 100%);
    color: var(--dark);
    display: flex;
    min-height: 100vh;
}

/* ================= AUTH PAGES ================= */

.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 20px;
}

.auth-card {
    width: 100%;
    max-width: 450px;
    padding: 40px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    text-align: center;
}

.auth-card h2 {
    margin-bottom: 30px;
    color: var(--primary);
    font-weight: 700;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

input,
select {
    width: 100%;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid #ddd;
    background: #fdfdfd;
    transition: var(--transition);
    outline: none;
    font-size: 0.95rem;
}

input:focus,
select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.1);
}

/* Glass effect for auth cards (optional if re-enabled) */
.glass-card {
    background: rgba(255, 255, 255, 0.8) !important;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* ================= SIDEBAR (OFF-CANVAS DRAWER) ================= */

.sidebar {
    width: 280px;
    height: 100vh;
    background: var(--primary);
    color: white;
    padding: 30px 20px;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 2000;
    transform: translateX(-100%);
    /* Hidden by default */
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.1);
}

.sidebar.active {
    transform: translateX(0);
    /* Shown when active */
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

.sidebar-logo {
    font-weight: 600;
    font-size: 1.2rem;
    margin-bottom: 0;
}

.close-sidebar {
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    color: rgb(255, 255, 255);
    transition: var(--transition);
}

.close-sidebar:hover {
    color: white;
}

.nav-item {
    display: block;
    padding: 12px 15px;
    margin-bottom: 10px;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: var(--transition);
}

.nav-item:hover,
.nav-item.active {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.logout-item {
    margin-top: 40px;
    color: #ff7675 !important;
}

/* Sidebar Backdrop */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1999;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    backdrop-filter: blur(3px);
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Base adjustment for pages WITHOUT sidebar (like login/register) */
body:not(:has(.sidebar)) {
    display: flex;
}

/* Base adjustment for pages WITH sidebar */
body:has(.sidebar) .auth-container {
    display: none;
    /* Hide auth container if sidebar exists (dashboard) */
}

/* ================= MAIN AREA ================= */

.main-area {
    margin-left: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
    transition: var(--transition);
}

@media (min-width: 1024px) {
    .content {
        max-width: 1600px;
        margin-left: auto;
        margin-right: auto;
    }
}

/* ================= NAVBAR ================= */

.navbar {
    position: fixed;
    top: 0;
    left: 0;
    /* Full width now */
    right: 0;
    height: 80px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 40px;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.05);
    z-index: 1000;
}

/* Mobile Toggle Button */
.menu-toggle {
    display: flex;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    background: var(--primary);
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    transition: var(--transition);
}

.menu-toggle span {
    display: block;
    width: 25px;
    height: 3px;
    background: white;
    border-radius: 2px;
}

.menu-toggle:hover {
    transform: scale(1.05);
    background: #1a252f;
}

.navbar h2 {
    font-weight: 600;
    color: var(--primary);
    margin-left: 15px;
}

/* ================= PROFILE ================= */

.profile-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: white;
    padding: 8px 15px;
    border-radius: 30px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    transition: var(--transition);
}

.profile-box:hover {
    transform: translateY(-3px);
}

.profile-box img {
    width: 35px;
    height: 35px;
    border-radius: 50%;
}

/* ================= CONTENT ================= */

.content {
    margin-top: 80px;
    padding: 40px;
    width: 100%;
    max-width: 1600px;
    margin-left: auto;
    margin-right: auto;
}

/* ================= WELCOME ================= */

.welcome-section {
    margin-bottom: 30px;
}

.welcome-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.welcome-section h2 {
    font-weight: 600;
}

/* ================= STATS ================= */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

/* Stats Grid for 2 cards */
.stats-grid-2 {
    grid-template-columns: repeat(2, 1fr);
    max-width: 600px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-card h4 {
    margin-bottom: 10px;
    color: var(--primary);
    font-weight: 500;
}

.stat-card p {
    font-size: 1.4rem;
    font-weight: 600;
}

.stat-value {
    font-size: 2rem;
    color: var(--primary);
    font-weight: 600;
    margin: 5px 0;
}

/* ================= SECTIONS ================= */

.section {
    margin-bottom: 40px;
}

.section h3 {
    margin-bottom: 15px;
    font-weight: 600;
    color: var(--primary);
}

/* Section Header */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.section-header .btn {
    white-space: nowrap;
}

/* ================= TABLE ================= */

.table-responsive {
    width: 100%;
    overflow-x: auto;
    background: var(--white);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 119, 182, 0.08);
    border: 1px solid rgba(0, 119, 182, 0.1);
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 100%;
}

th {
    background: var(--primary);
    color: var(--white);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 1px;
    padding: 20px;
    text-align: left;
}

td {
    padding: 18px 20px;
    border-bottom: 1px solid #E8F4F8;
    color: #444;
    font-size: 0.95rem;
    white-space: nowrap;
}

tr:nth-child(even) {
    background: #f9fdfd;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: #F0F9FF;
    color: var(--primary);
    transition: background 0.2s ease;
}

/* ================= BUTTON ================= */

.btn {
    padding: 12px 24px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
    display: inline-block;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: #005f91;
    box-shadow: 0 4px 12px rgba(0, 119, 182, 0.2);
}

/* Download button */
.btn-download {
    display: inline-block;
    padding: 5px 12px;
    background: var(--primary);
    color: white;
    text-decoration: none;
    border-radius: 5px;
    font-size: 0.8rem;
    transition: var(--transition);
}

.btn-download:hover {
    background: #005f91;
    transform: translateY(-2px);
}

/* ================= EXPANDABLE TABLE (Medical Report) ================= */

.expandable-table {
    width: 100%;
    border-collapse: collapse;
}

.expandable-table .main-row {
    cursor: pointer;
    transition: background-color 0.2s;
}

.expandable-table .main-row:hover {
    background-color: rgba(52, 152, 219, 0.05);
}

.expandable-table .main-row td {
    padding: 15px 10px;
    border-bottom: 1px solid #e0e0e0;
    vertical-align: middle;
}

/* Expand cell */
.expand-cell {
    width: 50px !important;
    text-align: center;
}

.expand-btn {
    background: #3498db;
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    margin: 0 auto;
}

.expand-btn.expanded {
    background: #e74c3c;
    transform: rotate(45deg);
}

.details-row {
    display: none;
    background-color: #f8f9fa;
}

.details-row.show {
    display: table-row;
}

.details-content {
    padding: 20px;
    border-bottom: 2px solid #3498db;
}

.detail-item {
    margin-bottom: 15px;
    padding: 10px;
    background: white;
    border-radius: 5px;
    border-left: 3px solid #3498db;
}

.detail-item strong {
    color: #2c3e50;
    display: block;
    margin-bottom: 5px;
}

/* Action item */
.action-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
    background: #f0f7ff;
    border-left: 4px solid var(--primary) !important;
}

.action-item .btn {
    margin: 0;
    width: auto;
    min-width: 200px;
}

/* ================= DOCTOR GROUP HEADER ================= */

.doctor-group-header td {
    padding: 12px 20px !important;
    background: #e3f2fd;
}

.doctor-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.doctor-name {
    font-size: 1.1rem;
    color: var(--primary);
}

.medicine-count {
    background: var(--primary);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    white-space: nowrap;
}

/* ================= CATEGORY BADGES ================= */

.category-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 15px;
    font-weight: bold;
    font-size: 14px;
}

.badge-prescription {
    background: #e3f2fd;
    color: #1976d2;
}

.badge-treatment {
    background: #e8f5e9;
    color: #388e3c;
}

.badge-diet {
    background: #fff3e0;
    color: #f57c00;
}

.badge-lab {
    background: #f3e5f5;
    color: #7b1fa2;
}

.badge-history {
    background: #e1f5fe;
    color: #0277bd;
}

/* ================= SIDEBAR BRAND ================= */

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.medical-cross {
    font-size: 1.8rem;
    font-weight: 700;
    color: white;
    line-height: 1;
}

/* ================= RESPONSIVE ================= */

/* Desktop Extra Large */
@media (min-width: 1440px) {
    .content {
        padding: 40px 60px;
    }
}

/* Tablet & Smaller Desktop */
@media (max-width: 1024px) {
    .navbar {
        padding: 0 20px;
    }

    .content {
        padding: 30px 20px;
    }

    .sidebar {
        width: 260px;
    }
}

/* Mobile Portals */
@media (max-width: 768px) {
    body {
        flex-direction: column;
    }

    .navbar {
        padding: 10px 15px;
        height: 60px;
    }

    .navbar h2 {
        font-size: 1.1rem;
        margin-left: 10px;
    }

    .content {
        margin-top: 60px;
        padding: 20px 15px;
    }

    .welcome-flex {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
        gap: 15px;
    }

    .stats-grid-2 {
        grid-template-columns: 1fr !important;
        max-width: 100% !important;
    }

    .stat-card {
        padding: 15px;
    }

    .stat-card p {
        font-size: 1.2rem;
    }

    .stat-value {
        font-size: 1.8rem;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .section-header .btn {
        width: 100%;
        text-align: center;
    }

    .doctor-header-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .medicine-count {
        align-self: flex-start;
    }

    .expandable-table .main-row td {
        padding: 12px 8px;
    }

    .expandable-table .main-row td:nth-child(2) {
        font-size: 0.85rem;
    }

    .expandable-table .main-row td:nth-child(4) {
        font-size: 0.9rem;
    }

    .category-badge {
        font-size: 12px;
        padding: 4px 8px;
        max-width: 150px;
        white-space: normal;
        line-height: 1.3;
    }

    .details-content {
        padding: 15px;
    }

    .detail-item {
        font-size: 0.9rem;
        padding: 8px;
    }

    .action-item {
        flex-direction: column;
        padding: 12px;
    }

    .action-item .btn {
        width: 100%;
        text-align: center;
        min-width: unset;
    }

    /* Remove min-width so tables fit mobile screens */
    table:not(.expandable-table) {
        min-width: unset !important;
    }

    /* Convert standard tables to card-based layout */
    table:not(.expandable-table) thead {
        display: none;
    }

    table:not(.expandable-table) tbody tr {
        display: block;
        background: white;
        border-radius: 12px;
        padding: 15px;
        margin-bottom: 12px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
        border-left: 4px solid var(--primary);
    }

    table:not(.expandable-table) tbody tr:hover td {
        background: transparent;
    }

    table:not(.expandable-table) tbody td {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        padding: 8px 5px;
        border-bottom: 1px solid #f0f0f0;
        white-space: normal;
        word-break: break-word;
        font-size: 0.88rem;
    }

    table:not(.expandable-table) tbody td:last-child {
        border-bottom: none;
    }

    /* Show column headers as inline labels using data-label attributes */
    table:not(.expandable-table) tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--primary);
        flex-shrink: 0;
        width: 40%;
        min-width: 100px;
        font-size: 0.82rem;
        text-transform: uppercase;
        letter-spacing: 0.3px;
    }

    /* Table container adjustments */
    .table-responsive {
        border: none;
        box-shadow: none;
        background: transparent;
        overflow-x: visible;
    }

    /* Remove the fixed min-width so table fits on mobile */
    .expandable-table {
        min-width: unset !important;
    }

    table {
        min-width: unset;
    }

    /* Stack each main-row as a card-like layout */
    .expandable-table .main-row {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
        padding: 12px 10px;
        border-bottom: 1px solid #e0e0e0;
    }

    .expandable-table .main-row td {
        display: inline-flex;
        align-items: center;
        border-bottom: none;
        padding: 4px 6px;
    }

    /* + button column: keep it fixed size */
    .expandable-table .main-row td:first-child {
        width: auto !important;
        flex-shrink: 0;
    }

    /* Date column */
    .expandable-table .main-row td:nth-child(2) {
        font-size: 0.85rem;
    }

    /* Badge column */
    .expandable-table .main-row td:nth-child(3) {
        flex-shrink: 0;
    }

    /* Description/title column — show on new line */
    .expandable-table .main-row td:nth-child(4) {
        width: 100%;
        padding-left: 48px;
        margin-top: -4px;
        font-size: 0.9rem;
    }

    .category-badge {
        font-size: 12px;
        padding: 4px 10px;
    }

    /* Details panel adjustments */
    .details-content {
        padding: 15px 10px;
    }

    .detail-item {
        padding: 8px;
        margin-bottom: 10px;
        font-size: 0.88rem;
    }

    .detail-item strong {
        font-size: 0.85rem;
    }

    /* Section header adjustments */
    .section>div:first-child {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 10px;
    }

    .section h3 {
        font-size: 1rem;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .navbar h2 {
        font-size: 0.95rem;
    }

    .profile-box {
        padding: 5px 10px;
    }

    .profile-box span {
        display: none;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-card {
        padding: 15px;
    }

    .stat-value {
        font-size: 1.6rem;
    }

    .stat-card h4 {
        font-size: 1rem;
    }

    .stat-card small {
        font-size: 0.8rem;
    }

    .doctor-group-header td {
        padding: 12px !important;
    }

    .doctor-name {
        font-size: 0.95rem;
    }

    .medicine-count {
        font-size: 0.8rem;
        padding: 4px 12px;
    }

    .expandable-table .main-row td {
        padding: 10px 5px;
    }

    .expandable-table .main-row td:nth-child(2) {
        font-size: 0.8rem;
    }

    .expandable-table .main-row td:nth-child(4) {
        font-size: 0.85rem;
        padding-left: 44px;
    }

    .category-badge {
        font-size: 11px;
        padding: 3px 6px;
        max-width: 120px;
    }

    .expand-btn {
        width: 28px;
        height: 28px;
        font-size: 16px;
    }

    .details-content {
        padding: 12px 8px;
    }

    .detail-item {
        padding: 8px;
        font-size: 0.85rem;
        margin-bottom: 10px;
    }

    .detail-item strong {
        font-size: 0.85rem;
    }

    .btn-download {
        padding: 4px 10px;
        font-size: 0.75rem;
    }

    .section-header h3 {
        font-size: 1.2rem;
    }

    .btn {
        width: 100%;
        padding: 10px;
        font-size: 0.9rem;
    }

    .section h3 {
        font-size: 1.1rem;
    }

    th,
    td {
        padding: 12px 10px;
        font-size: 0.8rem;
    }

    table:not(.expandable-table) tbody td {
        flex-direction: column;
        gap: 3px;
        padding: 6px 5px;
        font-size: 0.82rem;
    }

    table:not(.expandable-table) tbody td::before {
        width: 100%;
        font-size: 0.75rem;
    }

    table:not(.expandable-table) tbody tr {
        padding: 12px;
        margin-bottom: 10px;
    }

    .expandable-table .main-row td:nth-child(2) {
        font-size: 0.78rem;
    }

    .detail-item {
        font-size: 0.82rem;
    }

    .detail-item strong {
        font-size: 0.8rem;
    }
}

/* Extra Small Devices */
@media (max-width: 360px) {
    .expandable-table .main-row {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 5px;
        padding: 10px 5px;
    }
    
    .expandable-table .main-row td {
        display: inline-flex;
        align-items: center;
        border-bottom: none;
        padding: 3px 5px;
    }
    
    .expandable-table .main-row td:first-child {
        width: 40px !important;
    }
    
    .expandable-table .main-row td:nth-child(2) {
        font-size: 0.75rem;
    }
    
    .expandable-table .main-row td:nth-child(3) {
        max-width: 100px;
    }
    
    .expandable-table .main-row td:nth-child(4) {
        width: 100%;
        padding-left: 50px;
        margin-top: -5px;
        font-size: 0.8rem;
    }
    
    .category-badge {
        font-size: 10px;
        padding: 3px 5px;
    }
    
    .detail-item {
        font-size: 0.8rem;
    }
    
    .detail-item strong {
        font-size: 0.8rem;
    }
}


