* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Georgia', 'Times New Roman', serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
    overflow-x: hidden;
}

.navigation {
    max-width: 900px;
    margin: 0 auto 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 15px 25px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.navigation button {
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.navigation button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.navigation button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

#pageIndicator {
    font-weight: 600;
    color: #667eea;
    font-size: 16px;
}

#exportBtn {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

#exportBtn:hover {
    box-shadow: 0 4px 12px rgba(245, 87, 108, 0.4);
}

.page-container {
    width: 100%;
    max-width: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    flex-direction: column;
}


.page {
    width: 210mm;
    height: 297mm;
    min-height: 297mm;
    max-height: 297mm;
    background: white;
    margin: 20px auto;
    padding: 30px;
    border-radius: 4px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    display: none;
    position: relative;
    animation: fadeIn 0.5s ease;
    overflow: hidden;
}

.page.active {
    display: block;
}

.cover-image-page {
    padding: 0;
    width: 210mm;
    height: 297mm;
    min-height: 297mm;
    overflow: hidden;
}

.cover-full-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    image-rendering: auto;
    image-rendering: -webkit-optimize-contrast;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Modern Academic Border Design - full A4 use */
.page-border {
    border: 3px solid #667eea;
    padding: 35px 45px;
    height: 100%;
    min-height: 0;
    box-sizing: border-box;
    position: relative;
    display: flex;
    flex-direction: column;
    background: linear-gradient(to right, #667eea 0%, #667eea 3px, transparent 3px, transparent calc(100% - 3px), #667eea calc(100% - 3px)),
        linear-gradient(to bottom, #667eea 0%, #667eea 3px, transparent 3px, transparent calc(100% - 3px), #667eea calc(100% - 3px));
}

.page-border::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    bottom: 10px;
    border: 1px solid #a8b3f5;
    pointer-events: none;
}

.page-border::after {
    content: '';
    position: absolute;
    top: 15px;
    left: 15px;
    right: 15px;
    bottom: 15px;
    border: 1px solid #d4dafe;
    pointer-events: none;
}

/* Cover Page Specific Border */
.cover-border {
    border: 4px double #667eea;
    background: linear-gradient(to right, #667eea 0%, #667eea 4px, transparent 4px, transparent calc(100% - 4px), #667eea calc(100% - 4px)),
        linear-gradient(to bottom, #667eea 0%, #667eea 4px, transparent 4px, transparent calc(100% - 4px), #667eea calc(100% - 4px));
}

.cover-border::before {
    border: 2px solid #764ba2;
}

/* Cover Page Styles */
.cover-content {
    text-align: center;
}

.college-logo {
    font-size: 60px;
    margin-bottom: 20px;
}

.college-name {
    font-size: 32px;
    color: #d4af37;
    font-weight: bold;
    margin-bottom: 15px;
    letter-spacing: 2px;
}

.department {
    font-size: 20px;
    color: #667eea;
    margin-bottom: 30px;
    font-weight: 600;
}

.project-label {
    font-size: 18px;
    color: #f5576c;
    margin-bottom: 10px;
    font-weight: 600;
}

.on-label {
    font-size: 16px;
    color: #333;
    margin-bottom: 15px;
}

.project-title {
    font-size: 24px;
    color: #667eea;
    margin-bottom: 25px;
    font-weight: bold;
    line-height: 1.4;
}

.cover-image-container {
    margin: 25px auto;
    max-width: 400px;
}

.cover-image-container img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.submitted-label {
    font-size: 16px;
    color: #d4af37;
    margin: 25px 0 10px;
}

.submitted-college {
    font-size: 20px;
    color: #d4af37;
    margin-bottom: 30px;
    font-weight: bold;
}

.cover-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 40px;
    text-align: left;
}

.submitted-by,
.guide-by {
    flex: 1;
}

.submitted-by p,
.guide-by p {
    margin: 5px 0;
    color: #555;
    font-size: 14px;
}

.guide-by {
    text-align: right;
}

/* Page Title - full A4 */
.page-title {
    text-align: center;
    font-size: 24px;
    margin-bottom: 28px;
    color: #333;
    text-decoration: underline;
    text-underline-offset: 8px;
    font-weight: bold;
    flex-shrink: 0;
}

/* Page Content - letters open, pura page use */
.page-content {
    text-align: justify;
    line-height: 2.2;
    font-size: 16px;
    color: #333;
    flex: 1;
    min-height: 0;
}

.page-content p {
    margin-bottom: 24px;
    text-indent: 50px;
}

/* Contents List - full page */
.contents-list {
    list-style: none;
    padding: 25px 55px;
    font-size: 16px;
    line-height: 2.2;
}

.contents-list li {
    margin-bottom: 18px;
    color: #555;
}

.contents-list li::before {
    content: "• ";
    color: #667eea;
    font-weight: bold;
    font-size: 24px;
    margin-right: 10px;
}

/* References List - full page */
.references-list {
    padding: 25px 45px;
    font-size: 14px;
    line-height: 2;
}

.references-list li {
    margin-bottom: 20px;
    color: #555;
    text-align: justify;
}

/* Signature Section - niche tak, pura page complete */
.signature-section {
    margin-top: auto;
    padding-top: 40px;
    text-align: center;
    font-size: 15px;
    color: #555;
    flex-shrink: 0;
}

.signature-section p {
    margin: 8px 0;
}

/* PDF export: sab pages ek saath dikhao (lag kam) */
body.print-mode .page {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Print Styles - A4 - har page single PDF page par */
@page {
    size: 210mm 297mm;
    margin: 0;
}

@media print {
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    html, body {
        background: white !important;
        padding: 0 !important;
        margin: 0 !important;
        overflow: visible !important;
        width: 210mm !important;
        height: auto !important;
    }

    .navigation {
        display: none !important;
    }

    .page-container {
        width: 210mm !important;
        margin: 0 !important;
        padding: 0 !important;
        display: block !important;
    }

    /* Har page = 1 PDF page, double page nahi */
    .page {
        width: 210mm !important;
        height: 297mm !important;
        min-height: 297mm !important;
        max-height: 297mm !important;
        page-break-after: always !important;
        page-break-before: auto !important;
        break-after: page !important;
        page-break-inside: avoid !important;
        margin: 0 !important;
        padding: 30px !important;
        box-shadow: none !important;
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        overflow: hidden !important;
        position: relative !important;
        box-sizing: border-box !important;
    }

    .page.active {
        display: block !important;
    }

    .page:last-child {
        page-break-after: auto !important;
        break-after: auto !important;
    }

    /* Page border - print me proper render */
    .page-border {
        border: 3px solid #667eea !important;
        padding: 35px 45px !important;
        height: 100% !important;
        min-height: calc(297mm - 60px) !important;
        max-height: calc(297mm - 60px) !important;
        box-sizing: border-box !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: visible !important;
        background: linear-gradient(to right, #667eea 0%, #667eea 3px, transparent 3px, transparent calc(100% - 3px), #667eea calc(100% - 3px)),
            linear-gradient(to bottom, #667eea 0%, #667eea 3px, transparent 3px, transparent calc(100% - 3px), #667eea calc(100% - 3px)) !important;
    }

    .page-title {
        font-size: 24px !important;
        margin-bottom: 28px !important;
        flex-shrink: 0 !important;
    }

    .page-content {
        flex: 1 !important;
        font-size: 16px !important;
        line-height: 2.2 !important;
        overflow: visible !important;
    }

    .page-content p {
        margin-bottom: 24px !important;
        text-indent: 50px !important;
    }

    .signature-section {
        margin-top: auto !important;
        padding-top: 40px !important;
        flex-shrink: 0 !important;
    }

    .contents-list,
    .references-list {
        overflow: visible !important;
    }

    /* Cover page - A4 full fill, no extra border */
    .cover-image-page {
        padding: 0 !important;
        width: 210mm !important;
        height: 297mm !important;
        min-height: 297mm !important;
        overflow: hidden !important;
    }

    .cover-full-image {
        display: block !important;
        width: 100% !important;
        height: 100% !important;
        min-width: 100% !important;
        min-height: 100% !important;
        object-fit: cover !important;
        object-position: center !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
}

/* Responsive - Tablet */
@media (max-width: 768px) {
    body {
        padding: 12px;
    }

    .navigation {
        flex-wrap: wrap;
        gap: 10px;
        padding: 12px 15px;
        justify-content: center;
    }

    .navigation button {
        font-size: 12px;
        padding: 8px 14px;
    }

    #pageIndicator {
        font-size: 14px;
        width: 100%;
        text-align: center;
        order: -1;
    }

    .page {
        width: 100% !important;
        max-width: 100%;
        height: auto !important;
        min-height: auto !important;
        max-height: none !important;
        padding: 20px 15px;
        margin: 15px 0;
    }

    .page-border {
        padding: 20px 18px;
        min-height: auto;
        max-height: none;
    }

    .page-title {
        font-size: 20px;
        margin-bottom: 20px;
    }

    .page-content {
        font-size: 15px;
        line-height: 2;
    }

    .page-content p {
        margin-bottom: 18px;
        text-indent: 35px;
    }

    .contents-list {
        padding: 15px 25px;
        font-size: 14px;
    }

    .contents-list li {
        margin-bottom: 12px;
    }

    .references-list {
        padding: 15px 20px;
        font-size: 13px;
    }

    .references-list li {
        margin-bottom: 14px;
    }

    .signature-section {
        padding-top: 25px;
        font-size: 14px;
    }

    .cover-image-page {
        width: 100% !important;
        height: auto !important;
        min-height: 280px;
    }

    .cover-full-image {
        width: 100%;
        height: auto;
        min-height: 280px;
        object-fit: contain;
    }

    .college-name {
        font-size: 24px;
    }

    .project-title {
        font-size: 18px;
    }

    .cover-footer {
        flex-direction: column;
        gap: 20px;
    }

    .guide-by {
        text-align: left;
    }
}

/* Responsive - Phone */
@media (max-width: 480px) {
    body {
        padding: 8px;
    }

    .navigation {
        flex-direction: column;
        gap: 8px;
        padding: 10px 12px;
    }

    .navigation button {
        width: 100%;
        font-size: 13px;
        padding: 10px 12px;
    }

    #pageIndicator {
        font-size: 13px;
    }

    #exportBtn,
    #downloadProjectBtn {
        width: 100%;
    }

    .page {
        padding: 12px 10px;
        margin: 10px 0;
    }

    .page-border {
        padding: 15px 12px;
    }

    .page-title {
        font-size: 18px;
        margin-bottom: 16px;
    }

    .page-content {
        font-size: 14px;
        line-height: 1.9;
    }

    .page-content p {
        margin-bottom: 14px;
        text-indent: 25px;
    }

    .contents-list {
        padding: 12px 15px;
        font-size: 13px;
    }

    .contents-list li {
        margin-bottom: 10px;
    }

    .references-list {
        padding: 12px 15px;
        font-size: 12px;
    }

    .references-list li {
        margin-bottom: 12px;
    }

    .signature-section {
        padding-top: 20px;
        font-size: 13px;
    }

    .signature-section p {
        margin: 6px 0;
    }
}