@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --secondary: #64748b;
    --accent: #f43f5e;
    --success: #10b981;
    --warning: #f59e0b;
    --info: #3b82f6;
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --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);
    --premium-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Plus Jakarta Sans', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    padding-bottom: 70px; /* Space for mobile nav */
}

@media (min-width: 769px) {
    body { padding-bottom: 0; }
}

/* Layout */
.container {
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 24px;
}

.section-py { padding: 40px 0; }
@media (min-width: 769px) {
    .section-py { padding: 60px 0; }
}

/* Navbar */
.navbar {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    height: 72px;
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--border);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    font-size: 20px;
    font-weight: 800;
    color: var(--primary);
    text-decoration: none;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-links {
    display: none;
    gap: 32px;
    align-items: center;
}

@media (min-width: 769px) {
    .nav-links { display: flex; }
}

.nav-link {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 14px;
    transition: var(--transition);
}

.nav-link:hover, .nav-link.active {
    color: var(--primary);
}

.nav-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.nav-avatar {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    object-fit: cover;
    border: 2px solid var(--border);
    transition: var(--transition);
}

.nav-profile:hover .nav-avatar {
    border-color: var(--primary);
    transform: scale(1.05);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: 14px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    text-decoration: none;
    gap: 8px;
    white-space: nowrap;
}

.btn-primary {
    background: var(--premium-gradient);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
}

.btn-outline {
    background: white;
    border: 1.5px solid var(--border);
    color: var(--text-main);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(99, 102, 241, 0.02);
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: 24px;
    border: 1px solid var(--border);
    overflow: hidden;
    transition: var(--transition);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.06);
    border-color: var(--primary-light);
}

.card-img-wrapper {
    position: relative;
    padding-top: 56.25%; /* 16:9 Aspect Ratio */
    overflow: hidden;
}

.card-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover .card-img {
    transform: scale(1.1);
}

.card-body {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.card-tag {
    font-size: 11px;
    font-weight: 800;
    color: var(--primary);
    text-transform: uppercase;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.card-title {
    font-size: 17px;
    font-weight: 800;
    margin-bottom: 8px;
    color: var(--text-main);
    line-height: 1.4;
}

.card-text {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 20px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Grid System */
.grid, .grid-2, .grid-3, .grid-4, .grid-3-col {
    display: grid;
    gap: 20px;
    grid-template-columns: 1fr;
}

@media (min-width: 640px) {
    .grid-2 { grid-template-columns: repeat(2, 1fr); }
    .grid-3-col { grid-template-columns: 1fr 1fr 1fr; }
}

@media (max-width: 768px) {
    .grid-2, .grid-3, .grid-4 { 
        grid-template-columns: 1fr; 
        width: 100%;
    }
}

@media (min-width: 769px) {
    .grid-2 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1025px) {
    .grid-3 { grid-template-columns: repeat(3, 1fr); }
    .grid-4 { grid-template-columns: repeat(4, 1fr); }
}

/* Forms */
.form-group { margin-bottom: 20px; }
.form-label {
    display: block;
    font-weight: 700;
    font-size: 13px;
    margin-bottom: 8px;
    color: var(--text-main);
}
.form-control {
    width: 100%;
    padding: 12px 16px;
    border-radius: 14px;
    border: 1.5px solid var(--border);
    background: #fff;
    font-size: 14px;
    transition: var(--transition);
    color: var(--text-main);
}
.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.08);
}

/* Hero Section */
.hero {
    background: white;
    padding: 60px 0;
    text-align: center;
    border-bottom: 1px solid var(--border);
}

@media (min-width: 769px) {
    .hero { padding: 80px 0; }
}

.hero-title {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 16px;
    letter-spacing: -1px;
    line-height: 1.2;
}

@media (min-width: 769px) {
    .hero-title { font-size: 48px; }
}

.hero-subtitle {
    font-size: 15px;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto 32px;
    line-height: 1.6;
}

@media (min-width: 769px) {
    .hero-subtitle { font-size: 17px; }
}

/* Progress Bar */
.progress-container {
    width: 100%;
    height: 6px;
    background: #f1f5f9;
    border-radius: 100px;
    overflow: hidden;
    margin: 12px 0;
}

.progress-bar {
    height: 100%;
    background: var(--premium-gradient);
    border-radius: 100px;
    transition: width 1s ease;
}

/* Mobile Navigation Bottom */
.mobile-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    height: 72px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -10px 30px rgba(0,0,0,0.05);
    z-index: 1000;
    border-top: 1px solid var(--border);
}

@media (min-width: 769px) {
    .mobile-nav { display: none; }
}

.mobile-nav-item {
    text-decoration: none;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 700;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}

.mobile-nav-item i { 
    font-size: 20px; 
    transition: var(--transition);
}

.mobile-nav-item.active { 
    color: var(--primary); 
}

.mobile-nav-item.active i {
    transform: translateY(-2px);
}

/* Five items (Home, Courses, Notes, To-do, Profile) — slightly tighter */
.mobile-nav--five .mobile-nav-item {
    font-size: 9px;
    gap: 4px;
}
.mobile-nav--five .mobile-nav-item i {
    font-size: 18px;
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.modal.active { display: flex; }

.modal-content {
    background: white;
    width: 100%;
    max-width: 500px;
    border-radius: 28px;
    padding: 32px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: modalSlide 0.3s ease-out;
    max-height: 90vh;
    overflow-y: auto;
}

@media (max-width: 640px) {
    .modal { padding: 10px; }
    .modal-content {
        padding: 24px;
        border-radius: 24px;
        max-height: 95vh;
    }
}

@keyframes modalSlide {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.d-none { display: none !important; }
.d-lg-none { display: block; }
.d-lg-flex { display: none; }

@media (min-width: 1025px) {
    .d-lg-none { display: none !important; }
    .d-lg-flex { display: flex !important; }
}

/* Admin Specific Styles */
.admin-layout { 
    display: flex; 
    min-height: 100vh; 
    background: #f8fafc;
    width: 100%;
}

.admin-sidebar { 
    background: white; 
    border-right: 1px solid var(--border); 
    padding: 40px 24px; 
    position: sticky; 
    top: 0; 
    height: 100vh; 
    display: flex;
    flex-direction: column;
    z-index: 1100;
    width: 280px;
    flex-shrink: 0;
}

@media (max-width: 1400px) {
    .admin-sidebar { width: 240px; padding: 40px 20px; }
}

.details-sidebar, .details-content {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.profile-card, .activity-card, .detail-section-card {
    padding: 32px;
    border-radius: 28px;
}

@media (max-width: 768px) {
    .profile-card, .activity-card, .detail-section-card {
        padding: 24px;
        border-radius: 20px;
    }
    
    .admin-header h1 {
        font-size: 24px;
    }
    
    .admin-header p {
        font-size: 13px;
    }
}

.admin-main { 
    flex-grow: 1;
    min-width: 0; /* Important for flex child to not overflow */
    padding: 40px; 
    background: #f8fafc;
    overflow-x: hidden;
}

@media (max-width: 1400px) {
    .admin-main { padding: 32px; }
}

@media (max-width: 1200px) {
    .admin-main { padding: 24px; }
}

.admin-nav-item { 
    display: flex; 
    align-items: center; 
    gap: 16px; 
    padding: 14px 20px; 
    text-decoration: none; 
    color: var(--text-muted); 
    font-weight: 700; 
    font-size: 14px; 
    border-radius: 16px; 
    transition: var(--transition); 
    margin-bottom: 8px; 
}

.admin-nav-item:hover {
    background: rgba(99, 102, 241, 0.05);
    color: var(--primary);
    transform: translateX(4px);
}

.admin-nav-item.active { 
    background: var(--premium-gradient); 
    color: white; 
    box-shadow: 0 10px 20px -5px rgba(99, 102, 241, 0.3);
}

.admin-nav-item i {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.table-card { 
    background: white; 
    border-radius: 28px; 
    border: 1px solid var(--border); 
    overflow-x: auto; 
    box-shadow: var(--shadow-sm);
    -webkit-overflow-scrolling: touch;
}

.premium-table { 
    width: 100%; 
    border-collapse: collapse; 
    min-width: 600px;
}

@media (min-width: 1200px) {
    .premium-table { min-width: 800px; }
}

.premium-table th { 
    text-align: left; 
    padding: 20px 24px; 
    background: #fcfdfe; 
    font-size: 11px; 
    font-weight: 800; 
    color: var(--text-muted); 
    text-transform: uppercase; 
    letter-spacing: 1.5px; 
    border-bottom: 1px solid var(--border);
}

.premium-table td { 
    padding: 20px 24px; 
    border-bottom: 1px solid #f1f5f9; 
    font-size: 14px; 
    color: var(--text-main); 
}

.premium-table tr:last-child td {
    border-bottom: none;
}

.premium-table tr:hover td {
    background: #fcfdfe;
}

.admin-header {
    margin-bottom: 40px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 20px;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .admin-header { flex-direction: column; align-items: flex-start; }
}

.stat-card {
    background: white;
    padding: 28px;
    border-radius: 28px;
    border: 1px solid var(--border);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 20px;
}

@media (max-width: 1024px) { 
    .admin-layout { display: block; } 
    .admin-sidebar { 
        position: fixed;
        left: -280px;
        top: 0;
        bottom: 0;
        z-index: 2000;
        transition: var(--transition);
        width: 280px;
        box-shadow: 20px 0 40px rgba(0,0,0,0.1);
    } 
    .admin-sidebar.active {
        left: 0;
    }
    .admin-main { padding: 24px; padding-top: 80px; width: 100%; }
    .admin-header { flex-direction: column; align-items: flex-start; gap: 20px; }
}

.admin-mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: white;
    border-bottom: 1px solid var(--border);
    z-index: 1500;
    padding: 0 20px;
    align-items: center;
    justify-content: space-between;
}

@media (max-width: 1024px) {
    .admin-mobile-header { display: flex; }
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    z-index: 1900;
}

.sidebar-overlay.active {
    display: block;
}

.admin-profile-grid {
    display: flex;
    flex-direction: column;
    gap: 32px;
    width: 100%;
}

@media (min-width: 1025px) {
    .admin-profile-grid {
        flex-direction: row;
        align-items: flex-start;
    }
    .details-sidebar {
        width: 320px;
        flex-shrink: 0;
    }
    .details-content {
        flex-grow: 1;
        min-width: 0;
    }
}

@media (min-width: 1025px) and (max-width: 1400px) {
    .details-sidebar {
        width: 280px;
    }
}

.course-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); 
    gap: 32px; 
}

@media (max-width: 640px) {
    .course-grid { grid-template-columns: 1fr; gap: 24px; }
}

/* Utilities */
.text-center { text-align: center; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 24px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 24px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.badge {
    padding: 6px 12px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.badge-primary { background: rgba(99, 102, 241, 0.1); color: var(--primary); }
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-main); }
::-webkit-scrollbar-thumb { 
    background: var(--border); 
    border-radius: 10px;
    border: 2px solid var(--bg-main);
}
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
