/* ==========================================
    MODERN CSE STUDY PORTAL STYLES (Generic Branding)
    ========================================== */

/* CSS Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #ec4899;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --dark: #1e293b;
    --light: #f8fafc;
    --gray: #64748b;
    --white: #ffffff;
    
    --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-2: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-3: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --gradient-4: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    --gradient-5: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

body {
    font-family: 'Poppins', 'Segoe UI', sans-serif;
    line-height: 1.6;
    color: var(--dark);
    background: var(--light);
    overflow-x: hidden;
}

html {
    scroll-behavior: smooth;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ==========================================
   HERO SECTION
   ========================================== */

.hero {
    background: var(--gradient-1);
    min-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    padding: 60px 24px;
}

.hero::before {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    top: -250px;
    right: -250px;
}

.hero::after {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    bottom: -150px;
    left: -150px;
}

.hero-content {
    text-align: center;
    color: white;
    max-width: 800px;
    position: relative;
    z-index: 2;
}

.hero-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 20px;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
}

.hero-title {
    font-size: 4rem;
    font-weight: 700;
    margin-bottom: 16px;
    text-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.hero-subtitle {
    font-size: 1.5rem;
    font-weight: 500;
    margin-bottom: 12px;
    opacity: 0.95;
}

.hero-desc {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 32px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.hero-btn {
    display: inline-block;
    background: white;
    color: var(--primary);
    padding: 16px 40px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
    box-shadow: var(--shadow-lg);
    transition: all 0.3s ease;
}

.hero-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-xl);
}

.hero-decoration {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.floating-card {
    position: absolute;
    font-size: 3rem;
    animation: float 6s ease-in-out infinite;
}

.floating-card:nth-child(1) {
    top: 20%;
    left: 10%;
    animation-delay: 0s;
}

.floating-card:nth-child(2) {
    top: 60%;
    right: 15%;
    animation-delay: 2s;
}

.floating-card:nth-child(3) {
    bottom: 20%;
    left: 20%;
    animation-delay: 4s;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
}

/* ==========================================
   STATS BAR
   ========================================== */

.stats-bar {
    background: white;
    padding: 40px 0;
    box-shadow: var(--shadow);
    margin-bottom: 60px;
}

.stats-bar .container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 40px;
}

.stat-item {
    text-align: center;
}

.stat-number {
    font-size: 3rem;
    font-weight: 700;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    font-size: 1rem;
    color: var(--gray);
    font-weight: 500;
}

/* ==========================================
   MAIN CONTENT
   ========================================== */

.main-content {
    padding: 60px 0;
}

.section-header {
    text-align: center;
    margin-bottom: 60px;
}

.section-header h2 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 12px;
}

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

/* ==========================================
   MODERN SUBJECT CARDS
   ========================================== */

.subjects-grid-modern {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 32px;
    margin-bottom: 60px;
}

.subject-card-modern {
    background: white;
    border-radius: 20px;
    padding: 32px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.subject-card-modern::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: var(--gradient-1);
}

.subject-card-modern.toc-card::before {
    background: var(--gradient-1);
}

.subject-card-modern.ml-card::before {
    background: var(--gradient-2);
}

.subject-card-modern.web-card::before {
    background: var(--gradient-3);
}

.subject-card-modern.cyber-card::before {
    background: var(--gradient-4);
}

.subject-card-modern.se-card::before {
    background: var(--gradient-5);
}

.subject-card-modern:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-xl);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.subject-icon-modern {
    font-size: 3rem;
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 15px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
}

.toc-card .subject-icon-modern {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
}

.ml-card .subject-icon-modern {
    background: linear-gradient(135deg, rgba(240, 147, 251, 0.1) 0%, rgba(245, 87, 108, 0.1) 100%);
}

.web-card .subject-icon-modern {
    background: linear-gradient(135deg, rgba(79, 172, 254, 0.1) 0%, rgba(0, 242, 254, 0.1) 100%);
}

.cyber-card .subject-icon-modern {
    background: linear-gradient(135deg, rgba(67, 233, 123, 0.1) 0%, rgba(56, 249, 215, 0.1) 100%);
}

.se-card .subject-icon-modern {
    background: linear-gradient(135deg, rgba(250, 112, 154, 0.1) 0%, rgba(254, 225, 64, 0.1) 100%);
}

.card-tag {
    background: var(--primary);
    color: white;
    padding: 6px 16px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
}

.subject-card-modern h3 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 12px;
}

.card-description {
    color: var(--gray);
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 20px;
}

.card-topics {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.card-topics span {
    background: var(--light);
    color: var(--dark);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.card-stats {
    display: flex;
    justify-content: space-around;
    padding: 16px 0;
    border-top: 1px solid var(--light);
    border-bottom: 1px solid var(--light);
    margin-bottom: 24px;
}

.card-stats div {
    text-align: center;
    font-size: 0.95rem;
    color: var(--gray);
}

.card-stats strong {
    display: block;
    font-size: 1.3rem;
    color: var(--primary);
    font-weight: 700;
}

.card-btn {
    display: block;
    text-align: center;
    background: var(--gradient-1);
    color: white;
    padding: 14px 24px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.toc-card .card-btn {
    background: var(--gradient-1);
}

.ml-card .card-btn {
    background: var(--gradient-2);
}

.web-card .card-btn {
    background: var(--gradient-3);
}

.cyber-card .card-btn {
    background: var(--gradient-4);
}

.se-card .card-btn {
    background: var(--gradient-5);
}

.card-btn:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-lg);
}

/* ==========================================
   FEATURES SECTION
   ========================================== */

.features-section {
    background: white;
    padding: 80px 0;
    margin-top: 60px;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 32px;
}

.feature-card {
    text-align: center;
    padding: 32px 24px;
}

.feature-icon {
    font-size: 3.5rem;
    margin-bottom: 16px;
}

.feature-card h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 12px;
}

.feature-card p {
    color: var(--gray);
    font-size: 1rem;
}

/* ==========================================
   FOOTER
   ========================================== */

.footer {
    background: var(--dark);
    color: white;
    padding: 60px 0 30px;
    margin-top: 80px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}

.footer-brand h3 {
    font-size: 1.5rem;
    margin-bottom: 12px;
}

.footer-brand p {
    color: rgba(255, 255, 255, 0.7);
}

.footer-links h4 {
    font-size: 1.1rem;
    margin-bottom: 16px;
}

.footer-links a {
    display: block;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    margin-bottom: 8px;
    transition: color 0.3s;
}

.footer-links a:hover {
    color: white;
}

.footer-bottom {
    text-align: center;
    padding-top: 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
}

/* ==========================================
   GLOBAL HEADER (Shared across inner pages)
   ========================================== */
.header {
    background: var(--dark);
    color: white;
    padding: 14px 0;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 999;
}

.header .container,
.header .header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.15rem;
    font-weight: 600;
    margin: 0;
    letter-spacing: .5px;
}

.nav a {
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    margin-left: 18px;
    font-size: .9rem;
    font-weight: 500;
    transition: color .25s ease;
}

.nav a:hover, .nav a:focus {
    color: #fff;
}

@media (max-width: 640px) {
    .header .container { flex-direction: column; gap: 8px; }
    .nav a { margin: 0 10px; }
}

/* ==========================================
   SCROLL TO TOP BUTTON
   ========================================== */

.scroll-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: var(--gradient-1);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: all 0.3s ease;
    z-index: 1000;
}

.scroll-top:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
}

/* ==========================================
   RESPONSIVE DESIGN
   ========================================== */

@media (max-width: 768px) {
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-subtitle {
        font-size: 1.2rem;
    }
    
    .hero-desc {
        font-size: 1rem;
    }
    
    .subjects-grid-modern {
        grid-template-columns: 1fr;
    }
    
    .section-header h2 {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .hero {
        min-height: 70vh;
        padding: 40px 20px;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .container {
        padding: 0 16px;
    }
}

/* ==========================================
   SIDEBAR NAVIGATION (For Unit Pages)
   ========================================== */

.page-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 40px;
    max-width: 1600px;
    margin: 0 auto;
    padding: 40px 24px;
}

.sidebar {
    background: white;
    border-radius: 20px;
    padding: 24px;
    box-shadow: var(--shadow);
    height: fit-content;
    position: sticky;
    top: 20px;
    width: 320px;
    min-width: 320px;
}

.sidebar-header {
    margin-bottom: 24px;
}

.sidebar-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 8px;
}

.sidebar-subtitle {
    font-size: 0.85rem;
    color: var(--gray);
}

.sidebar-nav {
    list-style: none;
}

.sidebar-nav li {
    margin-bottom: 8px;
}

.sidebar-nav a {
    display: block;
    padding: 12px 16px;
    color: var(--dark);
    text-decoration: none;
    border-radius: 10px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.sidebar-nav a:hover {
    background: var(--light);
    color: var(--primary);
}

.sidebar-nav a.active {
    background: var(--gradient-1);
    color: white;
}

.content-area {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: var(--shadow);
    width: 100%;
    min-width: 0; /* Allow content to shrink */
}

.content-header {
    margin-bottom: 40px;
}

.content-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 12px;
}

.content-subtitle {
    font-size: 1.1rem;
    color: var(--gray);
}

.breadcrumb {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 20px;
    font-size: 0.9rem;
    color: var(--gray);
}

.breadcrumb a {
    color: var(--primary);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

/* Topic Sections */
.topic {
    margin-bottom: 50px;
}

.topic h3 {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 3px solid var(--light);
}

.topic h4 {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--primary);
    margin: 24px 0 12px;
}

.topic p {
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--dark);
    margin-bottom: 16px;
}

.topic ul, .topic ol {
    margin: 16px 0 16px 32px;
    line-height: 1.8;
}

.topic li {
    margin-bottom: 8px;
    color: var(--dark);
}

/* Info Boxes */
.info-box {
    padding: 24px;
    border-radius: 12px;
    margin: 24px 0;
    border-left: 4px solid;
}

.info-box.example {
    background: rgba(79, 172, 254, 0.1);
    border-left-color: #4facfe;
}

.info-box.note {
    background: rgba(245, 158, 11, 0.1);
    border-left-color: var(--warning);
}

.info-box.important {
    background: rgba(239, 68, 68, 0.1);
    border-left-color: var(--danger);
}

.info-box h4 {
    margin-top: 0;
    margin-bottom: 12px;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 24px 0;
    box-shadow: var(--shadow-sm);
    border-radius: 12px;
    overflow: hidden;
}

table th {
    background: var(--gradient-1);
    color: white;
    padding: 16px;
    text-align: left;
    font-weight: 600;
}

table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--light);
}

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

table tr:nth-child(even) {
    background: rgba(0, 0, 0, 0.02);
}

/* Code Blocks */
.code-block {
    background: #2d2d2d;
    color: #f8f8f2;
    padding: 24px;
    border-radius: 12px;
    overflow-x: auto;
    margin: 24px 0;
    font-family: 'Courier New', monospace;
    box-shadow: var(--shadow);
}

.code-block pre {
    margin: 0;
}

/* Navigation Buttons */
.nav-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 60px;
    padding-top: 30px;
    border-top: 2px solid var(--light);
}

.nav-btn {
    padding: 14px 28px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-btn.prev {
    background: var(--light);
    color: var(--dark);
}

.nav-btn.next {
    background: var(--gradient-1);
    color: white;
}

.nav-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Unit Cards Grid (for subject home pages) */
.unit-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin: 40px 0;
}

.unit-card {
    background: white;
    border-radius: 16px;
    padding: 28px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    border-top: 4px solid var(--primary);
}

.unit-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.unit-number {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 8px;
}

.unit-card h3 {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 12px;
}

.unit-card p {
    color: var(--gray);
    margin-bottom: 20px;
    line-height: 1.6;
}

.unit-card-btn {
    display: inline-block;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
}

/* Responsive Design for Sidebar */
@media (max-width: 1024px) {
    .page-layout {
        grid-template-columns: 1fr;
        padding: 20px 16px;
    }
    
    .sidebar {
        width: 100%;
        position: static;
    }
    
    .content-area {
        padding: 24px;
    }
}

@media (max-width: 768px) {
    .content-area {
        padding: 20px;
    }
    
    .content-title {
        font-size: 2rem;
    }
}

.unit-card-btn:hover {
    gap: 12px;
}
