@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --primary: #0f172a; 
    --primary-hover: #1e293b; 
    --accent: #2563eb;
    --accent-light: #eff6ff;
    --bg-color: #f8fafc; 
    --card-bg: #ffffff; 
    --text-main: #0f172a;
    --text-muted: #64748b; 
    --border: #e2e8f0; 
    --input-bg: #f8fafc; 
    --error-bg: #fef2f2;
    --error-border: #ef4444;
    --error-text: #991b1b;
    --radius: 16px; 
    --transition: all 0.2s ease;
}

body {
    font-family: 'Inter', sans-serif; 
    background-color: var(--bg-color);
    color: var(--text-main); 
    margin: 0; 
    padding: 0; 
    min-height: 100vh;
    padding-bottom: 80px; /* Space for mobile bottom nav */
}

/* ================= DESKTOP TOP NAVBAR ================= */
.navbar {
    position: sticky;
    top: 0;
    z-index: 500;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
    padding: 15px 20px;
}

.nav-container {
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--primary);
    font-weight: 700;
    font-size: 18px;
    transition: opacity 0.2s ease;
}
.nav-logo:hover { opacity: 0.8; }
.nav-logo img { width: auto; height: 35px; object-fit: contain; }

.nav-links {
    list-style: none;
    display: flex;
    gap: 10px;
    margin: 0;
    padding: 0;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.2s ease;
}
.nav-links a:hover { color: var(--primary); background: var(--input-bg); }
.nav-links a.active { color: var(--accent); background: var(--accent-light); }
.nav-links i { font-size: 18px; }

/* ================= MOBILE BOTTOM NAVBAR ================= */
.mobile-bottom-nav {
    display: none; 
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
    z-index: 1000;
    padding: 8px 0;
    padding-bottom: env(safe-area-inset-bottom, 8px); 
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-muted);
    gap: 4px;
    transition: color 0.2s ease;
}
.nav-item i { font-size: 24px; }
.nav-item span { font-size: 11px; font-weight: 600; }
.nav-item.active { color: var(--accent); }

/* ================= MAIN BOX LAYOUT & HERO ================= */
.main-wrapper { padding: 40px 20px; display: flex; justify-content: center; }

.app-container {
    width: 100%; 
    max-width: 1000px; 
    box-sizing: border-box;
    scroll-margin-top: 100px;
}

/* Modern Two-Column Hero Section */
.hero-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 40px;
    margin-bottom: 50px;
    padding: 40px;
    background: linear-gradient(135deg, #ffffff 0%, #eff6ff 100%);
    border-radius: 24px;
    border: 1px solid rgba(226, 232, 240, 0.8);
    box-shadow: 0 10px 30px -10px rgba(37, 99, 235, 0.1);
}

.hero-content {
    flex: 1;
    text-align: left;
    max-width: 500px;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: white;
    color: var(--accent);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.hero-content h1 { 
    margin: 0; 
    font-size: 42px; 
    font-weight: 800; 
    color: var(--primary); 
    letter-spacing: -1px; 
    line-height: 1.1;
}

.hero-content p { 
    margin: 16px 0 30px 0; 
    color: var(--text-muted); 
    font-size: 16px; 
    line-height: 1.6; 
}

.hero-cta-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--primary);
    color: white;
    padding: 14px 24px;
    border-radius: 10px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.hero-cta-btn:hover {
    background: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.hero-image {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.hero-image img {
    width: 100%;
    max-width: 550px;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 20px 30px rgba(0, 0, 0, 0.1));
    animation: float 6s ease-in-out infinite;
}

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


/* Desktop Grid Layout for the Form */
#docForm { display: grid; gap: 24px; }

.form-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02), 0 1px 3px rgba(0, 0, 0, 0.02);
    border: 1px solid var(--border);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    height: 100%; 
    box-sizing: border-box;
}
.form-card:hover { box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05); transform: translateY(-2px); }

.form-section-title { 
    font-size: 18px; 
    font-weight: 700; 
    color: var(--primary); 
    margin: 0 0 24px 0; 
    display: flex; 
    align-items: center; 
    gap: 12px;
}
.icon-wrapper {
    background: var(--accent-light);
    color: var(--accent);
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

/* Grid breakpoint for Desktop Side-by-Side */
@media (min-width: 850px) {
    #docForm { grid-template-columns: repeat(2, 1fr); align-items: start; }
    .date-card, .action-bar { grid-column: span 2; }
    body { padding-bottom: 0; } 
}

/* ================= FORM INPUTS ================= */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.input-group { display: flex; flex-direction: column; }
.input-group.full-width { grid-column: span 2; }

.input-group label { 
    letter-spacing: 0.03em;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-muted); 
}

.input-group input, .input-group select {
    width: 100%; padding: 14px 16px; border: 1px solid #cbd5e1;
    border-radius: 10px; font-size: 15px; font-family: 'Inter', sans-serif;
    background: var(--input-bg); color: var(--text-main); box-sizing: border-box;
    transition: all 0.2s ease;
}
.input-group input:focus, .input-group select:focus {
    outline: none; border-color: var(--accent); background: #fff; box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    50% { transform: translateX(4px); }
    75% { transform: translateX(-4px); }
}
.error-shake {
    animation: shake 0.4s ease-in-out;
    border-color: var(--error-border) !important;
    background-color: var(--error-bg) !important;
    color: var(--error-text);
}

/* ================= BUTTONS & CALL TO ACTION ================= */
.action-bar { margin-top: 10px; margin-bottom: 20px; }

.btn-preview { 
    width: 100%;
    padding: 20px; 
    border: none; 
    border-radius: 12px; 
    font-size: 17px; 
    font-weight: 600; 
    cursor: pointer; 
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: white;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease;
}
.btn-preview i { font-size: 22px; }
.btn-preview:hover { 
    transform: translateY(-3px); 
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.5); 
}
.btn-preview:active { transform: translateY(0); box-shadow: 0 2px 5px rgba(37, 99, 235, 0.3); }

/* ================= SEO & FAQ ================= */
.seo-faq-section { background: white; padding: 40px; border-radius: var(--radius); border: 1px solid var(--border); margin-top: 40px; box-shadow: 0 4px 6px rgba(0,0,0,0.02); scroll-margin-top: 100px;}
.seo-description { border-left: 4px solid var(--accent); padding-left: 20px; margin-bottom: 40px; background: #f8fafc; padding: 20px; border-radius: 0 12px 12px 0; }
.seo-description h2 { font-size: 18px; color: var(--primary); margin: 0 0 10px 0; font-weight: 700;}
.seo-description p { margin: 0; font-size: 15px; line-height: 1.7; color: #475569; }

.seo-faq-section h3 { font-size: 20px; color: var(--primary); margin: 0 0 25px 0; display: flex; align-items: center; gap: 12px; }

.faq-list { display: flex; flex-direction: column; gap: 25px; }
.faq-item h4 { margin: 0 0 8px 0; font-size: 16px; color: #1e293b; font-weight: 600; }
.faq-item p { margin: 0; font-size: 14px; color: var(--text-muted); line-height: 1.6; }

.developer-credit {
    margin-top: 60px; padding-top: 30px; border-top: 1px dashed var(--border);
    text-align: center; font-size: 14px; color: var(--text-muted); line-height: 1.8;
}
.developer-credit p { margin: 4px 0; }
.developer-credit a { color: var(--accent); text-decoration: none; font-weight: 600; transition: color 0.2s ease; }
.developer-credit a:hover { color: var(--primary); text-decoration: underline; }


/* ================= RESPONSIVE DESIGN FOR MOBILE FIXES ================= */
@media (max-width: 849px) {
    .main-wrapper { padding: 15px; }
    .form-grid { grid-template-columns: 1fr; gap: 16px; } 
    .input-group.full-width { grid-column: span 1; }
    
    .nav-links { display: none; } 
    .mobile-bottom-nav { display: flex; }
    .navbar { padding: 15px; border-bottom: none; }
    
    .hero-section {
        flex-direction: column;
        text-align: center;
        padding: 30px 20px;
        gap: 20px;
    }
    .hero-content {
        text-align: center;
        max-width: 100%;
    }
    .hero-content h1 { font-size: 32px; }
    .hero-image img {
        max-width: 100%;
        animation: none; 
    }
    
    .form-card { padding: 25px 20px; margin-bottom: 20px; border-radius: 12px;} 
    
    .seo-faq-section { padding: 25px 20px; }
    .preview-header { padding: 15px 20px; flex-direction: column; gap: 15px; }
    .preview-actions { width: 100%; justify-content: space-between; }
}


/* ================= Preview Modal ================= */
.preview-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.95); backdrop-filter: blur(8px);
    z-index: 2000; display: none; flex-direction: column;
}
.preview-header { padding: 20px 40px; display: flex; justify-content: space-between; align-items: center; background: var(--primary); border-bottom: 1px solid rgba(255,255,255,0.1); }
.preview-title { color: white; font-weight: 600; font-size: 16px; margin: 0; }
.preview-actions { display: flex; gap: 15px; }

.btn-close, .btn-download {
    padding: 12px 24px; border: none; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; transition: all 0.2s ease;
}
.btn-close { background: transparent; color: white; border: 1px solid rgba(255,255,255,0.3); }
.btn-close:hover { background: rgba(255,255,255,0.1); transform: translateY(-1px); }
.btn-download { background: #10b981; color: white; display: flex; align-items: center; gap: 8px; }
.btn-download:hover { background: #059669; transform: translateY(-1px); box-shadow: 0 4px 10px rgba(0,0,0,0.2); }

.preview-body { flex: 1; overflow-y: auto; padding: 40px 20px; display: flex; justify-content: center; align-items: flex-start; }
#loader { display: none; margin-left: 4px; font-size: 14px; animation: spin 1s linear infinite; }

@keyframes spin { 
    0% { transform: rotate(0deg); } 
    100% { transform: rotate(360deg); } 
}


/* ================= STRICT PIXEL-PERFECT A4 PAGE (UNTOUCHED) ================= */
.a4-wrapper { transform-origin: top center; box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5); background: white; }
.a4-page { width: 794px; height: 1123px; max-height: 1123px; box-sizing: border-box; padding: 96px; position: relative; font-family: 'Times New Roman', Times, serif; color: #000; background-color: white; overflow: hidden; }
.watermark { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 70%; opacity: 0.15; z-index: 1; pointer-events: none; }
.content-wrapper { position: relative; width: 100%; height: 100%; z-index: 2; display: flex; flex-direction: column; }
h1.dept-name { font-weight: bold; text-align: center; margin: 0 0 15px 0; white-space: nowrap; }
h2.varsity-name { font-size: 22px; font-weight: bold; text-align: center; margin: 0 0 5px 0; white-space: nowrap; }
h3.address-name { font-size: 16px; font-weight: bold; text-align: center; margin: 0 0 20px 0; white-space: nowrap; }
.uniform-text { font-size: 16px; }
p.semester-info { text-align: center; margin: 0 0 30px 0; white-space: nowrap; }
.badge-container { text-align: center; margin-bottom: 35px; }
.badge { display: inline-block; background-color: #d0e7f9; border: 2px solid #5a9bd4; border-radius: 6px; padding: 6px 35px; font-size: 22px; font-weight: bold; text-transform: uppercase; }
.course-info { display: grid; grid-template-columns: 155px 20px auto; row-gap: 12px; width: 100%; font-weight: bold; }
.topic-value { color: #3b78d8; }
table { width: 100%; border-collapse: collapse; table-layout: fixed; }
th, td { border: 1px solid black; padding: 12px; vertical-align: top; word-wrap: break-word; }
th { font-weight: bold; text-align: center; }
.table-1 p { margin: 0 0 10px 0; }
.table-1 .label { font-weight: bold; }
.bottom-wrapper { margin-top: auto; width: 100%; }
.table-2 th, .table-2 td { text-align: center; vertical-align: middle; height: 40px; }
.comment-title { font-weight: bold; margin: 20px 0 5px 0; display: none; }
.comment-box { width: 100%; height: 90px; border: 1px solid black; box-sizing: border-box; display: none; }
.assignment-layout .course-info { margin-bottom: 50px; }
.assignment-layout .table-1 { margin-bottom: 20px; }
.assignment-layout .table-1 td { height: 210px; }
.lab-layout .course-info { margin-bottom: 25px; }
.lab-layout .table-1 { margin-bottom: 20px; }
.lab-layout .table-1 td { height: 140px; } 

/* ================= FULLSCREEN DOWNLOAD OVERLAY ================= */
.download-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(15, 23, 42, 0.95); backdrop-filter: blur(8px); z-index: 9999; display: none; flex-direction: column; justify-content: center; align-items: center; color: white; user-select: none; }
.spinner-container { text-align: center; }
.modern-spinner { width: 50px; height: 50px; border: 4px solid rgba(255, 255, 255, 0.2); border-top-color: #3b82f6; border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto 20px auto; }
.spinner-container p { font-size: 18px; font-weight: 600; margin: 0 0 8px 0; }
.spinner-container .sub-text { font-size: 13px; color: #94a3b8; }





/* ================= IN-APP BROWSER WARNING ================= */
.in-app-warning {
    background-color: var(--error-border);
    color: white;
    padding: 15px 20px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 9999;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}
.in-app-warning span {
    font-weight: 400;
    font-size: 13px;
    opacity: 0.95;
}
