/* ==========================================
   DESIGN SYSTEM & GLOBAL STYLES
   ========================================== */

:root {
    --primary: #003399;
    --primary-light: #0052cc;
    --primary-dark: #002266;
    --bg-app: #f4f6fa;
    --bg-card: rgba(255, 255, 255, 0.9);
    --bg-glass: rgba(255, 255, 255, 0.7);
    --border-glass: rgba(255, 255, 255, 0.3);
    --shadow-soft: 0 8px 32px 0 rgba(31, 38, 135, 0.08);
    --shadow-card: 0 4px 20px 0 rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 10px 25px 0 rgba(0, 51, 153, 0.15);
    --text-main: #2b3674;
    --text-muted: #a3aed0;
    --text-dark: #1b2559;
    
    /* Status Colors */
    --success: #2e7d32;
    --success-bg: #e8f5e9;
    --warning: #ef6c00;
    --warning-bg: #fff3e0;
    --info: #1565c0;
    --info-bg: #e3f2fd;
    --purple: #6a1b9a;
    --purple-bg: #f3e5f5;
    --danger: #d32f2f;
    --danger-bg: #ffebee;
    
    --border-radius-lg: 16px;
    --border-radius-md: 10px;
    --border-radius-sm: 6px;
    
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Kanit', 'Sarabun', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-app);
    color: var(--text-dark);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ==========================================
   SIMULATION BAR (TESTING HELPER)
   ========================================== */

.simulation-bar {
    background: linear-gradient(135deg, #1e293b, #0f172a);
    color: #fff;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    font-size: 14px;
    border-bottom: 2px solid var(--primary-light);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.sim-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.sim-title i {
    color: #38bdf8;
    animation: rotateFlask 4s infinite linear;
}

@keyframes rotateFlask {
    0% { transform: rotate(0deg); }
    25% { transform: rotate(15deg); }
    50% { transform: rotate(0deg); }
    75% { transform: rotate(-15deg); }
    100% { transform: rotate(0deg); }
}

.sim-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.sim-controls select {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 4px 10px;
    border-radius: var(--border-radius-sm);
    font-family: inherit;
    cursor: pointer;
    outline: none;
    transition: var(--transition-smooth);
}

.sim-controls select:focus {
    border-color: #38bdf8;
    background: rgba(255, 255, 255, 0.2);
}

.sim-controls option {
    background: #1e293b;
    color: #fff;
}

/* ==========================================
   LAYOUT STRUCTURE
   ========================================== */

.app-container {
    display: flex;
    min-height: calc(100vh - 44px);
    position: relative;
}

/* Sidebar Navigation */
.sidebar {
    width: 280px;
    background: var(--bg-glass);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-right: 1px solid var(--border-glass);
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: var(--transition-smooth);
    z-index: 100;
}

.sidebar-header {
    margin-bottom: 40px;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-icon {
    font-size: 32px;
    color: var(--primary);
    background: rgba(0, 51, 153, 0.1);
    padding: 12px;
    border-radius: var(--border-radius-md);
    box-shadow: 0 4px 10px rgba(0, 51, 153, 0.1);
}

.logo-area h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.2;
}

.logo-area p {
    font-size: 11px;
    color: var(--text-muted);
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav li {
    margin-bottom: 8px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 14px 18px;
    color: var(--text-main);
    text-decoration: none;
    font-weight: 500;
    font-size: 15px;
    border-radius: var(--border-radius-md);
    transition: var(--transition-smooth);
}

.sidebar-nav li.active a,
.sidebar-nav a:hover {
    background-color: #fff;
    color: var(--primary);
    box-shadow: var(--shadow-card);
}

.sidebar-nav li.active a i {
    color: var(--primary);
}

.sidebar-nav a i {
    font-size: 18px;
    color: var(--text-muted);
    transition: var(--transition-smooth);
    width: 24px;
    text-align: center;
}

.sidebar-nav a:hover i {
    color: var(--primary);
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 30px;
    border-top: 1px solid var(--border-glass);
}

.user-profile-summary {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    font-size: 40px;
    color: var(--primary);
}

.profile-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-dark);
}

.badge {
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    display: inline-block;
    width: max-content;
    margin-top: 4px;
}

.user-role.badge {
    background-color: var(--primary-light);
    color: #fff;
}

/* Admin Only Item transition */
.admin-only {
    border-top: 1px dashed rgba(0, 51, 153, 0.15);
    margin-top: 15px;
    padding-top: 15px;
}

/* Main Content Area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.top-navbar {
    height: 70px;
    padding: 0 30px;
    background: var(--bg-glass);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.sidebar-toggle-btn {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-dark);
    cursor: pointer;
    display: none;
}

.navbar-left h1 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-dark);
}

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

.clock-display {
    font-family: monospace;
    font-size: 16px;
    font-weight: 600;
    background: #fff;
    padding: 6px 14px;
    border-radius: 30px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--primary);
    box-shadow: var(--shadow-card);
}

.language-switcher {
    display: flex;
    background: rgba(0, 51, 153, 0.08);
    padding: 4px;
    border-radius: 30px;
}

.lang-btn {
    border: none;
    background: none;
    padding: 5px 12px;
    border-radius: 30px;
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition-smooth);
    color: var(--text-main);
}

.lang-btn.active {
    background-color: var(--primary);
    color: #fff;
}

/* ==========================================
   DYNAMIC VIEWS & WRAPPER
   ========================================== */

.view-content-wrapper {
    padding: 30px;
    flex: 1;
    overflow-y: auto;
}

.app-view {
    display: none;
    animation: fadeIn 0.4s ease-out forwards;
}

.app-view.active-view {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================
   COMPONENTS: CARDS, BUTTONS, TABLES
   ========================================== */

.dashboard-greeting-card {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: var(--border-radius-lg);
    padding: 30px;
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 30px;
    box-shadow: 0 10px 25px rgba(0, 51, 153, 0.2);
}

.greeting-text h2 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 5px;
}

.greeting-text p {
    font-size: 14px;
    opacity: 0.85;
}

.date-badge {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
    padding: 8px 18px;
    border-radius: 30px;
    font-weight: 500;
    font-size: 14px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 35px;
}

.stat-card {
    background: #fff;
    border-radius: var(--border-radius-lg);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow-card);
    transition: var(--transition-smooth);
}

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

.stat-icon {
    font-size: 24px;
    padding: 18px;
    border-radius: var(--border-radius-lg);
}

.card-present .stat-icon {
    background-color: var(--success-bg);
    color: var(--success);
}

.card-leave .stat-icon {
    background-color: var(--warning-bg);
    color: var(--warning);
}

.card-booking .stat-icon {
    background-color: var(--info-bg);
    color: var(--info);
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-dark);
    margin: 4px 0;
}

.stat-sub {
    font-size: 12px;
    color: var(--text-muted);
}

/* Section Titles */
.section-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Quick Actions Button Grid */
.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 35px;
}

.quick-btn {
    border: none;
    border-radius: var(--border-radius-lg);
    padding: 20px;
    color: #fff;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    font-family: inherit;
    font-weight: 600;
    font-size: 15px;
    box-shadow: var(--shadow-card);
    transition: var(--transition-smooth);
}

.quick-btn i {
    font-size: 28px;
}

.quick-btn:hover {
    transform: translateY(-5px);
}

.btn-clock {
    background: linear-gradient(135deg, var(--success), #4caf50);
}
.btn-clock:hover {
    box-shadow: 0 10px 20px rgba(46, 125, 50, 0.25);
}

.btn-leave {
    background: linear-gradient(135deg, var(--warning), #ff9800);
}
.btn-leave:hover {
    box-shadow: 0 10px 20px rgba(239, 108, 0, 0.25);
}

.btn-booking {
    background: linear-gradient(135deg, var(--info), #2196f3);
}
.btn-booking:hover {
    box-shadow: 0 10px 20px rgba(21, 101, 192, 0.25);
}

.btn-calendar {
    background: linear-gradient(135deg, var(--purple), #9c27b0);
}
.btn-calendar:hover {
    box-shadow: 0 10px 20px rgba(106, 27, 154, 0.25);
}

/* Double Grid Layout */
.dashboard-double-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
}

.dashboard-card {
    background: #fff;
    border-radius: var(--border-radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-card);
}

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

.card-header-flex h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-dark);
}

.card-header-flex i {
    font-size: 20px;
}

.dash-list {
    list-style: none;
    max-height: 280px;
    overflow-y: auto;
}

.dash-list li {
    padding: 12px;
    border-radius: var(--border-radius-md);
    background: var(--bg-app);
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    transition: var(--transition-smooth);
    border-left: 4px solid var(--primary-light);
}

.dash-list li:hover {
    background: #fff;
    transform: translateX(4px);
    box-shadow: var(--shadow-card);
}

.empty-list-msg {
    justify-content: center !important;
    border-left: none !important;
    color: var(--text-muted);
    background: none !important;
    padding: 30px !important;
    font-style: italic;
}

/* ==========================================
   FORMS & LAYOUTS (GRID-2-COL)
   ========================================== */

.grid-layout-2-col {
    display: grid;
    grid-template-columns: 1.1fr 1.9fr;
    gap: 24px;
    align-items: start;
}

@media (max-width: 1200px) {
    .grid-layout-2-col {
        grid-template-columns: 1fr;
    }
}

.form-container-card {
    background: #fff;
    border-radius: var(--border-radius-lg);
    padding: 30px;
    box-shadow: var(--shadow-card);
}

.history-container-card {
    background: #fff;
    border-radius: var(--border-radius-lg);
    padding: 30px;
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

.card-title-border {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 25px;
    border-bottom: 2px solid var(--primary-light);
    padding-bottom: 10px;
    display: inline-block;
}

/* Live Clock Widget inside Check-in Form */
.live-clock-card {
    background: linear-gradient(135deg, #1e293b, #334155);
    color: #fff;
    border-radius: var(--border-radius-md);
    padding: 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 25px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

.clock-date {
    font-size: 14px;
    opacity: 0.8;
}

.clock-time {
    font-family: monospace;
    font-size: 32px;
    font-weight: 700;
    letter-spacing: 1px;
    color: #38bdf8;
    text-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
}

/* Readonly fields box */
.readonly-value-box {
    background: var(--bg-app);
    border: 1px solid rgba(0, 51, 153, 0.1);
    padding: 12px 15px;
    border-radius: var(--border-radius-md);
    font-size: 14px;
}

.readonly-value-box p {
    margin-bottom: 4px;
}
.readonly-value-box p:last-child {
    margin-bottom: 0;
}

.readonly-value-box i {
    color: var(--primary-light);
    margin-right: 5px;
}

.input-readonly-styled {
    background-color: var(--bg-app) !important;
    border: 1px solid #cbd5e1 !important;
    font-weight: 700;
    color: var(--primary-dark) !important;
    text-align: center;
}

/* Form Styles */
.responsive-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
}

.form-group input[type="text"],
.form-group input[type="tel"],
.form-group input[type="date"],
.form-group input[type="time"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #cbd5e1;
    border-radius: var(--border-radius-md);
    font-family: inherit;
    font-size: 14px;
    color: var(--text-dark);
    outline: none;
    transition: var(--transition-smooth);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 51, 153, 0.15);
}

.required {
    color: var(--danger);
}

.grid-2-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* Custom File Upload */
.file-upload-wrapper {
    position: relative;
    border: 2px dashed #cbd5e1;
    border-radius: var(--border-radius-md);
    padding: 20px;
    text-align: center;
    background: var(--bg-app);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.file-upload-wrapper:hover {
    border-color: var(--primary-light);
    background: rgba(0, 51, 153, 0.02);
}

.file-upload-wrapper input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.file-upload-drag {
    pointer-events: none;
}

.file-upload-drag i {
    font-size: 32px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.file-upload-drag p {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-dark);
}

.file-limit-text {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 5px;
    display: block;
}

.file-preview-box {
    margin-top: 15px;
    border: 1px solid #cbd5e1;
    border-radius: var(--border-radius-md);
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    background: #fff;
}

.img-preview {
    max-height: 80px;
    border-radius: var(--border-radius-sm);
    border: 1px solid #cbd5e1;
}

.btn-text-danger {
    background: none;
    border: none;
    color: var(--danger);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-text-danger:hover {
    text-decoration: underline;
}

/* Vehicle Selector Cards */
.vehicle-options-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.vehicle-card {
    cursor: pointer;
}

.vehicle-card input[type="radio"] {
    display: none;
}

.vehicle-card-content {
    border: 2px solid #cbd5e1;
    border-radius: var(--border-radius-md);
    padding: 14px 20px;
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    column-gap: 20px;
    row-gap: 4px;
    transition: var(--transition-smooth);
    background: #fff;
}

.vehicle-card-content i {
    grid-row: 1 / span 2;
    font-size: 32px;
    color: var(--text-muted);
    align-self: center;
    background: var(--bg-app);
    padding: 10px;
    border-radius: var(--border-radius-md);
    width: 52px;
    text-align: center;
    transition: var(--transition-smooth);
}

.vehicle-card-content .v-title {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-dark);
}

.vehicle-card-content .v-desc {
    font-size: 12px;
    color: var(--text-muted);
}

/* Radio select status colors */
.vehicle-card input[type="radio"]:checked + .vehicle-card-content {
    border-color: var(--primary-light);
    background: rgba(0, 82, 204, 0.05);
}

.vehicle-card input[type="radio"]:checked + .vehicle-card-content i {
    color: var(--primary-light);
    background: rgba(0, 82, 204, 0.1);
}

/* Buttons */
.btn-submit {
    border: none;
    border-radius: var(--border-radius-md);
    padding: 12px 20px;
    font-family: inherit;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: var(--transition-smooth);
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.btn-group-row {
    display: flex;
    gap: 10px;
    width: 100%;
}

.btn-group-row .btn-submit {
    flex: 1;
}

.btn-primary {
    background-color: var(--primary);
    color: #fff;
}
.btn-primary:hover {
    background-color: var(--primary-light);
}

.btn-secondary {
    background-color: #e2e8f0;
    color: var(--text-dark);
}
.btn-secondary:hover {
    background-color: #cbd5e1;
}

.btn-success {
    background-color: var(--success);
    color: #fff;
}
.btn-success:hover {
    background-color: #2563eb; /* Override to brighter on hover */
    background-image: linear-gradient(rgba(0,0,0,0.05), rgba(0,0,0,0.05));
}

.btn-danger {
    background-color: var(--danger);
    color: #fff;
}
.btn-danger:hover {
    background-image: linear-gradient(rgba(0,0,0,0.05), rgba(0,0,0,0.05));
}

.btn-warning {
    background-color: var(--warning);
    color: #fff;
}

.btn-icon {
    border: none;
    background: #fff;
    color: var(--text-dark);
    padding: 10px;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    font-size: 16px;
    box-shadow: var(--shadow-card);
    transition: var(--transition-smooth);
}
.btn-icon:hover {
    background: var(--bg-app);
}

.btn-sm {
    padding: 8px 14px;
    font-size: 13px;
}

.btn-text {
    background: none;
    border: none;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    color: var(--primary);
}

/* ==========================================
   COMPONENTS: TABLES
   ========================================== */

.table-responsive {
    overflow-x: auto;
    width: 100%;
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    text-align: left;
}

.custom-table th,
.custom-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
}

.custom-table th {
    background: #f8fafc;
    color: var(--text-main);
    font-weight: 600;
}

.custom-table tbody tr {
    transition: var(--transition-smooth);
}

.custom-table tbody tr:hover {
    background: var(--bg-app);
}

/* Table statuses badges */
.status-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    width: max-content;
}

.status-badge.green {
    background-color: var(--success-bg);
    color: var(--success);
}

.status-badge.orange {
    background-color: var(--warning-bg);
    color: var(--warning);
}

.status-badge.blue {
    background-color: var(--info-bg);
    color: var(--info);
}

.status-badge.purple {
    background-color: var(--purple-bg);
    color: var(--purple);
}

.status-badge.red {
    background-color: var(--danger-bg);
    color: var(--danger);
}

.attachment-badge {
    background: #f1f5f9;
    color: var(--text-main);
    padding: 4px 10px;
    border-radius: var(--border-radius-sm);
    font-weight: 500;
    cursor: pointer;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: var(--transition-smooth);
    border: 1px solid #cbd5e1;
}

.attachment-badge:hover {
    background: #e2e8f0;
    color: var(--primary);
}

/* ==========================================
   CALENDAR SYSTEM STYLING
   ========================================== */

.calendar-layout-container {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 24px;
}

@media (max-width: 992px) {
    .calendar-layout-container {
        grid-template-columns: 1fr;
    }
}

.panel-card {
    background: #fff;
    border-radius: var(--border-radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-card);
}

.panel-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin: 15px 0 20px 0;
    line-height: 1.5;
}

.calendar-legend-list {
    list-style: none;
    margin-top: 15px;
}

.calendar-legend-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    margin-bottom: 12px;
    font-weight: 500;
}

.legend-color {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: inline-block;
}

.legend-blue { background-color: var(--info); }
.legend-red { background-color: var(--danger); }
.legend-green { background-color: var(--success); }
.legend-orange { background-color: var(--warning); }

.calendar-grid-card {
    background: #fff;
    border-radius: var(--border-radius-lg);
    padding: 30px;
    box-shadow: var(--shadow-card);
}

.calendar-header-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.calendar-month-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-dark);
}

.calendar-table-wrapper {
    display: flex;
    flex-direction: column;
}

.calendar-weekdays-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-weight: 600;
    color: var(--text-main);
    padding-bottom: 15px;
    border-bottom: 1px solid #f1f5f9;
}

.calendar-days-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-auto-rows: minmax(100px, auto);
    border-left: 1px solid #f1f5f9;
    border-top: 1px solid #f1f5f9;
}

.cal-day-cell {
    border-right: 1px solid #f1f5f9;
    border-bottom: 1px solid #f1f5f9;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.cal-day-cell:hover {
    background: rgba(0, 51, 153, 0.02);
}

.cal-day-num {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-dark);
    align-self: flex-end;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.cal-day-cell.other-month {
    background: #fafafa;
    cursor: default;
}
.cal-day-cell.other-month .cal-day-num {
    color: var(--text-muted);
}

.cal-day-cell.today .cal-day-num {
    background-color: var(--primary);
    color: #fff;
    box-shadow: 0 2px 6px rgba(0, 51, 153, 0.3);
}

.cal-event-pills {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-top: 4px;
    overflow-y: hidden;
}

.cal-event-pill {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    color: #fff;
}

.cal-event-pill.nursing { background-color: var(--info); }
.cal-event-pill.hospital { background-color: var(--danger); }
.cal-event-pill.meeting { background-color: var(--success); }
.cal-event-pill.other { background-color: var(--warning); }

/* ==========================================
   ADMIN PANEL BACK-OFFICE SYSTEM
   ========================================== */

.admin-tab-bar {
    display: flex;
    background: #fff;
    border-radius: var(--border-radius-lg);
    padding: 8px;
    margin-bottom: 25px;
    box-shadow: var(--shadow-card);
    overflow-x: auto;
    gap: 5px;
}

.admin-tab-btn {
    background: none;
    border: none;
    padding: 12px 20px;
    border-radius: var(--border-radius-md);
    font-family: inherit;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
    transition: var(--transition-smooth);
    position: relative;
}

.admin-tab-btn.active,
.admin-tab-btn:hover {
    background-color: var(--bg-app);
    color: var(--primary);
}

.tab-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    border-radius: 50%;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

/* Admin tab views switching */
.admin-tab-view {
    display: none;
    animation: fadeIn 0.4s ease-out forwards;
}

.admin-tab-view.active-tab-view {
    display: block;
}

.admin-grid-1-2 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

.admin-card {
    background: #fff;
    border-radius: var(--border-radius-lg);
    padding: 30px;
    box-shadow: var(--shadow-card);
    margin-bottom: 24px;
}

/* Log toolbar in Backoffice Log view */
.log-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 25px;
}

.search-box {
    position: relative;
    flex: 1;
    min-width: 250px;
}

.search-box i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-box input {
    width: 100%;
    padding: 10px 14px 10px 40px;
    border: 1px solid #cbd5e1;
    border-radius: var(--border-radius-md);
    outline: none;
    font-family: inherit;
    font-size: 14px;
    transition: var(--transition-smooth);
}

.search-box input:focus {
    border-color: var(--primary);
}

.filter-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-controls select {
    padding: 10px 14px;
    border: 1px solid #cbd5e1;
    border-radius: var(--border-radius-md);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    background: #fff;
}

/* Mini Cards for stats */
.stats-grid-small {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.stats-mini-card {
    background: #fff;
    padding: 20px;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mini-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

.mini-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary-dark);
}

/* SVG Chart Panels */
.charts-layout-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
}

.chart-card {
    background: #fff;
    border-radius: var(--border-radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.chart-card h4 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-dark);
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.chart-container-center {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px 0;
}

.donut-chart-svg {
    transform: rotate(-90deg);
}

.donut-segment {
    transform-origin: center;
    transition: stroke-dasharray 0.5s ease;
}

.chart-text {
    font-family: inherit;
    transform: rotate(90deg);
    transform-origin: center;
}

.chart-number {
    font-size: 6px;
    font-weight: 700;
    fill: var(--text-dark);
    text-anchor: middle;
    dominant-baseline: middle;
}

.chart-label {
    font-size: 2px;
    fill: var(--text-muted);
    text-anchor: middle;
    dominant-baseline: middle;
    font-weight: 500;
}

.chart-legends-horizontal {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 15px;
    font-size: 11px;
    font-weight: 600;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.legend-bullet {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.bg-success { background-color: var(--success); }
.bg-warning { background-color: var(--warning); }
.bg-primary { background-color: var(--info); }

/* Custom CSS Bar Chart */
.bar-chart-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 10px 0;
}

.bar-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.bar-label-flex {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-dark);
}

.bar-track {
    height: 8px;
    background: #f1f5f9;
    border-radius: 4px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: 4px;
    width: 0; /* Animated via inline style in JS */
    transition: width 0.8s ease-out;
}

.bar-fill.purple { background: var(--purple); }
.bar-fill.blue { background: var(--info); }
.bar-fill.orange { background: var(--warning); }

.bar-chart-empty-msg {
    text-align: center;
    padding: 20px;
    font-size: 12px;
    color: var(--text-muted);
    font-style: italic;
}

/* ==========================================
   DIALOGS & MODAL WINDOWS
   ========================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1100;
    padding: 20px;
    animation: fadeInModal 0.25s ease-out forwards;
}

.modal-overlay.active-modal {
    display: flex;
}

@keyframes fadeInModal {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-card {
    background: #fff;
    border-radius: var(--border-radius-lg);
    width: 100%;
    max-width: 500px;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
    animation: scaleUpModal 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    overflow: hidden;
}

.modal-card.modal-large {
    max-width: 700px;
}

@keyframes scaleUpModal {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-header {
    background: var(--bg-app);
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #cbd5e1;
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-dark);
}

.btn-close-modal {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-close-modal:hover {
    color: var(--danger);
}

.modal-body {
    padding: 24px;
    max-height: 80vh;
    overflow-y: auto;
}

.info-block {
    background: var(--warning-bg);
    border-left: 4px solid var(--warning);
    padding: 12px 15px;
    border-radius: var(--border-radius-sm);
    font-size: 13px;
    color: var(--text-dark);
}

.form-group-or-divider {
    text-align: center;
    margin: 15px 0 10px 0;
    position: relative;
}

.form-group-or-divider::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    width: 100%;
    height: 1px;
    background: #cbd5e1;
    z-index: 1;
}

.form-group-or-divider span {
    background: #fff;
    padding: 0 10px;
    font-size: 12px;
    color: var(--text-muted);
    position: relative;
    z-index: 2;
    font-weight: 500;
}

.justify-end {
    justify-content: flex-end;
}

.mt-4 { margin-top: 1.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.text-center { text-align: center; }
.text-primary { color: var(--primary-light) !important; }
.text-warning { color: var(--warning) !important; }
.text-muted { color: var(--text-muted) !important; }
.hidden { display: none !important; }

/* ==========================================
   RESPONSIVE DESIGN TRANSITIONS
   ========================================== */

@media (max-width: 992px) {
    .app-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-glass);
        padding: 15px 20px;
        position: relative;
        display: none; /* Controlled by toggle in mobile */
    }
    
    .sidebar.active-sidebar {
        display: flex;
    }
    
    .sidebar-header {
        margin-bottom: 20px;
    }
    
    .sidebar-toggle-btn {
        display: block;
    }
    
    .view-content-wrapper {
        padding: 20px;
    }
}
