/* Reset and Base Styles */
* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
    -webkit-tap-highlight-color: transparent; /* Remove blue highlights on click */
}

html {
    scroll-behavior: smooth;
}

body { 
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
    margin: 0; 
    padding: 0; 
    background: #f8f9fa; 
    line-height: 1.6; 
    color: #333;
}

/* Compact Header Styles */
header { 
    background: linear-gradient(135deg, #1a73e8, #0d47a1); 
    color: white; 
    padding: 0.75rem 1rem; 
    text-align: center; 
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: all 0.3s ease;
}

header.compact {
    padding: 0.5rem 1rem;
}

header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

header.compact h1 {
    font-size: 1.25rem;
    margin-bottom: 0;
}

header p {
    font-size: 0.9rem;
    opacity: 0.9;
    transition: all 0.3s ease;
    max-height: 100px;
    overflow: hidden;
}

header.compact p {
    max-height: 0;
    opacity: 0;
}

/* Navigation Styles */
nav { 
    background: white; 
    padding: 0.75rem 1rem; 
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    border-bottom: 1px solid #e0e0e0;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.logo {
    font-weight: 700;
    font-size: 1.25rem;
    color: #1a73e8;
    text-decoration: none;
}

.search-container {
    flex: 1;
    max-width: 500px;
    position: relative;
}

.search-container input { 
    padding: 0.6rem 1rem; 
    width: 100%; 
    border: 1px solid #e0e0e0; 
    border-radius: 8px; 
    font-size: 0.9rem;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.search-container input:focus {
    outline: none;
    border-color: #1a73e8;
    box-shadow: 0 1px 5px rgba(26, 115, 232, 0.2);
}

/* Main Container */
.container { 
    max-width: 1200px; 
    margin: 0 auto; 
    padding: 1.5rem 1rem; 
}

/* Tiles Grid */
.tiles { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); 
    gap: 1.25rem; 
}

.tile { 
    background: white; 
    padding: 1.25rem; 
    border-radius: 10px; 
    box-shadow: 0 3px 10px rgba(0,0,0,0.08); 
    cursor: pointer; 
    transition: all 0.3s ease; 
    text-decoration: none; 
    color: inherit; 
    display: block; 
    border: 1px solid #f0f0f0;
    position: relative;
    overflow: hidden;
    animation: fadeInUp 0.5s ease;
}

.tile::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: #1a73e8;
    transition: width 0.3s ease;
}

.tile:hover { 
    transform: translateY(-3px); 
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.tile:hover::before {
    width: 6px;
}

.tile h3 { 
    margin-top: 0; 
    margin-bottom: 0.5rem;
    color: #1a73e8;
    font-size: 1.1rem;
    font-weight: 600;
}

.tile p {
    color: #555;
    margin-bottom: 0.75rem;
    line-height: 1.5;
    font-size: 0.9rem;
}

.tile small {
    color: #777;
    font-size: 0.8rem;
}

/* Tab Styles - Hidden */
.tab { 
    display: none; 
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Section Buttons Styles */
.section-buttons { 
    display: flex; 
    gap: 0.5rem; 
    margin-bottom: 1.25rem; 
    flex-wrap: wrap; 
    background: white;
    padding: 0.75rem;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.section-btn { 
    padding: 0.6rem 1.25rem; 
    background: #f8f9fa; 
    color: #555; 
    border: 1px solid #e0e0e0; 
    cursor: pointer; 
    border-radius: 6px; 
    flex: 1 1 auto; 
    min-width: 110px; 
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.section-btn:hover {
    background: #e9ecef;
}

/* Markdown Preview Styling */
.preview {
    min-height: 300px;
    animation: fadeIn 0.4s ease;
}

.preview h1, .preview h2, .preview h3, .preview h4 {
    color: #1a73e8;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.preview h1 {
    font-size: 2rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    padding-bottom: 0.5rem;
}

.preview h2 {
    font-size: 1.5rem;
}

.preview h3 {
    font-size: 1.25rem;
}

.preview h4 {
    font-size: 1.125rem;
}

.preview p {
    margin-bottom: 1rem;
    line-height: 1.7;
}

.preview a {
    color: #1a73e8;
    text-decoration: none;
    background: linear-gradient(90deg, transparent, transparent), linear-gradient(90deg, #1a73e8, #0d47a1);
    background-size: 100% 1px, 0 1px;
    background-position: 100% 100%, 0 100%;
    background-repeat: no-repeat;
    transition: background-size 0.3s ease;
}

.preview a:hover {
    background-size: 0 1px, 100% 1px;
}

.preview ul, .preview ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.preview li {
    margin-bottom: 0.5rem;
}

.preview table {
    border-collapse: collapse;
    width: 100%;
    margin: 1.5rem 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.preview th, .preview td {
    border: 1px solid #e0e0e0;
    padding: 12px 16px;
    text-align: left;
}

.preview th {
    background: rgba(26, 115, 232, 0.1);
    color: #1a73e8;
    font-weight: 600;
}

.preview tr:nth-child(even) {
    background: rgba(0, 0, 0, 0.02);
}

.preview blockquote {
    padding: 1rem 1.5rem;
    background: rgba(26, 115, 232, 0.05);
    border-left: 4px solid #1a73e8;
    margin: 1.5rem 0;
    font-style: italic;
    color: #555;
    border-radius: 0 8px 8px 0;
}

.preview pre {
    background: #f8f9fa;
    color: #333;
    padding: 1.5rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1.5rem 0;
    border: 1px solid #e0e0e0;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
}

.preview code {
    background: rgba(26, 115, 232, 0.1);
    color: #1a73e8;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 0.9rem;
}

.preview pre code {
    background: none;
    padding: 0;
    color: inherit;
}

.preview hr {
    border: none;
    height: 1px;
    background: linear-gradient(90deg, transparent, #1a73e8, transparent);
    margin: 2rem 0;
}

/* MCQ Fullscreen Modal Styles */
.section-modal { 
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Modal header button hover effects */
.section-modal button:hover {
    transform: scale(1.05);
}

/* File Viewer Styles */
.file-viewer {
    margin-top: 1.25rem;
}

.file-viewer img, .file-viewer video {
    max-width: 100%;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* PDF Placeholder Styles */
.pdf-placeholder {
    text-align: center;
    padding: 2rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px dashed #e0e0e0;
}

.pdf-preview .pdf-icon {
    margin-bottom: 1rem;
}

.pdf-preview h4 {
    margin-bottom: 0.5rem;
    color: #333;
}

.pdf-preview p {
    margin-bottom: 1.5rem;
    color: #666;
}

.btn {
    display: inline-block;
    padding: 0.6rem 1.25rem;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
}

.btn-primary {
    background: #1a73e8;
    color: white;
}

.btn-primary:hover {
    background: #0d47a1;
}

.btn-secondary {
    background: #f8f9fa;
    color: #333;
    border: 1px solid #e0e0e0;
    margin-left: 0.5rem;
}

.btn-secondary:hover {
    background: #e9ecef;
}

/* Footer Styles */
footer { 
    background: #1a2530; 
    color: white; 
    text-align: center; 
    padding: 1.5rem 1rem; 
    margin-top: 2rem; 
    font-size: 0.9rem;
}

footer p {
    margin: 0;
    opacity: 0.8;
}

/* Breadcrumb */
.breadcrumb {
    margin-bottom: 1.25rem;
    font-size: 0.85rem;
    color: #666;
}

.breadcrumb a {
    color: #1a73e8;
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

/* Panel Styles */
.panel {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid #e0e0e0;
    transition: all 0.3s ease;
}

.panel:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    color: #666;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.badge {
    background: rgba(26, 115, 232, 0.1);
    color: #1a73e8;
    padding: 0.25rem 0.75rem;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Responsive Design */
@media (max-width: 1024px) { 
    .tiles { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); } 
}

@media (max-width: 768px) { 
    .tiles { grid-template-columns: 1fr; } 
    
    .nav-container {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-container {
        max-width: 100%;
    }
    
    .section-buttons { 
        justify-content: center; 
    }
    
    .section-btn { 
        flex: 1 1 45%; 
        margin: 0.25rem; 
    }
    
    header { 
        padding: 0.6rem 1rem; 
    }
    
    header.compact {
        padding: 0.4rem 1rem;
    }
    
    header h1 {
        font-size: 1.3rem;
    }
    
    header.compact h1 {
        font-size: 1.1rem;
    }
    
    .container { 
        padding: 1.25rem 1rem; 
    }
    
    .panel {
        padding: 1.25rem;
    }
}

@media (max-width: 480px) { 
    .section-btn { 
        flex: 1 1 100%; 
    }
    
    header h1 {
        font-size: 1.2rem;
    }
    
    header.compact h1 {
        font-size: 1rem;
    }
    
    .tile {
        padding: 1rem;
    }
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.mt-2 {
    margin-top: 2rem;
}

.mb-2 {
    margin-bottom: 2rem;
}

.no-results {
    text-align: center;
    padding: 2.5rem 1rem;
    color: #666;
}

.no-results h3 {
    margin-bottom: 1rem;
    color: #555;
}

/* Back to top button */
.back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #1a73e8;
    color: white;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(0,0,0,0.15);
    transition: all 0.3s ease;
    opacity: 0;
    visibility: hidden;
    z-index: 99;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: #0d47a1;
    transform: translateY(-3px);
}