/* assets/css/style.css */
@import url('https://fonts.googleapis.com/css2?family=Prompt:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #0f172a;          /* Slate 900 */
    --primary-light: #2563eb;    /* Royal Blue */
    --secondary: #1e293b;        /* Slate 800 */
    --accent: #4f46e5;           /* Indigo 600 */
    --accent-light: #818cf8;     /* Indigo 400 */
    --success: #10b981;          /* Emerald 500 */
    --warning: #f59e0b;          /* Amber 500 */
    --danger: #ef4444;           /* Red 500 */
    --dark: #0f172a;
    --light: #f8fafc;            /* Slate 50 */
    --white: #ffffff;
    --gray: #64748b;             /* Slate 500 */
    --border: #e2e8f0;           /* Slate 200 */
    --shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.04), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
    --shadow-hover: 0 20px 25px -5px rgba(15, 23, 42, 0.08), 0 10px 10px -6px rgba(15, 23, 42, 0.08);
    --sidebar-width: 280px;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

body.no-sidebar {
    --sidebar-width: 0px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Prompt', sans-serif;
    letter-spacing: -0.01em;
}

body {
    background: #f8fafc;
    background-image: radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.03) 0, transparent 50%),
                      radial-gradient(at 100% 100%, rgba(37, 99, 235, 0.03) 0, transparent 50%);
    color: var(--primary);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden; /* Prevents whole-page horizontal scrolling on desktop/mobile */
}

/* Auth Layout */
.auth-wrapper {
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top left, #1e293b, #0f172a);
    padding: 20px;
}

.auth-card {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 24px;
    padding: 45px 40px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.8);
    animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.auth-header {
    text-align: center;
    margin-bottom: 35px;
}

.auth-header h1 {
    font-size: 1.6rem;
    color: var(--primary);
    font-weight: 700;
    margin-bottom: 8px;
}

.auth-header p {
    color: var(--gray);
    font-size: 0.9rem;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--primary);
    position: fixed;
    left: 0;
    top: 0;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    border-right: 1px solid rgba(255, 255, 255, 0.04);
    transition: var(--transition);
}

.sidebar-brand {
    padding: 35px 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.sidebar-brand h2 {
    font-size: 1.15rem;
    color: var(--white);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-brand h2 i {
    color: var(--primary-light);
}

.sidebar-menu {
    flex: 1;
    padding: 25px 20px;
    overflow-y: auto;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 12px 18px;
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.85); /* Bright white/slate text */
    text-decoration: none;
    margin-bottom: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    transition: var(--transition);
}

.menu-item i {
    margin-right: 14px;
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
    color: rgba(255, 255, 255, 0.6); /* Muted icon for contrast */
    transition: var(--transition);
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--white);
}

.menu-item:hover i {
    color: var(--white);
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
}

.menu-item.active {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--accent) 100%);
    color: var(--white);
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.25);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.menu-item.active i {
    color: var(--white);
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.sidebar-footer .menu-item:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

/* Sidebar Toggle Button style */
.sidebar-toggle-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.sidebar-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--white);
    transform: scale(1.05);
}

/* Collapsed Sidebar Styles */
body.collapsed {
    --sidebar-width: 80px;
}

body.collapsed .brand-text,
body.collapsed .menu-text {
    display: none;
}

body.collapsed .sidebar-brand {
    justify-content: center;
    padding: 35px 0;
}

body.collapsed .sidebar-brand h2 {
    font-size: 1.5rem;
}

body.collapsed .sidebar-brand h2 i {
    margin-right: 0;
}

body.collapsed .sidebar-toggle-btn {
    position: absolute;
    right: -16px;
    top: 32px;
    background: var(--primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1001;
}

body.collapsed .menu-item {
    justify-content: center;
    padding: 12px 0;
}

body.collapsed .menu-item i {
    margin-right: 0;
    font-size: 1.25rem;
}

body.collapsed .sidebar-footer {
    padding: 20px 0;
    display: flex;
    justify-content: center;
}

/* Main Content */
.main-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 40px;
    width: calc(100% - var(--sidebar-width));
    min-width: 0; /* Prevents flex overflow from expanding wrapper beyond the viewport */
    overflow-x: hidden; /* Prevents horizontal scrolling/sliding under the fixed sidebar */
    box-sizing: border-box;
    transition: var(--transition);
}

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

.top-nav h2 {
    font-weight: 700;
    color: var(--primary);
    font-size: 1.75rem;
}

.user-profile {
    display: flex;
    align-items: center;
    background: var(--white);
    padding: 8px 18px;
    border-radius: 50px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: var(--transition);
}

.user-profile:hover {
    box-shadow: var(--shadow-hover);
}

.user-profile img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    margin-right: 12px;
    border: 2px solid var(--border);
}

.user-info span {
    line-height: 1.2;
}

/* Cards & Stats */
.card {
    background: var(--white);
    border-radius: 20px;
    padding: 30px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(226, 232, 240, 0.8);
    margin-bottom: 30px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: transparent;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-hover);
}

.card:hover::before {
    background: linear-gradient(to bottom, var(--primary-light), var(--accent));
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 15px;
}

.card-header h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary);
}

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

.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin-bottom: 35px;
}

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

.stat-card {
    background: var(--white);
    padding: 25px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    box-shadow: var(--shadow);
    border: 1px solid rgba(226, 232, 240, 0.8);
    transition: var(--transition);
}

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

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    margin-right: 20px;
}

.stat-info h3 {
    font-size: 0.85rem;
    color: var(--gray);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.stat-info p {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
}

/* Forms */
.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--secondary);
}

.form-control {
    width: 100%;
    padding: 12px 18px;
    border-radius: 12px;
    border: 1px solid var(--border);
    outline: none;
    font-size: 0.95rem;
    color: var(--primary);
    background: var(--light);
    transition: var(--transition);
}

.form-control:focus {
    background: var(--white);
    border-color: var(--primary-light);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.btn {
    padding: 12px 24px;
    border-radius: 12px;
    border: none;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--accent) 100%);
    color: var(--white);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.25);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--light);
    color: var(--secondary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

/* Tables */
.table-container {
    overflow-x: auto;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--white);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 18px 20px;
    color: var(--gray);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--border);
    background: var(--light);
}

td {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    font-size: 0.95rem;
    color: var(--secondary);
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: rgba(248, 250, 252, 0.8);
}

/* Badge */
.badge {
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
}

.badge-success { background: rgba(16, 185, 129, 0.08); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.15); }
.badge-warning { background: rgba(245, 158, 11, 0.08); color: var(--warning); border: 1px solid rgba(245, 158, 11, 0.15); }
.badge-danger { background: rgba(239, 110, 110, 0.08); color: var(--danger); border: 1px solid rgba(239, 110, 110, 0.15); }

/* Grid Layout for Forms */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

/* Score Radio Buttons Enhancements */
.score-buttons {
    display: flex;
    gap: 12px;
    margin-top: 5px;
}

.score-buttons label {
    flex: 1;
    text-align: center;
    cursor: pointer;
}

.score-buttons input[type="radio"] {
    display: none;
}

.score-buttons span {
    display: block;
    padding: 12px;
    background: var(--light);
    border: 1px solid var(--border);
    border-radius: 12px;
    font-weight: 700;
    color: var(--secondary);
    transition: var(--transition);
}

.score-buttons label:hover span {
    background: var(--border);
}

.score-buttons input[type="radio"]:checked + span {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--accent) 100%);
    color: white;
    border-color: transparent;
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
}

/* Responsive Styles */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .main-wrapper { margin-left: 0; width: 100%; padding: 20px; padding-bottom: 90px; }
    .form-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr !important; }
    
    /* Table to Cards Transformation for listing tables */
    .table-container.responsive-cards table, 
    .table-container.responsive-cards thead, 
    .table-container.responsive-cards tbody, 
    .table-container.responsive-cards th, 
    .table-container.responsive-cards td, 
    .table-container.responsive-cards tr { 
        display: block; 
    }
    .table-container.responsive-cards thead tr { position: absolute; top: -9999px; left: -9999px; }
    .table-container.responsive-cards tr { border: 1px solid var(--border); border-radius: 16px; margin-bottom: 20px; padding: 15px; background: white; box-shadow: var(--shadow); }
    .table-container.responsive-cards td { border: none; position: relative; padding-left: 50% !important; text-align: right; min-height: 45px; border-bottom: 1px solid var(--light); }
    .table-container.responsive-cards td:last-child { border-bottom: none; }
    .table-container.responsive-cards td:before { 
        content: attr(data-label); 
        position: absolute; 
        left: 15px; 
        width: 45%; 
        padding-right: 10px; 
        white-space: nowrap; 
        text-align: left; 
        font-weight: 600;
        color: var(--gray);
    }
    
    /* Mobile Nav */
    .mobile-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        background: var(--white);
        justify-content: space-around;
        padding: 12px 0;
        box-shadow: 0 -8px 30px rgba(15, 23, 42, 0.08);
        z-index: 2000;
        border-radius: 24px 24px 0 0;
        border-top: 1px solid var(--border);
    }
    .mobile-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-decoration: none;
        color: var(--gray);
        font-size: 0.75rem;
        font-weight: 500;
    }
    .mobile-nav-item i { font-size: 1.25rem; margin-bottom: 4px; }
    .mobile-nav-item.active { color: var(--primary-light); }
}

@media (max-width: 576px) {
    .top-nav {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
        margin-bottom: 25px;
    }
    .user-profile {
        width: 100%;
        justify-content: flex-start;
    }
}
