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

:root {
    --primary: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #0f172a;
    --bg-main: #f8fafc;
    --bg-sidebar: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --accent: #f59e0b;
    --border: #e2e8f0;
    --sidebar-width: 280px;
    --radius-lg: 24px;
    --radius-md: 16px;
    --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
    --header-height: 65px;
    --bottom-nav-height: 70px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
}

.app-container {
    display: flex;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    padding: 1.25rem 1.25rem;
    position: fixed;
    height: 100vh;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.75rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1.5rem;
}

.nav-menu {
    flex: 1;
    overflow-y: auto;
    margin-right: -10px;
    padding-right: 10px;
}

.nav-label {
    padding: 1rem 1.25rem 0.5rem;
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.6;
}

.nav-menu::-webkit-scrollbar {
    width: 5px;
}

.nav-menu::-webkit-scrollbar-track {
    background: transparent;
}

.nav-menu::-webkit-scrollbar-thumb {
    background: #e2e8f0;
    border-radius: 10px;
}

.nav-menu::-webkit-scrollbar-thumb:hover {
    background: var(--primary-light);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0.85rem 1.25rem;
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 600;
    border-radius: var(--radius-md);
    transition: 0.3s;
    margin-bottom: 4px;
}

.nav-item:hover { background: #f1f5f9; color: var(--primary); }
.nav-item.active { background: var(--primary); color: white; box-shadow: 0 8px 15px rgba(79, 70, 229, 0.3); }

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-footer {
    background: white;
    padding: 1rem 3rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    position: sticky;
    bottom: 0;
    z-index: 900;
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.03);
}

.top-header {
    height: 65px;
    background: white;
    padding: 0 3rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 900;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* User Profile Dropdown */
.user-profile {
    position: relative;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-profile img {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: 2px solid white;
    box-shadow: 0 0 10px rgba(0,0,0,0.05);
}

.profile-dropdown {
    position: absolute;
    top: calc(100% + 15px);
    right: 0;
    width: 220px;
    background: white;
    border-radius: 20px;
    border: 1px solid var(--border);
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    padding: 1rem;
    display: none;
    z-index: 2000;
    animation: slideDown 0.3s ease;
}

.profile-dropdown.show {
    display: block;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.dropdown-header {
    padding-bottom: 12px;
    border-bottom: 1px solid #f1f5f9;
    margin-bottom: 12px;
}

.dropdown-header h4 { font-size: 0.9rem; font-weight: 800; margin-bottom: 2px; }
.dropdown-header span { font-size: 0.75rem; color: var(--text-muted); font-weight: 600; }

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 15px;
    text-decoration: none;
    color: var(--text-main);
    font-size: 0.85rem;
    font-weight: 700;
    border-radius: 12px;
    transition: 0.2s;
}

.dropdown-item:hover {
    background: #f8fafc;
    color: var(--primary);
    padding-left: 20px;
}

.dropdown-item.logout {
    color: #ef4444;
    margin-top: 8px;
    background: #fef2f2;
}

.dropdown-item.logout:hover {
    background: #ef4444;
    color: white;
}

/* Page Headers */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1rem 0;
}

.dashboard-content {
    padding: 2.5rem;
    animation: fadeIn 0.4s ease-out;
}

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

/* Cards & Forms */
.card-section, .form-card, .table-card {
    background: white;
    padding: 2rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.table-card { padding: 0; overflow: hidden; }

/* Form Controls */
label { display: block; font-weight: 700; color: var(--text-muted); margin-bottom: 10px; font-size: 0.9rem; }
input, select, textarea {
    width: 100%;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    outline: none;
    background: #fcfcfc;
}
input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1); }

/* Buttons */
.btn-primary {
    background: var(--primary);
    color: white;
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    border: none;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.btn-sm {
    padding: 8px 16px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: white;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

/* Tables */
table { width: 100%; border-collapse: collapse; }
th { background: #f8fafc; padding: 1.25rem; text-align: left; font-size: 0.75rem; text-transform: uppercase; color: var(--text-muted); border-bottom: 1px solid var(--border); }
td { padding: 1.25rem; border-bottom: 1px solid #f1f5f9; }

/* Status Badges */
.badge-status { padding: 5px 12px; border-radius: 50px; font-size: 0.7rem; font-weight: 800; text-transform: uppercase; }
.badge-status.approved { background: #dcfce7; color: #15803d; }
.badge-status.draft { background: #f1f5f9; color: #475569; }
.badge-status.pass { background: #dcfce7; color: #15803d; }
.badge-status.fail { background: #fee2e2; color: #b91c1c; }
/* Dashboard Specific Styles */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    position: relative;
    padding: 1.75rem;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: white;
    color: var(--text-main);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.stat-card.purple { background: linear-gradient(135deg, #6366f1, #a855f7); color: white; border: none; }
.stat-card.blue { background: linear-gradient(135deg, #3b82f6, #06b6d4); color: white; border: none; }
.stat-card.orange { background: linear-gradient(135deg, #f59e0b, #ef4444); color: white; border: none; }
.stat-card.green { background: linear-gradient(135deg, #10b981, #3b82f6); color: white; border: none; }

.stat-icon-bg {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.stat-info .label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.stat-info .value {
    display: block;
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: -20px;
    right: -20px;
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    pointer-events: none;
}

/* Activity Timeline */
.timeline {
    position: relative;
    padding-left: 2rem;
    margin-top: 1rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.timeline-item {
    position: relative;
    margin-bottom: 1.5rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -29px;
    top: 5px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid white;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
    z-index: 1;
}

.timeline-content {
    background: #f8fafc;
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.timeline-content h4 { font-size: 0.9rem; font-weight: 700; margin-bottom: 4px; }
.timeline-content p { font-size: 0.8rem; color: var(--text-muted); }
.timeline-time { font-size: 0.7rem; color: var(--text-muted); font-weight: 600; margin-top: 4px; display: block; }

/* Progress */
.progress-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px;
    background: #f1f5f9;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
}

.pulse-live {
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
    position: relative;
}

.pulse-live::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #22c55e;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(3); opacity: 0; }
}

/* Material Library Grid */
.material-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.resource-card {
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 1.5rem;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    position: relative;
    overflow: hidden;
    height: 100%;
}

.resource-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 30px -10px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-light);
}

.resource-type-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.resource-type-icon.pdf { background: #fee2e2; color: #ef4444; }
.resource-type-icon.video { background: #dbeafe; color: #3b82f6; }
.resource-type-icon.ppt { background: #fef3c7; color: #f59e0b; }
.resource-type-icon.notes { background: #dcfce7; color: #10b981; }
.resource-type-icon.image { background: #f3e8ff; color: #a855f7; }

.resource-card h3 {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--secondary);
    line-height: 1.4;
    margin-bottom: 0.25rem;
}

.resource-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 600;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: auto;
}

.meta-badge {
    padding: 3px 8px;
    background: #f1f5f9;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.resource-actions {
    display: flex;
    gap: 10px;
    margin-top: 0.5rem;
    border-top: 1px solid var(--border);
    padding-top: 1rem;
}

.btn-resource {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    border-radius: 10px;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 700;
    transition: 0.2s;
}

.btn-download { background: var(--primary); color: white; }
.btn-download:hover { background: var(--secondary); }
.btn-delete { background: #fee2e2; color: #ef4444; }
.btn-delete:hover { background: #ef4444; color: white; }


/* Dashboard Specific Styles */
.dashboard-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 2rem; }
.badge-year { background: #f1f5f9; padding: 6px 12px; border-radius: 10px; font-size: 0.75rem; font-weight: 700; color: var(--primary); }

/* Progress Bars */
.progress-container { display: flex; flex-direction: column; gap: 1.5rem; margin-top: 1.5rem; }
.prog-label { display: flex; justify-content: space-between; font-weight: 700; font-size: 0.875rem; margin-bottom: 8px; }
.prog-bar { height: 10px; background: #f1f5f9; border-radius: 10px; overflow: hidden; position: relative; }
.prog-bar .fill { height: 100%; border-radius: 10px; transition: width 1s cubic-bezier(0.4, 0, 0.2, 1); }

/* Quick Buttons */
.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 1rem; }
.quick-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 1.5rem 1rem; background: white; border: 1px solid var(--border); border-radius: 20px; text-decoration: none; color: var(--text-main); transition: 0.3s; }
.quick-btn i { font-size: 1.5rem; color: var(--primary); transition: 0.3s; }
.quick-btn span { font-size: 0.75rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; }
.quick-btn:hover { border-color: var(--primary); transform: translateY(-5px); box-shadow: var(--shadow); }
.quick-btn:hover i { transform: scale(1.2); }

.btn-light { display: inline-block; padding: 12px 20px; border-radius: 12px; text-decoration: none; font-weight: 800; font-size: 0.85rem; }
.btn-sm-dash { padding: 6px 15px; border-radius: 8px; cursor: pointer; font-weight: 700; font-size: 0.75rem; border: none; }
/* Mobile Responsiveness & App Conversion */
@media (max-width: 992px) {
    :root {
        --sidebar-width: 280px;
    }

    .sidebar {
        left: calc(-1 * var(--sidebar-width));
        transition: transform 0.3s ease-in-out;
        box-shadow: 15px 0 30px rgba(0,0,0,0.1);
    }

    .sidebar.open {
        transform: translateX(var(--sidebar-width));
    }

    .main-content {
        margin-left: 0;
        width: 100%;
    }

    .top-header {
        padding: 0 1.25rem;
    }

    .dashboard-content {
        padding: 1.25rem;
        padding-bottom: calc(var(--bottom-nav-height) + 20px);
    }

    .welcome-banner {
        margin-bottom: 1.5rem !important;
    }

    .welcome-banner > div {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 1rem;
    }

    .welcome-banner h1 {
        font-size: 1.5rem !important;
        line-height: 1.2;
    }

    .welcome-banner p {
        font-size: 0.9rem !important;
        line-height: 1.4;
    }

    .dashboard-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    .side-stats {
        margin-top: 1rem;
    }

    /* Font Size Adjustments for Mobile */
    html {
        font-size: 14px; /* Slightly smaller base font */
    }

    h2 { font-size: 1.25rem !important; }
    h3 { font-size: 1.1rem !important; }

    .top-header h2 {
        font-size: 1.1rem !important;
    }

    .stat-info .value {
        font-size: 1.35rem !important;
    }

    .stat-info .label {
        font-size: 0.7rem !important;
    }

    table th, table td {
        font-size: 0.8rem !important;
        padding: 1rem 0.75rem !important;
    }

    .nav-item {
        font-size: 0.9rem !important;
    }

    .section-header p {
        font-size: 0.8rem !important;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important; /* 2 columns on mobile */
        gap: 10px !important;
    }

    .stat-card {
        padding: 1rem !important;
        gap: 8px !important;
        border-radius: 16px !important;
    }

    .stat-icon-bg {
        width: 40px !important;
        height: 40px !important;
        font-size: 1rem !important;
    }

    .table-card {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        margin-right: -1.25rem; /* Allow table to go to edge */
        margin-left: -1.25rem;
        border-radius: 0;
    }

    table {
        min-width: 800px; /* Force scroll on small screens */
    }

    table th, table td {
        white-space: nowrap; /* Prevent messy wrapping */
        padding: 0.85rem 1rem !important;
    }

    table td:nth-child(4) { /* Topic/Subject column might need wrapping */
        white-space: normal;
        min-width: 200px;
    }

    .app-footer {
        display: none; /* Hide standard footer on mobile app view */
    }

    .mobile-menu-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        border-radius: 12px;
        background: #f1f5f9;
        color: var(--primary);
        border: none;
        font-size: 1.25rem;
        cursor: pointer;
    }

    .bottom-nav {
        display: flex !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: var(--bottom-nav-height);
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        border-top: 1px solid var(--border);
        z-index: 1000;
        justify-content: space-around;
        align-items: center;
        padding: 0 10px;
    }

    .bottom-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-decoration: none;
        color: var(--text-muted);
        font-size: 0.65rem;
        font-weight: 700;
        gap: 4px;
        transition: 0.3s;
    }

    .bottom-nav-item i {
        font-size: 1.25rem;
    }

    .bottom-nav-item.active {
        color: var(--primary);
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 999;
        backdrop-filter: blur(2px);
    }

    .sidebar-overlay.active {
        display: block;
    }
}

/* Hide mobile elements on desktop */
.mobile-menu-btn, .bottom-nav, .sidebar-overlay {
    display: none;
}
