:root {
    --primary-color: #1A365D;     /* Navy Blue */
    --primary-light: #2B6CB0;
    --secondary-color: #F59E0B;   /* Vibrant Amber */
    --accent-color: #38B2AC;
    
    --bg-light: #F7FAFC;
    --bg-white: #FFFFFF;
    
    --text-dark: #2D3748;
    --text-muted: #718096;
    --border-color: #E2E8F0;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

    --border-radius-sm: 4px;
    --border-radius-md: 8px;
    --border-radius-lg: 12px;
}

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

body {
    font-family: 'Kanit', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
}

/* App Layout Grid */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    z-index: 100;
}

.sidebar-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-header h2 {
    font-weight: 600;
    letter-spacing: 1px;
}

.sidebar-nav ul {
    list-style: none;
    padding: 10px 0;
}

.nav-section {
    padding: 15px 20px 5px;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.5);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 1px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: all 0.2s;
}

.sidebar-nav a i {
    margin-right: 12px;
    font-size: 1.2rem;
}

.sidebar-nav a:hover, .sidebar-nav a.active {
    background-color: rgba(255,255,255,0.1);
    color: white;
    border-left: 4px solid var(--secondary-color);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0; /* Important for flex child truncation */
}

/* Topbar */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    background: var(--bg-white);
    box-shadow: var(--shadow-sm);
    z-index: 50;
}

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

.page-title {
    font-size: 1.3rem;
    font-weight: 500;
    color: var(--primary-color);
}

.btn-icon {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s;
}
.btn-icon:hover {
    color: var(--primary-color);
}

.admin-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: var(--primary-color);
}

/* Content Area */
.content-wrapper {
    padding: 30px;
    flex: 1;
}

/* Cards */
.card {
    background: var(--bg-white);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    margin-bottom: 24px;
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}
.card-title {
    font-size: 1.2rem;
    color: var(--primary-color);
    font-weight: 600;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 0.95rem;
    font-weight: 500;
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}
.btn-primary {
    background-color: var(--primary-color);
    color: white;
}
.btn-primary:hover {
    background-color: var(--primary-light);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}
.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}
.btn-secondary:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}
.btn-outline {
    background-color: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}
.btn-outline:hover {
    background-color: var(--primary-color);
    color: white;
}
.btn-danger {
    background-color: #E53E3E;
    color: white;
}
.btn-danger:hover {
    background-color: #C53030;
}
.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}
table {
    width: 100%;
    border-collapse: collapse;
}
th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}
th {
    background-color: #F8FAFC;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}
tbody tr {
    transition: background-color 0.2s;
}
tbody tr:hover {
    background-color: #F8FAFC;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}
.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-dark);
}
.form-control {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-family: inherit;
    font-size: 1rem;
    color: var(--text-dark);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-control:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(43, 108, 176, 0.1);
}
select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1em;
}

/* Alerts */
.alert {
    padding: 15px;
    border-radius: var(--border-radius-sm);
    margin-bottom: 20px;
}
.alert-success {
    background-color: #C6F6D5;
    color: #2F855A;
    border: 1px solid #9AE6B4;
}
.alert-danger {
    background-color: #FED7D7;
    color: #C53030;
    border: 1px solid #FEB2B2;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -260px;
        height: 100vh;
    }
    .sidebar.show {
        left: 0;
    }
    .content-wrapper {
        padding: 15px;
    }
}
