/* ================================================================
   RESET & BASE STYLES
   ================================================================ */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f4f6f8;
    color: #333333;
    line-height: 1.6;
    padding: 20px 10px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    background-color: #ffffff;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    flex: 1;
}

/* ================================================================
   TYPOGRAPHY & HEADERS
   ================================================================ */
h1 {
    font-size: 1.75rem;
    text-align: center;
    color: #1a1a1a;
    margin-bottom: 8px;
    line-height: 1.3;
}

.subtitle {
    text-align: center;
    color: #666666;
    margin-bottom: 20px;
    font-size: 0.95rem;
}

h2 {
    font-size: 1.3rem;
    margin-top: 28px;
    margin-bottom: 14px;
    color: #1e293b;
}

h3 {
    font-size: 1.05rem;
    margin-top: 10px;
    margin-bottom: 6px;
    color: #334155;
}

.back-link {
    display: inline-block;
    margin-bottom: 16px;
    color: #4f46e5;
    text-decoration: none;
    font-weight: 500;
}

.back-link:hover {
    text-decoration: underline;
}

/* ================================================================
   LEGAL & CONTENT PAGES (About, Privacy, Terms)
   ================================================================ */
.legal-content {
    line-height: 1.7;
    color: #374151;
}

.legal-content p {
    margin-bottom: 16px;
}

.legal-content h2 {
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 6px;
}

.legal-content a {
    color: #4f46e5;
    text-decoration: none;
}

.legal-content a:hover {
    text-decoration: underline;
}

/* ================================================================
   PRIVACY BADGE
   ================================================================ */
.privacy-badge {
    background-color: #eef2ff;
    border: 1px solid #c7d2fe;
    color: #3730a3;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    text-align: center;
    margin-bottom: 24px;
    font-weight: 500;
}

/* ================================================================
   TABS
   ================================================================ */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 24px;
    border-bottom: 2px solid #e5e7eb;
}

.tab-btn {
    flex: 1;
    padding: 12px 16px;
    font-size: 1rem;
    font-weight: 600;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    color: #4f46e5;
}

.tab-btn.active {
    color: #4f46e5;
    border-bottom-color: #4f46e5;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.tab-description {
    color: #555;
    font-size: 0.95rem;
    margin-bottom: 20px;
}

/* ================================================================
   UPLOAD BOX (DRAG & DROP)
   ================================================================ */
.upload-box {
    border: 2px dashed #cbd5e1;
    border-radius: 10px;
    padding: 30px;
    text-align: center;
    background-color: #f8fafc;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    margin-bottom: 20px;
}

.upload-box:hover, .upload-box.highlight {
    background-color: #f1f5f9;
    border-color: #6366f1;
}

.upload-box input[type="file"] {
    display: none;
}

.upload-button {
    display: inline-block;
    padding: 10px 20px;
    background-color: #4f46e5;
    color: #ffffff;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 12px;
    transition: background-color 0.2s ease;
}

.upload-button:hover {
    background-color: #4338ca;
}

#fileName, #pdfFileName {
    font-weight: 500;
    color: #475569;
}

/* ================================================================
   SETTINGS PANEL
   ================================================================ */
.settings {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
    background-color: #f8fafc;
    padding: 16px;
    border-radius: 8px;
}

.setting {
    display: flex;
    flex-direction: column;
}

.setting label {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: #334155;
}

.setting input[type="range"] {
    width: 100%;
    accent-color: #4f46e5;
    cursor: pointer;
}

.setting select, .setting input[type="text"], .form-input, .form-textarea {
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background-color: #ffffff;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s ease;
}

.setting select:focus, .setting input[type="text"]:focus, .form-input:focus, .form-textarea:focus {
    border-color: #6366f1;
}

/* ================================================================
   BUTTONS & PROGRESS BAR
   ================================================================ */
button#compressBtn, button#pdfConvertBtn, .form-submit-btn {
    width: 100%;
    padding: 14px;
    background-color: #10b981;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.form-submit-btn {
    background-color: #4f46e5;
}

.form-submit-btn:hover {
    background-color: #4338ca;
}

button#compressBtn:hover:not(:disabled), button#pdfConvertBtn:hover:not(:disabled) {
    background-color: #059669;
}

button:disabled {
    background-color: #9ca3af !important;
    cursor: not-allowed;
}

.progress-bar {
    width: 100%;
    height: 10px;
    background-color: #e2e8f0;
    border-radius: 5px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background-color: #4f46e5;
    transition: width 0.2s ease;
}

/* ================================================================
   RESULT SECTION & PDF GRID
   ================================================================ */
#result {
    margin-top: 24px;
    padding: 20px;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    text-align: center;
}

#result-preview-wrapper {
    max-width: 320px;
    width: 100%;
    background: #ffffff;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    display: flex;
    justify-content: center;
    align-items: center;
}

#result img {
    max-width: 100%;
    max-height: 220px;
    object-fit: contain;
    border-radius: 4px;
}

.result-info {
    font-size: 0.95rem;
    font-weight: 600;
    color: #334155;
    background-color: #e2e8f0;
    padding: 6px 14px;
    border-radius: 20px;
}

.download-btn, .download-all-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 24px;
    background-color: #4f46e5;
    color: #ffffff;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    transition: background-color 0.2s ease;
    width: auto;
}

.download-btn:hover, .download-all-btn:hover {
    background-color: #4338ca;
}

.download-all-btn {
    background-color: #0284c7;
}

.download-all-btn:hover {
    background-color: #0369a1;
}

#pdfResult {
    margin-top: 24px;
}

.pdf-results-box {
    width: 100%;
}

.pdf-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
    width: 100%;
    margin-top: 16px;
}

.pdf-grid-item {
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.pdf-grid-item img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    border: 1px solid #cbd5e1;
    margin-bottom: 8px;
}

.page-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 8px;
}

/* ================================================================
   CONTACT FORM & SEO STYLES
   ================================================================ */
.contact-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 20px;
}

.form-textarea {
    resize: vertical;
}

.status-msg {
    margin-top: 10px;
    font-weight: 600;
    text-align: center;
}

.direct-support-title {
    margin-top: 36px;
}

.seo-inline {
    font-size: 0.9rem;
    color: #64748b;
    margin-bottom: 12px;
}

.seo-content {
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid #e2e8f0;
}

.seo-content p {
    margin-bottom: 12px;
    color: #475569;
    font-size: 0.95rem;
}

.seo-list {
    margin-left: 20px;
    margin-bottom: 24px;
    color: #475569;
    font-size: 0.95rem;
}

.seo-list li {
    margin-bottom: 6px;
}

.how-it-works-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 16px;
    margin-bottom: 24px;
}

.step-card {
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
}

.step-number {
    width: 32px;
    height: 32px;
    background-color: #4f46e5;
    color: #ffffff;
    font-weight: 700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px auto;
}

.step-card h3 {
    margin-top: 0;
    font-size: 1rem;
    color: #1e293b;
}

.step-card p {
    font-size: 0.88rem;
    margin-bottom: 0;
}

.faq-item {
    background-color: #f8fafc;
    border-left: 4px solid #4f46e5;
    padding: 12px 16px;
    border-radius: 0 8px 8px 0;
    margin-bottom: 12px;
}

.faq-item h3 {
    font-size: 0.98rem;
    margin-top: 0;
    color: #1e293b;
}

.faq-item p {
    margin-bottom: 0;
    font-size: 0.9rem;
    color: #64748b;
}

/* ================================================================
   COFFEE & FOOTER
   ================================================================ */
.coffee-box {
    margin-top: 30px;
    padding: 20px;
    background-color: #fffbebf5;
    border: 1px solid #fef08a;
    border-radius: 10px;
    text-align: center;
}

.coffee-box p {
    font-weight: 500;
    color: #713f12;
    margin-bottom: 10px;
}

.coffee-btn {
    display: inline-block;
    padding: 8px 16px;
    background-color: #ffdd00;
    color: #000000;
    text-decoration: none;
    font-weight: 700;
    border-radius: 6px;
    transition: transform 0.2s ease;
}

.coffee-btn:hover {
    transform: scale(1.05);
}

footer {
    text-align: center;
    margin-top: 30px;
    padding: 20px 0 10px 0;
    border-top: 1px solid #e2e8f0;
    font-size: 0.85rem;
    color: #64748b;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
}

.footer-links a {
    color: #4f46e5;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.footer-links a:hover {
    color: #4338ca;
    text-decoration: underline;
}

footer p {
    margin: 0;
}

/* ================================================================
   404 ERROR PAGE STYLES
   ================================================================ */
.error-container {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.error-code {
    font-size: 6rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 12px;
    letter-spacing: -2px;
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
}

.error-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 20px;
    margin-bottom: 20px;
    width: 100%;
    max-width: 400px;
}

.error-btn {
    display: inline-block;
    text-decoration: none;
    text-align: center;
    padding: 12px 20px;
}

.error-btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    padding: 12px 20px;
    font-size: 1rem;
}

.error-card-link {
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.error-card-link:hover {
    transform: translateY(-3px);
    border-color: #6366f1;
}

/* ================================================================
   SUPPORT MODAL STYLES
   ================================================================ */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: #ffffff;
    padding: 28px;
    border-radius: 12px;
    max-width: 500px;
    width: 100%;
    position: relative;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.close-modal {
    position: absolute;
    right: 20px;
    top: 16px;
    font-size: 1.8rem;
    font-weight: 700;
    color: #64748b;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s ease;
}

.close-modal:hover {
    color: #0f172a;
}

/* ================================================================
   RESPONSIVE: MOBILE (max-width: 600px)
   ================================================================ */
@media (max-width: 600px) {
    body {
        padding: 10px 6px;
    }

    .container {
        padding: 16px;
    }

    h1 {
        font-size: 1.35rem;
    }

    .settings, .how-it-works-steps {
        grid-template-columns: 1fr;
    }

    .pdf-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    }

    .footer-links {
        flex-direction: column;
        gap: 8px;
    }

    .error-code {
        font-size: 4.5rem;
    }

    .error-actions {
        flex-direction: column;
    }
}

/* ================================================================
   RESPONSIVE: TABLET & DESKTOP (min-width: 768px)
   ================================================================ */
@media (min-width: 768px) {
    body {
        padding: 40px 20px;
    }

    .container {
        padding: 40px;
        max-width: 850px;
    }

    h1 {
        font-size: 2.1rem;
    }

    .upload-box {
        padding: 45px 20px;
    }

    .pdf-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }

    .footer-links {
        flex-direction: row;
        gap: 20px;
    }

    .error-code {
        font-size: 7rem;
    }
}