:root {
    /* Precise Ultra-Premium Tokens */
    --brand-navy: #1E3A8A;
    --brand-teal: #0EA5A4;
    --brand-bg: #FFFFFF;
    --brand-text: #111827;
    --brand-muted: #6B7280;
    --brand-border: #E6EAF2;
    --brand-white: #FFFFFF;

    /* Semantic Overrides */
    --brand-primary: var(--brand-navy);
    --brand-accent: var(--brand-teal);
    --primary-color: var(--brand-navy);
    --secondary-color: var(--brand-teal);
    --surface-white: #FFFFFF;

    /* Grid & Shadows */
    --grid-unit: 16px;
    --shadow-soft: 0 2px 15px -3px rgba(0, 0, 0, 0.07), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-premium: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

    --radius-premium: 18px;
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-main);
    background: var(--brand-white);
    color: var(--brand-text);
    line-height: 1.5;
    margin: 0;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--primary-color);
}

.card {
    border: 1px solid var(--brand-border);
    border-radius: var(--radius-premium);
    background: var(--brand-white);
    box-shadow: var(--shadow-soft);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-premium);
}

.btn-primary {
    background: var(--secondary-color);
    color: #020617;
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(56, 189, 248, 0.2);
}

.btn-primary:hover {
    background: #7dd3fc;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(56, 189, 248, 0.4);
}

/* Login Page Styles - Image Replication */
.login-container {
    height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Gradient background from image: Blue to Purple/Pink */
    background: linear-gradient(135deg, #4b6cb7 0%, #182848 100%);
    /* Or more vibrant like image: */
    background: linear-gradient(to bottom right, #364fc7, #8e44ad);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 9999;
}

.login-form-card {
    background: #ffffff;
    padding: 40px 50px;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 350px;
    text-align: center;
}

.login-header-text {
    margin-bottom: 30px;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 10px;
}

.login-header-text h2 {
    font-family: 'Times New Roman', Times, serif;
    /* Serif font as in image */
    font-size: 2rem;
    font-weight: 700;
    color: #333;
    margin: 0;
}

.login-form-card .form-group {
    margin-bottom: 25px;
    text-align: left;
    position: relative;
}

.login-form-card .form-group input {
    width: 100%;
    padding: 10px 5px;
    border: none;
    border-bottom: 1px solid #ddd;
    /* Underline style */
    border-radius: 0;
    font-size: 0.9rem;
    color: #555;
    background: transparent;
    transition: border-color 0.3s;
}

.login-form-card .form-group input:focus {
    outline: none;
    border-bottom: 1px solid #8e44ad;
}

.login-form-card .form-group input::placeholder {
    color: #aaa;
    font-size: 0.85rem;
}

.btn-login {
    width: 100%;
    padding: 12px;
    border-radius: 25px;
    /* Pill shape */
    background: #e0e0e0;
    /* Light grey background */
    color: #333;
    font-weight: 700;
    font-size: 0.95rem;
    border: 1px solid #ccc;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 10px;
    text-transform: uppercase;
    font-family: sans-serif;
    letter-spacing: 0.5px;
}

.btn-login:hover {
    background: #d5d5d5;
}

.forgot-password {
    text-align: left;
    margin-top: -15px;
    margin-bottom: 20px;
}

.forgot-password a {
    color: #aaa;
    font-size: 0.75rem;
    text-decoration: none;
}

.login-footer-text {
    margin-top: 30px;
    font-size: 0.8rem;
    color: #888;
}

.login-footer-text a {
    color: #6c5ce7;
    text-decoration: none;
    font-weight: 600;
}

/* Hide branding side purely logic just in case html structure lingers */
.login-branding {
    display: none;
}

/* Alerts and Messages */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    border-radius: 4px;
    font-weight: 500;
}

.alert.error,
.alert.danger {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

.alert.success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}

.alert.info {
    color: #0c5460;
    background-color: #d1ecf1;
    border-color: #bee5eb;
}

.alert.warning {
    color: #856404;
    background-color: #fff3cd;
    border-color: #ffeeba;
}

/* Global Message Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease-in-out;
}

/* Header & Nav */
header {
    background: var(--brand-white);
    box-shadow: var(--shadow-sm);
    border-bottom: 1px solid var(--brand-border);
    position: sticky;
    top: 0;
    z-index: 1000;
    height: 72px;
    display: flex;
    align-items: center;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--brand-primary);
    text-decoration: none !important;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-left: auto;
}

.nav-link {
    text-decoration: none;
    color: var(--brand-navy);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    transition: all 0.2s;
    position: relative;
    display: inline-block;
}

.nav-link:hover {
    background-color: var(--bg-global);
    color: var(--brand-primary);
}

.nav-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 0;
    background-color: var(--secondary-color);
    transition: width 0.3s;
}

.nav-link:hover::after {
    width: 100%;
}

/* Dropdown */
.dropdown {
    position: relative;
}

.dropdown-toggle {
    cursor: pointer;
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background-color: white;
    min-width: 220px;
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius);
    padding: 10px 0;
    z-index: 1001;
    border: 1px solid #eee;
    margin-top: 15px;
    /* Gap from link */
}

/* Arrow for dropdown */
.dropdown-content::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 20px;
    width: 12px;
    height: 12px;
    background: white;
    transform: rotate(45deg);
    border-top: 1px solid #eee;
    border-left: 1px solid #eee;
}

/* Invisible bridge to prevent closing on hover gap */
.dropdown-content::after {
    content: '';
    position: absolute;
    top: -20px;
    left: 0;
    width: 100%;
    height: 20px;
    background: transparent;
}

.dropdown:hover .dropdown-content {
    display: block;
    animation: fadeIn 0.2s ease-out;
}

.dropdown-content a {
    color: var(--text-color);
    padding: 10px 20px;
    text-decoration: none;
    display: block;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.dropdown-content a:hover {
    background-color: var(--light-bg);
    color: var(--primary-color);
}

.dropdown-divider {
    height: 1px;
    background-color: #eee;
    margin: 5px 0;
}

footer {
    background-color: transparent;
    padding: 24px 0;
    margin-top: 40px;
    text-align: center;
    border-top: 1px solid var(--brand-border);
    color: var(--brand-muted);
    font-size: 0.85rem;
}

.btn-group .btn-sm {
    margin: 0 4px;
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 0.95rem;
}

.modal-box {
    background: white;
    padding: 30px 40px;
    border-radius: 12px;
    text-align: center;
    max-width: 450px;
    width: 90%;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
    border-top: 5px solid transparent;
    animation: slideIn 0.3s ease-in-out;
}

.modal-box.error {
    border-color: #dc3545;
}

.modal-box.success {
    border-color: #28a745;
}

.modal-box.info {
    border-color: #17a2b8;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: #333;
}

.modal-message {
    font-size: 1rem;
    color: #555;
    margin-bottom: 25px;
}

.modal-btn {
    background: #0077b6;
    color: white;
    padding: 10px 25px;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s;
}

.modal-btn:hover {
    background: #00b4d8;
}

.modal-btn.close-btn {
    background: #555;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* --- App Container & Sidebar Layout --- */
.app-container {
    display: flex;
    min-height: calc(100vh - 70px);
    background: var(--brand-white);
    position: relative;
}

.app-sidebar {
    width: 240px;
    background: var(--brand-white);
    border-right: 1px solid var(--brand-border);
    position: sticky;
    top: 70px;
    height: calc(100vh - 70px);
    overflow-y: auto;
    transition: all 0.3s;
    z-index: 100;
}

.app-sidebar-menu li a {
    display: block;
    padding: 12px 20px;
    color: var(--brand-navy);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.app-sidebar-menu li a:hover,
.app-sidebar-menu li a.active {
    background-color: rgba(30, 58, 138, 0.05);
    color: var(--brand-teal);
    border-left-color: var(--brand-teal);
}

.app-sidebar-menu li a i {
    width: 25px;
    text-align: center;
    margin-right: 10px;
}

.app-main-content {
    flex: 1;
    padding: 24px;
    background: var(--brand-white);
    overflow-x: hidden;
    position: relative;
}

/* Mobile Sidebar Toggle - Hidden by default on desktop */
@media (max-width: 768px) {
    .app-sidebar {
        position: fixed;
        left: -250px;
        height: 100vh;
        top: 0;
        z-index: 1050;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }

    .app-sidebar.active {
        left: 0;
    }
}

/* --- New Dashboard Grid Styles --- */
.dashboard-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.action-tile {
    background: white;
    padding: 25px 20px;
    border-radius: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
    text-align: center;
    transition: all 0.3s ease;
    text-decoration: none !important;
    color: #555;
    border: 1px solid #f0f0f0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 140px;
}

.action-tile:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.action-tile i {
    font-size: 2.2rem;
    margin-bottom: 15px;
    opacity: 0.9;
}

/* Consultation Card Refinement */
.consultation-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
}

.consultation-card {
    border: none;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.03);
    transition: all 0.3s ease;
    background: #fff;
    overflow: hidden;
    position: relative;
    height: 100%;
    border: 1px solid #eaeaea;
}

.consultation-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.08);
}

.consultation-card-body {
    padding: 25px;
}

.consultation-card.urgent {
    border-left: 5px solid #dc3545;
}

.consultation-card.normal {
    border-left: 5px solid #28a745;
}

.patient-avatar {
    width: 50px;
    height: 50px;
    background: #f0f2f5;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #888;
    font-size: 1.2rem;
    margin-right: 15px;
}

@keyframes gradient {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* --- Premium Table System --- */
.table-premium {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.table-premium thead th {
    background-color: #f8fafc;
    color: var(--brand-navy);
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 16px 20px;
    border-bottom: 2px solid var(--brand-border);
    white-space: nowrap;
}

.table-premium tbody td {
    padding: 16px 20px;
    vertical-align: middle;
    border-bottom: 1px solid var(--brand-border);
    color: var(--brand-text);
    transition: background 0.15s ease;
    font-size: 0.95rem;
}

.table-premium td.nowrap {
    white-space: nowrap;
}

.table-premium tbody tr:hover td {
    background-color: rgba(30, 58, 138, 0.02);
}

.table-premium .patient-info h5 {
    margin: 0;
    font-weight: 600;
    color: var(--brand-navy);
    font-size: 1rem;
}

.table-premium .patient-info small {
    color: var(--brand-muted);
    font-size: 0.85rem;
}

.status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    display: inline-block;
}

.status-badge.pending {
    background: #fee2e2;
    color: #dc2626;
}

.status-badge.confirmed {
    background: #dcfce7;
    color: #16a34a;
}

.status-badge.completed {
    background: #f1f5f9;
    color: #64748b;
}

.text-navy {
    color: var(--brand-navy);
}

.font-weight-medium {
    font-weight: 500;
}

/* --- Premium Form & Crispy Forms System --- */
.form-group label {
    font-weight: 600;
    color: var(--brand-navy);
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.asteriskField {
    color: #dc2626;
    margin-left: 3px;
}

.form-control {
    border: 1px solid var(--brand-border);
    border-radius: 8px;
    padding: 12px 15px;
    font-size: 0.95rem;
    color: var(--brand-text);
    background-color: #f8fafc;
    transition: all 0.3s ease;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.02);
    width: 100%;
    height: auto;
    line-height: 1.5;
}

.form-control:focus {
    background-color: var(--brand-white);
    border-color: var(--brand-teal);
    outline: 0;
    box-shadow: 0 0 0 4px rgba(14, 165, 164, 0.15);
}

.form-control::placeholder {
    color: #94a3b8;
}

.invalid-feedback {
    font-size: 0.8rem;
    color: #dc2626;
    margin-top: 5px;
}

.is-invalid {
    border-color: #dc2626;
    background-image: none;
}

.is-invalid:focus {
    border-color: #dc2626;
    box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.15);
}

.form-row {
    margin-left: -10px;
    margin-right: -10px;
}

.form-row > [class*="col-"] {
    padding-left: 10px;
    padding-right: 10px;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 16px;
    padding-right: 40px;
}