:root {
    --primary: #FF6B6B;
    --secondary: #4ECDC4;
    --tertiary: #FFE66D;
    --glass-bg: rgba(255, 255, 255, 0.25);
    --glass-border: rgba(255, 255, 255, 0.4);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.2);
    --text-dark: #2C3E50;
    --text-light: #F7F9F9;
    --success: #2ECC71;
    --danger: #E74C3C;
    --warning: #D35400;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    min-height: 100vh;
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
    color: var(--text-dark);
}

/* Background Abstract Shapes */
.background-shapes {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.shape {
    position: absolute;
    filter: blur(80px);
    border-radius: 50%;
    animation: float 10s infinite ease-in-out alternate;
}

.shape-1 {
    width: 400px;
    height: 400px;
    background: var(--primary);
    top: -100px;
    left: -100px;
}

.shape-2 {
    width: 500px;
    height: 500px;
    background: var(--secondary);
    bottom: -150px;
    right: -100px;
    animation-delay: -2s;
}

.shape-3 {
    width: 300px;
    height: 300px;
    background: var(--tertiary);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -4s;
}

@keyframes float {
    0% { transform: translateY(0) scale(1); }
    100% { transform: translateY(30px) scale(1.1); }
}

/* Glassmorphism Classes */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: 20px;
}

.app-container {
    width: 90%;
    max-width: 1200px;
    height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Typography & General */
h1, h2, h3 {
    margin-bottom: 15px;
    color: var(--text-dark);
}

/* Navigation */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    background: rgba(255, 255, 255, 0.4);
    border-bottom: 1px solid var(--glass-border);
}

.nav-links button {
    background: none;
    border: none;
    padding: 10px 15px;
    margin-left: 10px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.nav-links button:hover, .nav-links button.active {
    background: rgba(255, 255, 255, 0.6);
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.logout-btn {
    background: var(--primary) !important;
    color: white !important;
}

/* Layout */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    padding: 20px;
    gap: 20px;
}

.content-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    border-radius: 15px;
}

/* Forms & Inputs */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

input, select, button {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.6);
    font-size: 16px;
    outline: none;
    transition: all 0.3s;
    color: var(--text-dark);
}

input:focus, select:focus {
    background: rgba(255, 255, 255, 0.9);
    border-color: var(--secondary);
    box-shadow: 0 0 10px rgba(78, 205, 196, 0.3);
}

.btn-primary {
    background: linear-gradient(135deg, var(--secondary) 0%, #2980b9 100%);
    color: white;
    font-weight: bold;
    cursor: pointer;
    border: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

.btn-success { background: var(--success); color: white; border: none; cursor: pointer; }
.btn-warning { background: #D35400; color: white; border: none; cursor: pointer; }
.btn-danger { background: var(--danger); color: white; border: none; cursor: pointer; }

/* Login Container */
.login-container {
    max-width: 400px;
    margin: 50px auto;
    padding: 40px;
    text-align: center;
}

.login-icon {
    font-size: 50px;
    margin-bottom: 20px;
}

/* Tables */
.table-container {
    overflow-x: auto;
    border-radius: 10px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(255, 255, 255, 0.4);
}

th, td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid rgba(255,255,255,0.3);
}

th {
    background: rgba(255, 255, 255, 0.6);
    font-weight: bold;
}

tr:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Badges */
.badge {
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    color: white;
}
.badge-present { background: var(--success); }
.badge-absent { background: var(--danger); }
.badge-late { background: var(--warning); color: #fff;}

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

.stat-card {
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    background: rgba(255,255,255,0.5);
    transition: transform 0.3s;
}
.stat-card:hover {
    transform: translateY(-5px);
}
.stat-value {
    font-size: 36px;
    font-weight: bold;
    color: var(--primary);
    margin: 10px 0;
}

.file-upload-wrapper {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    align-items: center;
}

/* File Input Hack */
input[type="file"] {
    padding: 8px;
    background: rgba(255,255,255,0.8);
}

/* Day Grouping Layout */
.day-group {
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 25px;
    background: rgba(255, 255, 255, 0.6);
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    border-left: 8px solid var(--primary);
}

.day-header {
    font-size: 22px;
    font-weight: bold;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px dashed rgba(0,0,0,0.1);
}

/* Day Colors */
.day-1 { border-left-color: #f1c40f; background: rgba(241, 196, 15, 0.1); } /* จันทร์ - เหลือง */
.day-1 .day-header { color: #d4ac0d; }
.day-2 { border-left-color: #ff9ff3; background: rgba(255, 159, 243, 0.1); } /* อังคาร - ชมพู */
.day-2 .day-header { color: #f368e0; }
.day-3 { border-left-color: #2ecc71; background: rgba(46, 204, 113, 0.1); } /* พุธ - เขียว */
.day-3 .day-header { color: #27ae60; }
.day-4 { border-left-color: #e67e22; background: rgba(230, 126, 34, 0.1); } /* พฤหัส - ส้ม */
.day-4 .day-header { color: #d35400; }
.day-5 { border-left-color: #3498db; background: rgba(52, 152, 219, 0.1); } /* ศุกร์ - ฟ้า */
.day-5 .day-header { color: #2980b9; }

.duty-category {
    margin-bottom: 15px;
    padding: 10px;
    background: rgba(255,255,255,0.5);
    border-radius: 10px;
}

.duty-category h4 {
    margin-bottom: 8px;
    color: #34495e;
    font-size: 16px;
}

.duty-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    font-size: 14px;
}
.duty-item:last-child {
    border-bottom: none;
}
.duty-info {
    display: flex;
    gap: 15px;
    align-items: center;
}
.duty-actions {
    display: flex;
    gap: 5px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .app-container {
        width: 100%;
        max-width: none;
        height: 100vh;
        border-radius: 0;
        border: none;
    }
    
    .navbar {
        flex-direction: column;
        text-align: center;
        gap: 15px;
        border-radius: 0;
    }
    
    .nav-links {
        width: 100%;
    }
    
    .nav-links button {
        width: 100% !important;
    }

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

    /* Stack flex elements */
    input, select, button {
        flex: 1 1 100% !important;
        margin-bottom: 5px;
    }
    
    .tabs {
        flex-direction: column;
    }

    .duty-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .duty-actions {
        width: 100%;
        justify-content: space-between;
    }

    /* Force tables to scroll instead of breaking layout */
    .table-container {
        overflow-x: auto;
    }
    table {
        min-width: 600px;
    }

    /* Fix file upload wrapper */
    .file-upload-wrapper {
        flex-direction: column;
        align-items: stretch !important;
    }
    .file-upload-wrapper button {
        margin-left: 0 !important;
    }
}

/* Pastel Clean UI */
.pastel-bg-wrapper {
    background-color: #f3f0f9;
    border-radius: 20px;
    padding: 20px;
}

.pastel-card {
    background: #ffffff;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    padding: 25px;
    color: #1e293b;
    border: 1px solid #f1f5f9;
}

.pastel-card-title {
    font-size: 18px;
    font-weight: bold;
    color: #334155;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.pastel-stat-box {
    display: flex;
    align-items: center;
    gap: 20px;
    background: #ffffff;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    padding: 20px;
    flex: 1;
    min-width: 200px;
    border: 1px solid #f1f5f9;
}

.pastel-stat-box .stat-label {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 5px;
}

.pastel-stat-box .stat-value {
    font-size: 28px;
    font-weight: 800;
    color: #0f172a;
}

.pastel-icon-circle {
    width: 60px;
    height: 60px;
    border-radius: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 28px;
}
.icon-blue { background: #e0e7ff; color: #4f46e5; }
.icon-green { background: #dcfce7; color: #16a34a; }
.icon-red { background: #fee2e2; color: #ef4444; }
.icon-yellow { background: #fef9c3; color: #eab308; }

.pastel-btn-primary {
    background: #5a5ce5;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(90, 92, 229, 0.2);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}
.pastel-btn-primary:hover {
    background: #4a4ce0;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(90, 92, 229, 0.3);
}

.pastel-input {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px 15px;
    background: #f8fafc;
    color: #334155;
    transition: all 0.2s;
}
.pastel-input:focus {
    border-color: #5a5ce5;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(90, 92, 229, 0.1);
    outline: none;
}

.pastel-table {
    width: 100%;
    border-collapse: collapse;
}
.pastel-table th {
    background: #f8fafc !important;
    color: #64748b;
    font-weight: 600;
    padding: 12px 15px;
    border-bottom: 2px solid #e2e8f0 !important;
}
.pastel-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #f1f5f9 !important;
    color: #334155;
}
.pastel-table tr:hover td {
    background: #f8fafc;
}

/* New Executive Dashboard Header & Calendar */
.exec-top-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 30px;
    border-radius: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    box-shadow: 0 10px 20px rgba(118, 75, 162, 0.2);
}

.exec-header-date {
    font-size: 24px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 15px;
}

.exec-header-time {
    font-size: 36px;
    font-weight: 800;
    font-family: 'Courier New', Courier, monospace;
    text-shadow: 0 2px 10px rgba(0,0,0,0.2);
    background: rgba(255,255,255,0.2);
    padding: 5px 20px;
    border-radius: 30px;
    backdrop-filter: blur(5px);
}

/* Calendar Navigation */
.calendar-nav-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    background: white;
    padding: 10px 20px;
    border-radius: 30px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    margin-bottom: 20px;
}

.cal-nav-btn {
    background: #f1f5f9;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 18px;
    color: #4f46e5;
    cursor: pointer;
    transition: all 0.2s;
}

.cal-nav-btn:hover {
    background: #e0e7ff;
    transform: scale(1.1);
}

.cal-nav-display {
    font-size: 18px;
    font-weight: bold;
    color: #334155;
    min-width: 250px;
    text-align: center;
}

/* Morning & Evening Split */
.split-container {
    display: flex;
    gap: 25px;
    flex-wrap: wrap;
}

.split-box {
    flex: 1;
    min-width: 350px;
    background: white;
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.05);
}

.split-header {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f1f5f9;
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-morning { color: #f59e0b; border-bottom-color: #fef3c7; }
.header-evening { color: #3b82f6; border-bottom-color: #dbeafe; }

/* Duty Group Card */
.duty-group-box {
    margin-bottom: 20px;
    background: #f8fafc;
    border-radius: 12px;
    padding: 15px;
    border-left: 4px solid #94a3b8;
}

.duty-group-title {
    font-weight: bold;
    color: #475569;
    margin-bottom: 10px;
    font-size: 15px;
}

.person-card {
    background: white;
    padding: 12px 15px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
    border: 1px solid #f1f5f9;
}
.person-card:last-child { margin-bottom: 0; }

.person-info {
    display: flex;
    flex-direction: column;
}
.person-name {
    font-weight: 600;
    color: #1e293b;
    font-size: 15px;
}
.person-loc {
    font-size: 12px;
    color: #64748b;
    margin-top: 3px;
}

/* Lightbox Styles */
#customLightbox {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(8px);
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
#customLightbox.active {
    opacity: 1;
    pointer-events: all;
}
#customLightbox img {
    max-width: 90%;
    max-height: 90vh;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
#customLightbox.active img {
    transform: scale(1);
}
.lightbox-close {
    position: absolute;
    top: 20px; right: 30px;
    color: white;
    font-size: 40px;
    cursor: pointer;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    transition: color 0.2s;
}
.lightbox-close:hover {
    color: #ef4444;
}
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    font-size: 50px;
    cursor: pointer;
    padding: 20px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    transition: transform 0.2s, color 0.2s;
    user-select: none;
}
.lightbox-nav:hover {
    transform: translateY(-50%) scale(1.1);
    color: #60a5fa;
}
.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }

