/* ========================================
   Global Styles and Reset
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Color Palette */
    --primary-color: #2563eb;
    --secondary-color: #7c3aed;
    --accent-color: #f59e0b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    
    /* Neutral Colors */
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --border-color: #e2e8f0;
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-secondary: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-success: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    
    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    
    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(to bottom right, #f0f9ff, #e0e7ff, #fce7f3);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    padding: var(--spacing-md);
}

/* ========================================
   Container
   ======================================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    animation: fadeIn 0.8s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   Header Section
   ======================================== */
.header {
    background: var(--gradient-primary);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
    box-shadow: var(--shadow-xl);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    animation: rotate 20s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.header-content {
    position: relative;
    z-index: 1;
}

.main-title {
    color: white;
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: var(--spacing-sm);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.sub-title {
    color: rgba(255, 255, 255, 0.95);
    font-size: 1.75rem;
    font-weight: 500;
    margin-bottom: var(--spacing-md);
}

.course-info {
    display: flex;
    justify-content: center;
    gap: var(--spacing-md);
    flex-wrap: wrap;
}

.info-badge {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    color: white;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-lg);
    font-size: 1.1rem;
    font-weight: 600;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* ========================================
   Units Container
   ======================================== */
.units-container {
    display: grid;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
}

/* ========================================
   Unit Cards
   ======================================== */
.unit-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    transition: all 0.3s ease;
    border: 2px solid transparent;
    animation: slideIn 0.5s ease-out forwards;
    opacity: 0;
}

@keyframes slideIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.unit-card:nth-child(1) {
    animation-delay: 0.1s;
    transform: translateY(30px);
}

.unit-card:nth-child(2) {
    animation-delay: 0.2s;
    transform: translateY(30px);
}

.unit-card:nth-child(3) {
    animation-delay: 0.3s;
    transform: translateY(30px);
}

.unit-card:nth-child(4) {
    animation-delay: 0.4s;
    transform: translateY(30px);
}

.unit-card:nth-child(5) {
    animation-delay: 0.5s;
    transform: translateY(30px);
}

.unit-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-color);
}

/* Unit Header */
.unit-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: var(--spacing-md);
    color: white;
}

.unit-card[data-unit="6"] .unit-header {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.unit-card[data-unit="7"] .unit-header {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.unit-card[data-unit="8"] .unit-header {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.unit-card[data-unit="9"] .unit-header {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

.unit-card[data-unit="10"] .unit-header {
    background: linear-gradient(135deg, #30cfd0 0%, #330867 100%);
}

.unit-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: var(--spacing-sm);
}

.unit-meta {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}

.meta-badge {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Unit Content */
.unit-content {
    padding: var(--spacing-lg);
}

.topic-list {
    list-style: none;
    padding-left: 0;
}

.topic-list > li {
    padding: var(--spacing-sm) 0;
    padding-left: var(--spacing-md);
    position: relative;
    color: var(--text-primary);
    font-size: 1.05rem;
    line-height: 1.7;
    border-left: 3px solid var(--primary-color);
    margin-bottom: var(--spacing-sm);
    background: linear-gradient(to right, rgba(37, 99, 235, 0.05), transparent);
    border-radius: var(--radius-sm);
    transition: all 0.3s ease;
}

.topic-list > li:hover {
    background: linear-gradient(to right, rgba(37, 99, 235, 0.1), transparent);
    transform: translateX(5px);
}

.topic-list > li::before {
    content: '▸';
    position: absolute;
    left: 0.3rem;
    color: var(--primary-color);
    font-weight: bold;
    font-size: 1.2rem;
}

.sub-list {
    list-style: none;
    margin-top: var(--spacing-sm);
    margin-left: var(--spacing-md);
}

.sub-list li {
    padding: 0.4rem 0;
    padding-left: var(--spacing-md);
    position: relative;
    color: var(--text-secondary);
    font-size: 1rem;
}

.sub-list li::before {
    content: '◦';
    position: absolute;
    left: 0;
    color: var(--accent-color);
    font-weight: bold;
    font-size: 1.5rem;
}

/* ========================================
   Footer Section
   ======================================== */
.footer {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-lg);
    margin-bottom: var(--spacing-lg);
}

.footer-note {
    background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 100%);
    padding: var(--spacing-md);
    border-radius: var(--radius-lg);
    margin-bottom: var(--spacing-md);
    border-left: 4px solid var(--accent-color);
}

.footer-note p {
    color: var(--text-primary);
    font-size: 1.05rem;
    margin: 0;
}

.footer-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);
}

.summary-item {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: var(--spacing-md);
    border-radius: var(--radius-lg);
    text-align: center;
    box-shadow: var(--shadow-md);
    transition: transform 0.3s ease;
}

.summary-item:hover {
    transform: scale(1.05);
}

.summary-label {
    display: block;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.summary-value {
    display: block;
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
}

/* ========================================
   Back to Top Button
   ======================================== */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--gradient-primary);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: var(--shadow-xl);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    transform: translateY(-5px);
    box-shadow: 0 25px 30px -5px rgba(0, 0, 0, 0.2);
}

/* ========================================
   Responsive Design
   ======================================== */
@media (max-width: 768px) {
    body {
        padding: var(--spacing-sm);
    }
    
    .main-title {
        font-size: 2rem;
    }
    
    .sub-title {
        font-size: 1.25rem;
    }
    
    .header {
        padding: var(--spacing-lg);
    }
    
    .course-info {
        flex-direction: column;
    }
    
    .info-badge {
        font-size: 1rem;
    }
    
    .unit-title {
        font-size: 1.25rem;
    }
    
    .topic-list > li {
        font-size: 1rem;
    }
    
    .back-to-top {
        bottom: 1rem;
        right: 1rem;
        width: 45px;
        height: 45px;
        font-size: 1.3rem;
    }
}

@media (max-width: 480px) {
    .main-title {
        font-size: 1.75rem;
    }
    
    .sub-title {
        font-size: 1.1rem;
    }
    
    .info-badge {
        font-size: 0.9rem;
        padding: 0.5rem 0.75rem;
    }
    
    .unit-content {
        padding: var(--spacing-md);
    }
}

/* ========================================
   Print Styles
   ======================================== */
@media print {
    body {
        background: white;
        padding: 0;
    }
    
    .back-to-top {
        display: none;
    }
    
    .unit-card {
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
        margin-bottom: 1rem;
    }
}