@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Sarabun:wght@300;400;500;600;700&display=swap');

:root {
    /* Modern Color Palette */
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --secondary: #64748b;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    
    /* Layout Colors */
    --sidebar-bg: #0f172a;
    --sidebar-hover: #1e293b;
    --body-bg: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    
    /* Effects */
    --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);
    --radius-md: 12px;
    --radius-lg: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', 'Sarabun', sans-serif;
    background-color: var(--body-bg);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
}

.dashboard-container {
    display: flex;
    min-height: 100vh;
}

/* --- Enhanced Sidebar --- */
.sidebar {
    width: 280px;
    background-color: var(--sidebar-bg);
    color: #f1f5f9;
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    box-shadow: 4px 0 24px rgba(0,0,0,0.15);
    z-index: 100;
}

.sidebar h3 {
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(135deg, #60a5fa, #2563eb);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 5px;
    text-align: left;
    padding-left: 10px;
}

.sidebar p {
    font-size: 13px;
    color: #94a3b8;
    margin-bottom: 30px;
    padding-left: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 20px;
}

.sidebar ul {
    list-style: none;
    flex-grow: 1;
}

.sidebar ul li a {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: #cbd5e1;
    text-decoration: none;
    border-radius: var(--radius-md);
    margin-bottom: 4px;
    font-weight: 500;
    font-size: 14px;
    transition: var(--transition);
}

.sidebar ul li a:hover {
    background-color: var(--sidebar-hover);
    color: #fff;
    transform: translateX(5px);
}

.sidebar ul li.active > a {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.logout-btn {
    margin-top: 20px;
    padding: 12px;
    background-color: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    text-decoration: none;
    text-align: center;
    border-radius: var(--radius-md);
    font-weight: 600;
    border: 1px solid rgba(239, 68, 68, 0.2);
    transition: var(--transition);
}

.logout-btn:hover {
    background-color: #ef4444;
    color: #fff;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* --- Main Content Area --- */
.main-content {
    flex-grow: 1;
    padding: 40px;
    max-width: calc(100% - 280px);
}

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

.content-header h1 {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.025em;
    color: #0f172a;
}

.content-body {
    background-color: var(--card-bg);
    padding: 35px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

/* --- Cards & Stats --- */
.summary-box {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.summary-card {
    padding: 24px;
    border-radius: var(--radius-md);
    position: relative;
    overflow: hidden;
    transition: var(--transition);
    border: 1px solid rgba(0,0,0,0.05);
}

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

.summary-card h3 {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 4px;
}

.summary-card p {
    font-size: 14px;
    font-weight: 500;
    opacity: 0.9;
}

.bg-blue { background: linear-gradient(135deg, #3b82f6, #2563eb); color: white; }
.bg-green { background: linear-gradient(135deg, #10b981, #059669); color: white; }
.bg-red { background: linear-gradient(135deg, #ef4444, #dc2626); color: white; }
.bg-gray { background: linear-gradient(135deg, #64748b, #475569); color: white; }

/* --- Tables Styling --- */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 20px;
}

table th {
    background-color: #f8fafc;
    padding: 16px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border-color);
    text-align: left;
}

table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
    color: var(--text-main);
    transition: var(--transition);
}

table tbody tr:hover td {
    background-color: #f1f5f9;
}

table tbody tr:last-child td:first-child { border-bottom-left-radius: var(--radius-md); }
table tbody tr:last-child td:last-child { border-bottom-right-radius: var(--radius-md); }

/* --- Forms & Inputs --- */
.form-group label {
    font-size: 14px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 8px;
}

input[type="text"], input[type="password"], input[type="email"], select, input[type="date"] {
    width: 100%;
    padding: 12px 16px;
    background-color: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    color: var(--text-main);
    transition: var(--transition);
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

/* --- Modern Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    gap: 8px;
    border: none;
    color: #fff !important;
}

.btn:active { transform: scale(0.95); }

.btn-primary { background-color: var(--primary); }
.btn-primary:hover { background-color: var(--primary-hover); box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25); }

.btn-success { background-color: var(--success); }
.btn-warning { background-color: var(--warning); }
.btn-danger { background-color: var(--danger); }
.btn-secondary { background-color: var(--secondary); }
.btn-info { background-color: var(--info); }

/* --- Action Buttons --- */
.action-buttons {
    display: flex;
    gap: 12px;
}

/* --- Status Badges --- */
.status-badge {
    padding: 6px 12px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
}

.status-participated { background-color: #dcfce7; color: #166534; }
.status-absent { background-color: #fee2e2; color: #991b1b; }

/* --- Responsive Adjustments --- */
@media (max-width: 1024px) {
    .sidebar { width: 80px; padding: 20px 10px; }
    .sidebar h3, .sidebar p, .sidebar ul li a span { display: none; }
    .main-content { max-width: calc(100% - 80px); }
}
/* --- Global Print Styles --- */
@media print {
    body, .main-content, .content-body, table, tr, td, th, .summary-card {
        background: #fff !important;
        background-color: #fff !important;
        color: #000 !important;
        box-shadow: none !important;
        border-color: #000 !important;
    }
    .sidebar, .no-print, .logout-btn, .btn, .summary-box, .activity-selector, .content-header {
        display: none !important;
    }
    .main-content {
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    table {
        border: 1px solid #000 !important;
    }
    th, td {
        border: 1px solid #000 !important;
        padding: 5px !important;
    }
}

/* Additional Print Fixes */
@media print {
    * { 
        border: none !important; 
        box-shadow: none !important; 
    }
    table, th, td {
        border: none !important;
    }
}

/* Correcting Print Styles: Keep Table Lines, Remove Box Borders */
@media print {
    .content-body, .summary-card {
        border: none !important;
        box-shadow: none !important;
    }
    table, th, td {
        border: 1px solid #000 !important;
    }
}

/* Restore Dotted Lines for Print */
@media print {
    .dotted-line {
        border-bottom: 1px dotted #000 !important;
        display: block !important;
        height: 25px !important;
        margin-bottom: 10px !important;
    }
}
