/* =============================================
   Hospital Token Management System - Stylesheet
   Matches reference UI: blue/purple gradient, white cards
   ============================================= */

/* --- Reset & Base --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f0f2f5;
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
}

a {
    text-decoration: none;
    color: inherit;
}

/* --- Gradient Background (login/register) --- */
.bg-gradient {
    background: linear-gradient(135deg, #2196F3 0%, #7C4DFF 50%, #E040FB 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- Auth Pages (Login/Register) --- */
.auth-container {
    width: 100%;
    max-width: 480px;
    padding: 20px;
}

.auth-card {
    background: #fff;
    border-radius: 16px;
    padding: 40px 36px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}

.auth-card.wide {
    max-width: 600px;
}

.text-center {
    text-align: center;
}

.logo-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #6C63FF;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    border: 3px solid rgba(108, 99, 255, 0.3);
}

.logo-red {
    background: #e53935;
    border-color: rgba(229, 57, 53, 0.3);
}

.auth-card h2 {
    color: #1565C0;
    font-size: 1.5rem;
    margin-bottom: 4px;
}

.auth-card h3 {
    color: #333;
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 4px;
}

.auth-card .subtitle {
    color: #777;
    font-size: 0.9rem;
    margin-bottom: 24px;
}

/* --- Forms --- */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 0.9rem;
    color: #444;
}

.form-control {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 0.95rem;
    transition: border-color 0.2s;
    outline: none;
    background: #fafafa;
}

.form-control:focus {
    border-color: #2196F3;
    background: #fff;
}

.input-icon-group {
    position: relative;
}

.input-icon-group .icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
}

.input-icon-group .form-control {
    padding-left: 42px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.form-section {
    background: #f8f9ff;
    border: 1px solid #e8eaf6;
    border-radius: 10px;
    padding: 18px;
    margin-bottom: 18px;
}

.form-section h4 {
    color: #5C6BC0;
    margin-bottom: 14px;
    font-size: 0.95rem;
}

/* --- Buttons --- */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.btn-primary {
    background: #2196F3;
    color: #fff;
}

.btn-primary:hover {
    background: #1976D2;
}

.btn-success {
    background: #4CAF50;
    color: #fff;
}

.btn-success:hover {
    background: #388E3C;
}

.btn-warning {
    background: #FF9800;
    color: #fff;
}

.btn-warning:hover {
    background: #F57C00;
}

.btn-danger {
    background: #f44336;
    color: #fff;
}

.btn-danger:hover {
    background: #D32F2F;
}

.btn-secondary {
    background: #78909C;
    color: #fff;
}

.btn-secondary:hover {
    background: #546E7A;
}

.btn-outline {
    background: transparent;
    border: 2px solid #2196F3;
    color: #2196F3;
}

.btn-outline:hover {
    background: #2196F3;
    color: #fff;
}

.btn-block {
    display: block;
    width: 100%;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.8rem;
    border-radius: 6px;
}

.btn-group {
    display: flex;
    gap: 8px;
}

/* --- Navbar --- */
.navbar {
    background: #fff;
    border-bottom: 2px solid #e8eaf6;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.navbar-logo {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.trial-badge {
    display: block;
    color: #FF9800;
    font-size: 0.75rem;
    font-weight: 600;
}

.navbar-menu {
    display: flex;
    gap: 4px;
}

.nav-link {
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.9rem;
    color: #555;
    transition: all 0.2s;
}

.nav-link:hover {
    background: #e3f2fd;
    color: #1565C0;
}

.nav-link.active {
    background: #2196F3;
    color: #fff;
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-info {
    font-size: 0.85rem;
    color: #777;
}

.btn-logout {
    background: transparent;
    color: #f44336;
    border: 1px solid #f44336;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
}

.btn-logout:hover {
    background: #f44336;
    color: #fff;
}

/* --- Main Content --- */
.content {
    max-width: 1280px;
    margin: 0 auto;
    padding: 24px;
    min-height: calc(100vh - 120px);
}

/* --- Cards --- */
.card {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

.card-header h3 {
    font-size: 1.1rem;
    color: #333;
}

/* --- Dashboard Stats Cards --- */
.doctor-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    border: 1px solid #e8eaf6;
}

.doctor-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.doctor-card-header h3 {
    font-size: 1.1rem;
    color: #333;
}

.doctor-card-header .specialization {
    color: #777;
    font-size: 0.85rem;
}

.date-badge {
    background: #e3f2fd;
    color: #1565C0;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.stat-box {
    text-align: center;
    padding: 14px 8px;
    border-radius: 10px;
    border: 1px solid;
}

.stat-box .stat-number {
    font-size: 1.8rem;
    font-weight: 700;
    display: block;
}

.stat-box .stat-label {
    font-size: 0.8rem;
    font-weight: 500;
    display: block;
}

.stat-box .stat-percent {
    font-size: 0.7rem;
    display: block;
}

.stat-total {
    background: #e8f5e9;
    border-color: #c8e6c9;
}
.stat-total .stat-number { color: #2E7D32; }
.stat-total .stat-label { color: #388E3C; }

.stat-finished {
    background: #e3f2fd;
    border-color: #bbdefb;
}
.stat-finished .stat-number { color: #1565C0; }
.stat-finished .stat-label { color: #1976D2; }
.stat-finished .stat-percent { color: #42A5F5; }

.stat-pending {
    background: #fff8e1;
    border-color: #ffecb3;
}
.stat-pending .stat-number { color: #F57F17; }
.stat-pending .stat-label { color: #FF8F00; }

.stat-missed {
    background: #fce4ec;
    border-color: #f8bbd0;
}
.stat-missed .stat-number { color: #c62828; }
.stat-missed .stat-label { color: #D32F2F; }

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

/* --- Role Switcher Cards --- */
.role-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 30px;
}

.role-card {
    background: #fff;
    border: 2px solid #e8eaf6;
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    transition: all 0.2s;
    cursor: pointer;
}

.role-card:hover {
    border-color: #2196F3;
    box-shadow: 0 4px 16px rgba(33,150,243,0.15);
    transform: translateY(-2px);
}

.role-card .role-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
}

.role-card h4 {
    color: #333;
    margin-bottom: 4px;
}

.role-card p {
    color: #777;
    font-size: 0.8rem;
}

.role-icon-reception { background: #e3f2fd; color: #1565C0; }
.role-icon-doctor { background: #e8f5e9; color: #2E7D32; }
.role-icon-admin { background: #fff3e0; color: #E65100; }
.role-icon-tv { background: #f3e5f5; color: #7B1FA2; }

/* --- Tables --- */
.table-responsive {
    overflow-x: auto;
}

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

table th,
table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid #eee;
    font-size: 0.9rem;
}

table th {
    font-weight: 600;
    color: #555;
    background: #fafafa;
}

table tr:hover {
    background: #f8f9ff;
}

/* --- Token Status Badges --- */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-pending {
    background: #fff8e1;
    color: #F57F17;
}

.badge-consulting {
    background: #e3f2fd;
    color: #1565C0;
}

.badge-finished {
    background: #e8f5e9;
    color: #2E7D32;
}

.badge-missed {
    background: #fce4ec;
    color: #c62828;
}

.badge-women {
    background: #fce4ec;
    color: #AD1457;
}

.badge-morning {
    background: #fff8e1;
    color: #E65100;
}

.badge-evening {
    background: #e8eaf6;
    color: #283593;
}

/* --- Token Number --- */
.token-number {
    font-weight: 700;
    color: #1565C0;
}

/* --- Delay indicator --- */
.delay-text {
    color: #f44336;
    font-weight: 600;
    background: #fce4ec;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
}

/* --- Alert / Messages --- */
.alert {
    padding: 14px 18px;
    border-radius: 10px;
    margin-bottom: 18px;
    font-size: 0.9rem;
}

.alert-success {
    background: #e8f5e9;
    color: #2E7D32;
    border: 1px solid #c8e6c9;
}

.alert-error {
    background: #fce4ec;
    color: #c62828;
    border: 1px solid #f8bbd0;
}

.alert-info {
    background: #e3f2fd;
    color: #1565C0;
    border: 1px solid #bbdefb;
}

/* --- Trial Expired --- */
.trial-expired-box {
    background: #fce4ec;
    border: 2px solid #f8bbd0;
    border-radius: 12px;
    padding: 24px;
    margin: 20px 0;
}

.trial-expired-box h3 {
    color: #c62828;
    margin-bottom: 8px;
}

.trial-expired-box p {
    color: #555;
    margin-bottom: 6px;
}

/* --- TV Display --- */
.tv-container {
    background: linear-gradient(135deg, #1a237e 0%, #0d47a1 100%);
    min-height: 100vh;
    color: #fff;
    padding: 30px;
}

.tv-header {
    text-align: center;
    margin-bottom: 40px;
}

.tv-header h1 {
    font-size: 2rem;
    margin-bottom: 8px;
}

.tv-header .tv-date {
    font-size: 1.2rem;
    opacity: 0.8;
}

.tv-current {
    text-align: center;
    margin-bottom: 40px;
}

.tv-current-label {
    font-size: 1.2rem;
    opacity: 0.7;
    margin-bottom: 10px;
}

.tv-current-number {
    font-size: 6rem;
    font-weight: 800;
    color: #4FC3F7;
    text-shadow: 0 4px 20px rgba(79,195,247,0.3);
}

.tv-current-name {
    font-size: 1.5rem;
    margin-top: 8px;
    opacity: 0.9;
}

.tv-next-list {
    max-width: 700px;
    margin: 0 auto;
}

.tv-next-list h3 {
    font-size: 1.3rem;
    margin-bottom: 16px;
    opacity: 0.8;
}

.tv-next-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
    padding: 14px 20px;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.tv-next-item .tv-token {
    font-weight: 700;
    color: #4FC3F7;
    min-width: 70px;
}

.tv-next-item .tv-name {
    flex: 1;
    margin-left: 16px;
}

/* --- Utility --- */
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mt-30 { margin-top: 30px; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.text-muted { color: #999; }
.text-small { font-size: 0.85rem; }
.text-right { text-align: right; }
.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* --- Section Title --- */
.section-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* --- Filter Buttons --- */
.filter-group {
    display: flex;
    gap: 6px;
    align-items: center;
}

.filter-btn {
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid #ddd;
    background: #fff;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn.active,
.filter-btn:hover {
    background: #2196F3;
    color: #fff;
    border-color: #2196F3;
}

/* --- Session Indicator --- */
.session-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.session-morning {
    background: #fff8e1;
    color: #E65100;
}

.session-evening {
    background: #e8eaf6;
    color: #283593;
}

/* --- Info Grid (Admin) --- */
.info-grid {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 10px 16px;
    font-size: 0.9rem;
}

.info-grid dt {
    font-weight: 600;
    color: #555;
}

.info-grid dd {
    color: #333;
}

/* --- Footer --- */
.footer {
    text-align: center;
    padding: 16px;
    color: #999;
    font-size: 0.8rem;
    border-top: 1px solid #eee;
}

/* --- Link Styles --- */
.auth-link {
    color: #2196F3;
    font-weight: 500;
}

.auth-link:hover {
    text-decoration: underline;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .navbar {
        flex-wrap: wrap;
        height: auto;
        padding: 10px 16px;
        gap: 8px;
    }

    .navbar-menu {
        order: 3;
        width: 100%;
        overflow-x: auto;
        padding-bottom: 4px;
    }

    .nav-link {
        white-space: nowrap;
        padding: 6px 12px;
        font-size: 0.8rem;
    }

    .content {
        padding: 16px;
    }

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

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .role-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .auth-container {
        max-width: 100%;
    }

    .tv-current-number {
        font-size: 4rem;
    }
}
