:root {
    /* Semantic Colors (Default Values) */
    --primary: #059669; 
    --primary-dark: #047857;
    --primary-light: #ecfdf5;
    --secondary: #0ea5e9;
    --secondary-dark: #0284c7;
    --accent: #f59e0b;
    
    /* Neutral Palette */
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --text-on-primary: #ffffff;
    --border: #e2e8f0;
    
    /* Semantic States */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    /* Shadows & Elevation */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

    /* Radii */
    --radius-sm: 0.375rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;

    /* Typography */
    --font-main: 'Inter', system-ui, -apple-system, sans-serif;
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* === ANIMATIONS === */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
    from { transform: translateX(20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.fade-in { animation: fadeIn 0.5s ease-out forwards; }

/* === LAYOUT === */
.app-container {
    width: min(100%, 1360px);
    max-width: 1360px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: rgba(255, 255, 255, 0.9); /* Translucent white */
    backdrop-filter: blur(8px);
    box-shadow: var(--shadow-xl);
    position: relative;
}

/* === NAVIGATION === */
.nav-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 2rem;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.logo {
    font-weight: 800;
    font-size: 1.4rem;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    letter-spacing: -0.025em;
}

.logo i {
    font-size: 1.6rem;
    filter: drop-shadow(0 2px 4px rgba(5, 150, 105, 0.2));
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.user-menu span {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    color: var(--danger);
    background: #fff1f2;
    transition: all 0.2s;
    text-decoration: none;
}

.logout-btn:hover {
    background: var(--danger);
    color: white;
    transform: rotate(5deg);
}

/* === CONTENT === */
.content-wrapper {
    padding: clamp(1rem, 2vw, 2rem);
    flex: 1;
}

/* === CARDS === */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

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

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--bg-main);
}

.card-header span {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* === PATIENT CARD (KARTU DIGITAL) === */
.patient-card {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    color: white;
    border: none;
    box-shadow: 0 10px 25px -5px rgba(5, 150, 105, 0.4);
}

.patient-card::before {
    content: '';
    position: absolute;
    top: -20%;
    right: -10%;
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 70%);
    border-radius: 50%;
}

.patient-info h2 {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.rm-number {
    font-family: 'Monaco', 'Consolas', monospace;
    background: rgba(0,0,0,0.2);
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.1em;
}

/* === DASHBOARD GRID === */
.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2.5rem;
}

.menu-item {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    text-decoration: none;
    color: var(--text-main);
    border: 1px solid var(--border);
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
}

.menu-item:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.menu-item i {
    font-size: 2.25rem;
    color: var(--primary);
    background: var(--primary-light);
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 1.25rem;
    transition: all 0.3s;
}

.menu-item:hover i {
    background: var(--primary);
    color: white;
    transform: scale(1.1) rotate(-5deg);
}

.menu-item span {
    font-weight: 700;
    font-size: 0.95rem;
}

/* === STATS DASHBOARD === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: white;
    padding: 1.75rem;
    border-radius: var(--radius-lg);
    text-align: center;
    border-left: 6px solid var(--primary);
}

.stat-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 3rem;
    font-weight: 900;
    color: var(--text-main);
    margin-top: 0.5rem;
    letter-spacing: -0.05em;
}

/* === BUTTONS === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.75rem;
    font-weight: 700;
    border-radius: var(--radius-md);
    transition: all 0.2s;
    cursor: pointer;
    border: none;
    font-size: 0.95rem;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.2);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(5, 150, 105, 0.3);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

/* === FORMS === */
.form-group {
    margin-bottom: 1.5rem;
}

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

.form-control {
    width: 100%;
    padding: 0.875rem 1.25rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.2s;
    background: #fcfcfc;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 4px rgba(5, 150, 105, 0.1);
}

/* === TABLES === */
.table-responsive {
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: white;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

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

th {
    background: #f8fafc;
    padding: 1.25rem 1rem;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--border);
}

td {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
    color: var(--text-main);
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background-color: #f8fafc;
}

/* === STATUS BADGES === */
.status-badge {
    padding: 0.35rem 0.85rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.status-booking { background: #fef3c7; color: #92400e; }
.status-menunggu { background: #dbeafe; color: #1e40af; }
.status-diperiksa { background: #e0e7ff; color: #3730a3; }
.status-selesai { background: #d1fae5; color: #065f46; }
.status-batal { background: #fee2e2; color: #991b1b; }

/* === LOGIN PAGE === */
.login-body {
    background: linear-gradient(135deg, rgba(5, 150, 105, 0.8), rgba(2, 132, 199, 0.8)), url('../img/bg-rs.jpg');
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
}

.login-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    padding: 3rem 2.5rem;
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 440px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: fadeIn 0.6s ease-out;
}

.login-header img {
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
}

.login-header h1 {
    font-size: 2rem;
    font-weight: 900;
    color: var(--primary);
    letter-spacing: -0.05em;
    margin: 1rem 0 0.25rem;
}

/* === DASHBOARD === */
.dashboard-body {
    background: #f1f5f9;
}

/* === RESPONSIVE === */
@media (min-width: 1400px) {
    .menu-grid {
        grid-template-columns: repeat(6, 1fr);
    }

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

@media (min-width: 768px) {
    .app-container {
        margin: 2rem auto;
        border-radius: var(--radius-xl);
        min-height: calc(100vh - 4rem);
    }
}

@media (max-width: 1024px) {
    .nav-bar {
        padding: 1rem 1.25rem;
    }

    .card {
        padding: 1.25rem;
    }

    .card-header {
        gap: 0.75rem;
        flex-wrap: wrap;
        align-items: flex-start;
    }

    .content-wrapper [style*="display: grid"] {
        gap: 1rem !important;
    }

    .content-wrapper [style*="grid-template-columns: repeat(auto-fit"] {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)) !important;
    }
}

@media (max-width: 768px) {
    body {
        font-size: 14px;
    }

    .app-container {
        width: 100%;
        max-width: 100%;
        border-radius: 0;
        box-shadow: none;
    }

    .nav-bar {
        padding: 1rem;
        align-items: flex-start;
        gap: 0.75rem;
        flex-wrap: wrap;
    }

    .logo {
        font-size: 1.05rem;
        gap: 0.5rem;
        line-height: 1.3;
    }

    .logo i {
        font-size: 1.2rem;
    }

    .user-menu {
        width: 100%;
        justify-content: space-between;
        gap: 0.75rem;
    }

    .content-wrapper {
        padding: 1rem;
    }

    .card {
        padding: 1rem;
        margin-bottom: 1rem;
        border-radius: var(--radius-md);
    }

    .card:hover {
        transform: none;
    }

    .patient-card::before {
        width: 180px;
        height: 180px;
    }

    .patient-info h2 {
        font-size: 1.25rem;
        line-height: 1.35;
    }

    .rm-number {
        display: inline-block;
        word-break: break-word;
        letter-spacing: 0.04em;
    }

    .menu-grid,
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .menu-item {
        padding: 1.25rem 1rem;
    }

    .menu-item i {
        width: 58px;
        height: 58px;
        font-size: 1.7rem;
    }

    .stat-card {
        padding: 1.25rem;
    }

    .stat-value {
        font-size: 2.2rem;
    }

    .btn {
        padding: 0.85rem 1.1rem;
    }

    .btn-sm {
        padding: 0.65rem 0.9rem;
        font-size: 0.82rem;
    }

    .form-control {
        padding: 0.8rem 1rem;
        font-size: 0.95rem;
    }

    .login-card {
        padding: 1.5rem 1.25rem;
        max-width: 100%;
        border-radius: var(--radius-lg);
    }

    .login-header h1 {
        font-size: 1.55rem;
    }

    .table-responsive {
        margin: 0 -0.25rem;
        border-radius: var(--radius-md);
    }

    table {
        min-width: 640px;
    }

    th,
    td {
        padding: 0.85rem 0.75rem;
        white-space: nowrap;
    }

    .content-wrapper [style*="display: flex"] {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.9rem !important;
    }

    .content-wrapper [style*="display: grid"] {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    .content-wrapper [style*="text-align: right"] {
        text-align: left !important;
    }

    .content-wrapper [style*="justify-content: space-between"] {
        gap: 1rem !important;
    }
}

@media (max-width: 480px) {
    .nav-bar {
        padding: 0.85rem;
    }

    .content-wrapper {
        padding: 0.85rem;
    }

    .card {
        padding: 0.9rem;
    }

    .logo {
        font-size: 0.98rem;
    }

    .user-menu span {
        font-size: 0.85rem;
    }

    .patient-info h2 {
        font-size: 1.1rem;
    }

    .stat-value {
        font-size: 1.9rem;
    }
}
