:root {
    /* Premium Palette - Dark Sidebar Style */
    --sidebar-bg: #1e293b;
    /* Slate 800 */
    --sidebar-text: #f1f5f9;
    /* Slate 100 */
    --sidebar-hover: #334155;
    /* Slate 700 */
    --sidebar-active: #2563eb;
    /* Royal Blue */

    --primary-color: #2563eb;
    /* Royal Blue */
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;

    --bg-color: #f1f5f9;
    /* Slate 100 Background */
    --card-bg: #ffffff;

    --text-color: #334155;
    /* Slate 700 main text */
    --text-muted: #64748b;
    /* Slate 500 secondary */

    --border-color: #e2e8f0;

    /* Semantic Colors */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
}

@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@300;400;500;600;700&display=swap');

/* GLOBAL RESET */
html {
    font-size: 16px;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Sarabun', sans-serif;
    margin: 0;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* LAYOUT */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* SIDEBAR - The Key 'RCA' Look */
.app-sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    transition: width 0.3s;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.2);
    font-size: 1.25rem;
    font-weight: 700;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    letter-spacing: 0.5px;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.sidebar-menu {
    padding: 1.5rem 1rem;
    flex: 1;
}

.menu-category {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #94a3b8;
    /* Muted Slate */
    font-weight: 700;
    margin-bottom: 0.5rem;
    padding-left: 0.75rem;
    letter-spacing: 0.05em;
    margin-top: 1.5rem;
}

.menu-category:first-child {
    margin-top: 0;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: #cbd5e1;
    /* Light Gray */
    text-decoration: none;
    border-radius: 6px;
    margin-bottom: 0.25rem;
    transition: all 0.2s;
    font-weight: 500;
}

.menu-item:hover {
    background-color: var(--sidebar-hover);
    color: white;
}

.menu-item.active {
    background-color: var(--sidebar-active);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
}

.menu-item i,
.menu-item .icon {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
    opacity: 0.9;
}

.sidebar-footer {
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: #cbd5e1;
    text-align: center;
}

.user-info .user-role {
    opacity: 0.9;
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

.btn-sidebar-logout {
    display: block;
    text-align: center;
    padding: 0.6rem;
    border-radius: 6px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.btn-sidebar-logout:hover {
    background: #ef4444;
    color: white;
}

/* MAIN CONTENT */
.app-content {
    flex: 1;
    padding: 2.5rem;
    background-color: var(--bg-color);
}

.header {
    margin-bottom: 2.5rem;
}

.header h1 {
    font-size: 2rem;
    color: #1e293b;
    margin-bottom: 0.5rem;
}

/* CARDS ("RCA Style" usually involves top accent borders) */
.card {
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    padding: 2rem;
    margin-bottom: 2rem;
    border-top: 4px solid var(--primary-color);
    /* Signature Accent */
    position: relative;
}

/* FORM ELEMENTS */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #475569;
}

.form-control {
    width: 100%;
    padding: 0.65rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s;
    box-sizing: border-box;
    background: #fff;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* BUTTONS */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.65rem 1.5rem;
    border-radius: 6px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    gap: 0.5rem;
    font-size: 0.95rem;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: white;
    border: 1px solid var(--border-color);
    color: var(--text-color);
}

.btn-secondary:hover {
    background-color: #f8fafc;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    border-radius: 4px;
}

.btn-group {
    display: flex;
    gap: 0.5rem;
}

/* STATUS DASHBOARD */
.status-container {
    margin-bottom: 2rem;
}

.status-container h3 {
    font-size: 1.25rem;
    color: var(--text-color);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.status-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.status-card {
    background: white;
    border-radius: 8px;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
    text-decoration: none;
    color: inherit;
    border-left: 4px solid transparent;
}

.status-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.status-card.uploaded {
    border-left-color: var(--success);
}

.status-card.pending {
    border-left-color: var(--danger);
}

.status-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-right: 1rem;
    background: #f1f5f9;
}

.uploaded .status-icon {
    background: #d1fae5;
    color: var(--success);
}

.pending .status-icon {
    background: #fee2e2;
    color: var(--danger);
}

.status-topic {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.2rem;
}

.status-text {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* FILE LIST */
.month-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
    overflow: hidden;
}

.month-header {
    background: linear-gradient(to right, #f8fafc, #ffffff);
    padding: 1rem 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    border-bottom: 1px solid var(--border-color);
}

.topic-group {
    padding: 0 1.5rem;
}

.topic-group h3 {
    font-size: 1rem;
    color: #475569;
    background: #f1f5f9;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    margin: 1rem 0;
    display: inline-block;
}

/* TABLES */
.table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

.table th {
    background: #f8fafc;
    text-align: left;
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    color: #475569;
    border-bottom: 1px solid var(--border-color);
}

.table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    color: #334155;
}

.table tr:hover {
    background: #f8fafc;
}

/* BADGES */
.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
}

.badge-admin {
    background: #fee2e2;
    color: #991b1b;
}

.badge-manager {
    background: #fef3c7;
    color: #b45309;
}

.badge-user {
    background: #dcfce7;
    color: #166534;
}

/* SWEETALERT */
.swal2-popup {
    font-family: 'Sarabun', sans-serif !important;
    border-radius: 12px !important;
}

.swal2-actions button {
    margin: 0 35px !important;
}

/* ACTION BUTTONS (FILE LIST) - NEW */
.btn-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.5rem 1rem;
    /* Comfortable padding */
    border-radius: 50px;
    /* Pill shape */
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    line-height: 1;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* View Button - Blue */
.btn-view {
    background-color: #ffffff;
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-view:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(37, 99, 235, 0.2);
}

/* Edit Button - Amber */
.btn-edit {
    background-color: #ffffff;
    color: #d97706;
    /* Amber 600 */
    border-color: #d97706;
}

.btn-edit:hover {
    background-color: #d97706;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(217, 119, 6, 0.2);
}

/* Delete Button - Red */
.btn-delete-action {
    background-color: #ffffff;
    color: #ef4444;
    /* Red 500 */
    border-color: #ef4444;
}

.btn-delete-action:hover {
    background-color: #ef4444;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(239, 68, 68, 0.2);
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .app-wrapper {
        flex-direction: column;
    }

    .app-sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }

    .sidebar-menu {
        display: flex;
        overflow-x: auto;
        padding: 1rem;
    }

    .menu-item {
        white-space: nowrap;
        margin-right: 0.5rem;
    }

    .menu-category {
        display: none;
    }
}