/* =========================================
   1. GLOBAL RESET & VARIABLES
   ========================================= */
:root {
    --primary-gradient: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
    --primary-solid: #2563eb;       
    --bg-color: #f8fafc;      
    --sidebar-bg: #ffffff;    
    --text-dark: #0f172a;     
    --text-light: #64748b;    
    --white: #ffffff;
    --border: #e2e8f0;
    --success-bg: #dcfce7;
    --success-text: #166534;
    --upload-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

/* Hide Swipe Hint on Desktop */
.mobile-scroll-hint {
    display: none;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-color);
    color: var(--text-dark);
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* =========================================
   2. SIDEBAR STYLES (Desktop - Left Side)
   ========================================= */
.sidebar {
    width: 280px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 24px;
    height: 100vh;
    position: fixed; /* Fixed on Left for PC */
    left: 0;
    top: 0;
    z-index: 50;
    overflow-y: auto;
}

.sidebar-header-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.brand {
    font-size: 1.5rem;
    font-weight: 800;
    background: var(--primary-gradient);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 10px;
}
.brand i { 
    background: var(--primary-gradient);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.mobile-action-btn { display: none; } /* Hidden on PC */

/* Semester Navigation (Desktop) */
.nav-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-light);
    margin-bottom: 12px;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.nav-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.nav-item {
    padding: 12px 16px;
    border-radius: 10px;
    background: transparent;
    border: none;
    color: var(--text-light);
    font-weight: 600;
    font-size: 0.95rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-item:hover {
    background: #f1f5f9;
    color: var(--primary-solid);
    transform: translateX(5px);
}

.nav-item.active {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

/* Bottom Area (Upload + Social) */
.sidebar-bottom {
    margin-top: 30px;
}

.upload-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: var(--white);
    color: #10b981;
    padding: 14px;
    border-radius: 12px;
    border: 2px dashed #10b981;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 25px;
    transition: all 0.2s ease;
}

.upload-btn:hover {
    background: #ecfdf5;
    transform: translateY(-2px);
}

.dev-text {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-bottom: 10px;
    font-weight: 600;
}

.social-links {
    display: flex;
    gap: 15px;
}

.social-links a {
    text-decoration: none;
    color: var(--text-light);
    font-size: 1.2rem;
    transition: color 0.2s;
}

.social-links a:hover {
    color: var(--primary-solid);
}

/* =========================================
   3. MAIN CONTENT AREA
   ========================================= */
.main-content {
    margin-left: 280px; /* Offset for fixed sidebar */
    flex-grow: 1;
    padding: 40px;
    min-height: 100vh;
}

header { margin-bottom: 30px; }
header h1 { font-size: 2rem; font-weight: 800; color: var(--text-dark); }
.breadcrumbs { color: var(--text-light); margin-top: 5px; }

/* Subject Grid */
.subject-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.subject-card {
    background: var(--white);
    padding: 24px;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    gap: 20px;
    position: relative;
    overflow: hidden;
}

.subject-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.subject-card::before {
    content: ''; position: absolute; inset: 0; border-radius: 16px; 
    padding: 2px; background: var(--primary-gradient); 
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0); 
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0); 
    -webkit-mask-composite: xor; mask-composite: exclude; 
    opacity: 0; transition: opacity 0.3s ease;
}
.subject-card:hover::before { opacity: 1; }

.subject-icon {
    font-size: 1.5rem;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    color: var(--primary-solid);
    width: 56px; height: 56px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 14px; flex-shrink: 0;
}

.subject-info h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: 4px; }
.subject-info p { font-size: 0.8rem; color: var(--text-light); }

.elective-badge {
    font-size: 0.7rem; background: var(--success-bg); color: var(--success-text);
    padding: 4px 10px; border-radius: 20px; font-weight: 700; display: inline-block; margin-top: 4px;
}

/* =========================================
   4. MODAL STYLES
   ========================================= */
.modal {
    display: none; position: fixed; z-index: 1000;
    left: 0; top: 0; width: 100%; height: 100%;
    background-color: rgba(15, 23, 42, 0.6); backdrop-filter: blur(5px);
    animation: fadein 0.25s ease-out;
}
.modal-content {
    background-color: var(--white); margin: 5vh auto;
    width: 90%; max-width: 600px; max-height: 90vh;
    border-radius: 20px; display: flex; flex-direction: column;
}
.modal-header {
    padding: 20px 30px; border-bottom: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center;
}
.modal-header h2 { font-size: 1.3rem; background: var(--primary-gradient);background-clip: text; -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.close-btn { font-size: 1.8rem; cursor: pointer; color: #94a3b8; }
.modal-body { padding: 30px; overflow-y: auto; background: #f8fafc; border-radius: 0 0 20px 20px; }

/* Resource List Items */
.resource-category { margin-bottom: 25px; }
.category-title { font-size: 0.75rem; font-weight: 800; color: var(--text-light); margin-bottom: 12px; text-transform: uppercase; }
.resource-grid { display: grid; gap: 10px; }
.resource-item {
    display: flex; align-items: center; gap: 15px;
    background: var(--white); padding: 15px; border-radius: 12px;
    text-decoration: none; border: 1px solid var(--border); transition: all 0.2s;
}
.resource-item:hover { border-color: var(--primary-solid); transform: translateX(4px); }
.resource-icon-box {
    width: 40px; height: 40px; background: #eff6ff; color: var(--primary-solid);
    border-radius: 10px; display: flex; align-items: center; justify-content: center;
}
.resource-name { font-size: 0.95rem; font-weight: 600; color: var(--text-dark); }
.resource-meta { font-size: 0.75rem; color: #94a3b8; }

/* Upload Form */
.form-intro { font-size: 0.9rem; color: #64748b; margin-bottom: 20px; }
.upload-form { display: flex; flex-direction: column; gap: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
label { font-size: 0.85rem; font-weight: 700; color: var(--text-dark); }
input, select { padding: 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 0.95rem; }
.submit-btn {
    background: var(--upload-gradient); color: white; padding: 14px;
    border: none; border-radius: 8px; font-weight: 700; cursor: pointer; font-size: 1rem;
}

/* =========================================
   5. SUCCESS MODAL STYLES (GLOBAL)
   ========================================= */
.success-content {
    display: flex;             /* Added flex to center items */
    flex-direction: column;    /* Stack items vertically */
    justify-content: center;   /* Center vertically */
    align-items: center;       /* Center horizontally */
    text-align: center;
    max-width: 400px; 
    padding: 40px 30px;        /* More padding for better look */
    gap: 15px;                 /* Spacing between elements */
}

.success-icon {
    font-size: 4rem;           /* Made icon slightly larger */
    color: #10b981; 
    margin-bottom: 5px;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.success-content h2 {
    font-size: 1.6rem;
    color: var(--text-dark);
    margin-bottom: 5px;
}

.success-content p {
    color: var(--text-dark);
    font-size: 1rem;
    font-weight: 500;
}

.success-content .sub-text {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 10px;
    font-weight: 400;
}

/* =========================================
   6. MOBILE FOOTER STYLES
   ========================================= */
/* Default: Hide on Desktop */
.mobile-footer { display: none; }

/* =========================================
   7. RESPONSIVE DESIGN (MOBILE)
   ========================================= */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }

    /* Sidebar becomes a standard flow container (Not fixed) */
    .sidebar {
        width: 100%;
        height: auto;
        position: relative; /* Scrolls with page */
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 15px 20px;
        overflow-y: visible;
    }

    .sidebar-header-group {
        margin-bottom: 15px;
    }

    .brand { font-size: 1.3rem; }

    /* Hide Desktop Bottom elements, Mobile has its own setup */
    .sidebar-bottom { display: none; }

    /* Mobile Upload Button */
    .mobile-action-btn {
        display: flex; align-items: center; gap: 8px;
        background: #ecfdf5; color: #059669; border: 1px solid #10b981;
        padding: 8px 16px; border-radius: 50px; 
        font-weight: 700; font-size: 0.85rem; cursor: pointer;
    }

    /* Horizontal Scrolling Semesters */
    .nav-label { display: none; } /* Hide label on mobile to save space */
    
    .nav-links {
        flex-direction: row;
        overflow-x: auto; /* Enable scroll */
        padding-bottom: 5px;
        gap: 10px;
        /* Hide scrollbar */
        scrollbar-width: none; 
        -ms-overflow-style: none;
    }
    .nav-links::-webkit-scrollbar { display: none; }

    .nav-item {
        white-space: nowrap;
        background: var(--white);
        border: 1px solid var(--border);
        border-radius: 20px;
        padding: 8px 16px;
        font-size: 0.85rem;
    }
    
    .nav-item.active {
        box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
    }
    
    .nav-item:hover { transform: none; } /* Disable hover move on touch */

    /* Main Content */
    .main-content {
        margin-left: 0; /* Reset margin */
        padding: 20px;
    }

    header h1 { font-size: 1.5rem; }
    .subject-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }

    /* --- MOBILE FOOTER (STYLED CARD) --- */
    .mobile-footer {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 15px;
        
        /* Card Styling */
        margin-top: 40px;
        padding: 25px;
        background: var(--white);
        border-radius: 20px;
        border: 1px solid var(--border);
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
        text-align: center;
    }

    .mobile-footer .dev-text {
        color: var(--text-dark);
        font-weight: 700;
        font-size: 0.9rem;
        letter-spacing: 0.5px;
    }

    .mobile-footer .social-links {
        display: flex;
        gap: 15px;
        justify-content: center;
    }

    .mobile-footer .social-links a {
        width: 45px;
        height: 45px;
        display: flex;
        align-items: center;
        justify-content: center;
        background-color: #f1f5f9; 
        border-radius: 50%;
        color: var(--text-light);
        font-size: 1.2rem;
        text-decoration: none;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .mobile-footer .social-links a:hover {
        background: var(--primary-gradient);
        color: white;
        transform: translateY(-5px) scale(1.1); 
        box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.4); 
    }

    /* 1. Header Group for the Hint */
    .nav-header-group {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 10px;
        padding: 0 5px;
    }

    /* 2. Hide the Desktop Label, Show the Mobile Hint */
    .nav-label { display: none; } 
    
    .mobile-scroll-hint {
        display: flex; /* This overrides the 'none' from desktop */
        align-items: center;
        gap: 6px;
        font-size: 0.75rem;
        font-weight: 700;
        color: var(--primary-solid);
        background: #eff6ff;
        padding: 4px 10px;
        border-radius: 20px;
        animation: pulse 2s infinite;
        width: fit-content; /* Keeps it small */
    }

    /* 3. Improved Scroll Container */
    .nav-links {
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 10px; /* Space for touch */
        gap: 12px;
        
        /* Ensure the last item isn't flush with the wall */
        padding-right: 20px; 
        
        /* Smooth scrolling physics */
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;

        /* Make scrollbar THIN but VISIBLE (Visual Cue) */
        scrollbar-width: thin;
        scrollbar-color: #cbd5e1 transparent;
    }

    /* Webkit Scrollbar Styling (Chrome/Safari) */
    .nav-links::-webkit-scrollbar {
        height: 4px; /* Visible thin line */
        display: block;
    }
    .nav-links::-webkit-scrollbar-track {
        background: transparent;
    }
    .nav-links::-webkit-scrollbar-thumb {
        background-color: #cbd5e1;
        border-radius: 10px;
    }

    /* 4. Button Tweaks for "Peeking" */
    .nav-item {
        white-space: nowrap;
        background: var(--white);
        border: 1px solid var(--border);
        border-radius: 20px;
        padding: 8px 16px;
        font-size: 0.85rem;
        flex-shrink: 0; /* Prevents squishing, forces scrolling */
    }
}

/* =========================================
   8. ANIMATIONS
   ========================================= */

@keyframes fadein {
    from { opacity: 0; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
}
 
@keyframes pulse {
    0% { transform: translateX(0); opacity: 1; }
    50% { transform: translateX(3px); opacity: 0.7; }
    100% { transform: translateX(0); opacity: 1; }
}

@keyframes popIn {
    0% { transform: scale(0); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}
