:root {
    --bg-main: #0f172a;
    --bg-card: #1e293b;
    --bg-card-hover: #24344d;
    --bg-input: #0f172a;
    --border-color: #334155;
    --border-focus: #3b82f6;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --accent: #10b981;
    --danger: #ef4444;
    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 6px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}


body {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

/* NAVBAR */
.navbar {
    background-color: rgba(30, 41, 59, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 50;
    padding: 14px 0;
}

.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.logo-dot {
    color: var(--primary);
}

.nav-badges {
    display: flex;
    gap: 10px;
    align-items: center;
}

.badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(51, 65, 85, 0.7);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.badge-security {
    border-color: rgba(16, 185, 129, 0.4);
    color: #34d399;
}

/* HERO */
.hero-section {
    text-align: center;
    padding: 48px 20px 28px;
}

.hero-title {
    font-size: clamp(1.8rem, 4vw, 2.75rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 14px;
    background: linear-gradient(135deg, #ffffff 40%, #94a3b8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-title .hero-brand-doc {
    color: #ffffff;
    -webkit-text-fill-color: #ffffff;
}

.hero-title .hero-brand-ready {
    color: #22c55e;
    -webkit-text-fill-color: #22c55e;
}

.hero-subtitle {
    font-size: clamp(0.95rem, 1.8vw, 1.15rem);
    color: var(--text-secondary);
    max-width: 680px;
    margin: 0 auto;
}

/* APP CONTAINER */
.app-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 24px;
    margin-top: 10px;
    margin-bottom: 40px;
}

/* TABS */
.tabs-nav {
    /* 7 tabs: a fixed grid left one orphan on a second row. Flex with equal
       growth fits 4+3 on desktop and wraps cleanly at any width. */
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 24px;
    background: rgba(15, 23, 42, 0.6);
    padding: 6px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.tab-btn {
    min-width: 0;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    background: var(--primary);
    color: #ffffff;
    box-shadow: var(--shadow-sm);
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
    animation: fadeIn 0.25s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* DROP ZONE */
.drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 36px 20px;
    text-align: center;
    background: rgba(15, 23, 42, 0.4);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    margin-bottom: 24px;
}

.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--primary);
    background: rgba(59, 130, 246, 0.06);
}

.drop-icon {
    font-size: 2.8rem;
    margin-bottom: 12px;
}

.drop-text {
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.drop-browse {
    color: var(--primary);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.drop-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.file-selected-info {
    margin-top: 14px;
    display: inline-block;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: #34d399;
    font-size: 0.9rem;
    font-weight: 600;
}

/* OPTIONS GRID */
.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.option-card {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border-color);
    padding: 14px 16px;
    border-radius: var(--radius-md);
}

.option-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 10px 12px;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s ease;
}

.form-control:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.field-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 6px;
}

/* SUBMIT */
.submit-wrap {
    text-align: center;
}

/* INLINE INPUT (value + unit) */
.inline-input {
    display: flex;
    gap: 8px;
}

.inline-input .form-control:first-child {
    flex: 1 1 auto;
    min-width: 0;
}

.inline-input select.form-control {
    flex: 0 0 88px;
    width: 88px;
}

/* MERGE FILE LIST */
.file-list-wrap {
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: rgba(15, 23, 42, 0.5);
    overflow: hidden;
}

.file-list-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    background: rgba(15, 23, 42, 0.6);
}

.file-list-total {
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
}

.file-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.file-list-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.15s ease, border-color 0.15s ease;
}

.file-list-item:last-child {
    border-bottom: none;
}

.file-list-item.dragging {
    opacity: 0.4;
}

.file-list-item.drop-target {
    border-top: 2px solid var(--primary);
    background: rgba(59, 130, 246, 0.08);
}

.drag-handle {
    cursor: grab;
    color: var(--text-muted);
    font-size: 0.95rem;
    letter-spacing: -2px;
    flex: 0 0 auto;
    user-select: none;
    touch-action: none;
}

.file-item-index {
    flex: 0 0 24px;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--primary);
    background: rgba(59, 130, 246, 0.12);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    line-height: 24px;
}

.file-item-name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-primary);
    font-size: 0.92rem;
}

.file-item-meta {
    flex: 0 0 auto;
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.file-item-controls {
    flex: 0 0 auto;
    display: flex;
    gap: 4px;
}

.icon-btn {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.9rem;
    line-height: 1;
    transition: all 0.15s ease;
}

.icon-btn:hover {
    border-color: var(--primary);
    color: var(--text-primary);
}

.icon-btn-danger:hover {
    border-color: var(--danger);
    color: #fca5a5;
}

.file-list-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(15, 23, 42, 0.4);
}

.btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-ghost:hover {
    color: var(--text-primary);
    border-color: var(--primary);
    background: rgba(59, 130, 246, 0.06);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 32px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 240px;
}

.btn-primary {
    background: var(--primary);
    color: #ffffff;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:disabled {
    background: var(--border-color);
    color: var(--text-muted);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* SPINNER */
.spinner {
    width: 18px;
    height: 18px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* BANNER */
.status-banner {
    margin-top: 20px;
    padding: 14px 18px;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-banner.error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid var(--danger);
    color: #fca5a5;
}

.status-banner.success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid var(--accent);
    color: #6ee7b7;
}

/* FEATURES SECTION */
.features-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    margin-bottom: 48px;
}

.feature-item {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
}

.feature-icon {
    font-size: 1.8rem;
    margin-bottom: 12px;
}

.feature-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.feature-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* FOOTER */
.footer {
    margin-top: auto;
    border-top: 1px solid var(--border-color);
    background: var(--bg-card);
    padding: 20px 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.footer-content {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

@media (max-width: 640px) {
    .app-container {
        padding: 16px;
    }
    .tabs-nav {
        grid-template-columns: 1fr 1fr;
    }
    .options-grid {
        grid-template-columns: 1fr;
    }
    .btn {
        width: 100%;
    }
    .footer-content {
        flex-direction: column;
        text-align: center;
    }
}

/* PRIVACY PILL & RADIOS */
.privacy-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #34d399;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 9999px;
    margin-bottom: 16px;
}

.privacy-pill-dot {
    width: 8px;
    height: 8px;
    background-color: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 8px #10b981;
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 6px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.radio-label input[type="radio"] {
    accent-color: var(--primary);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.radio-label:hover {
    color: var(--text-primary);
}

.badge-privacy {
    border-color: rgba(59, 130, 246, 0.4);
    color: #60a5fa;
}

#docx-preview-container {
    background: #ffffff;
    color: #000000;
    padding: 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    max-height: 400px;
    overflow-y: auto;
}

/* LOGO MULTICOLOR */
.logo-doc {
    color: #ffffff;
}

.logo-ready {
    color: #22c55e;
}

.logo-zone {
    color: #94a3b8;
}

.logo-icon-svg {
    display: block;
    width: 38px;
    height: 38px;
    flex-shrink: 0;
}

/* DONATE BUTTON & LINKS */
.nav-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
}

.btn-donate {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 0.88rem;
    font-weight: 600;
    color: #ffffff;
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.4);
    border-radius: 9999px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-donate:hover {
    background: #22c55e;
    color: #ffffff;
    border-color: #22c55e;
    box-shadow: 0 0 14px rgba(34, 197, 94, 0.35);
    transform: translateY(-1px);
}

.btn-donate-heart {
    font-size: 0.9rem;
}

.footer-donate-link {
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.2s ease;
}

.footer-donate-link:hover {
    color: #22c55e;
    text-decoration: underline;
}

/* LEGAL PAGES & POLICIES */
.legal-container {
    max-width: 860px;
    margin: 30px auto 60px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 36px 40px;
    box-shadow: var(--shadow-lg);
}

.legal-title {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.legal-date {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 28px;
}

.legal-section {
    margin-bottom: 24px;
}

.legal-section h2 {
    font-size: 1.2rem;
    font-weight: 700;
    color: #3b82f6;
    margin-bottom: 12px;
}

.legal-section p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.65;
    margin-bottom: 10px;
}

.legal-section ul {
    margin-left: 20px;
    margin-bottom: 12px;
}

.legal-section li {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 6px;
}

.legal-section a {
    color: #22c55e;
    text-decoration: underline;
}

.btn-back {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.btn-back:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

/* FOOTER LEGAL LINKS */
.footer-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
}

.footer-legal-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.82rem;
    transition: color 0.2s ease;
}

.footer-legal-link:hover {
    color: #22c55e;
    text-decoration: underline;
}

/* COOKIE BANNER */
.cookie-banner {
    position: fixed;
    bottom: 20px;

    left: 20px;
    right: 20px;
    max-width: 600px;
    margin: 0 auto;
    background: rgba(15, 23, 42, 0.96);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(34, 197, 94, 0.4);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.6);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    z-index: 1000;
    animation: slideUp 0.3s ease-out;
}

.cookie-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

.cookie-text a {
    color: #22c55e;
    text-decoration: underline;
}

.btn-cookie-accept {
    background: #22c55e;
    color: #ffffff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 8px 18px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.btn-cookie-accept:hover {
    background: #16a34a;
}

@keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@media (max-width: 640px) {
    .cookie-banner {
        flex-direction: column;
        align-items: flex-start;
        bottom: 12px;
        left: 12px;
        right: 12px;
    }
    .btn-cookie-accept {
        width: 100%;
    }
    .legal-container {
        padding: 24px 18px;
    }
}

/* FAQ Section */
.btn-faq-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.btn-faq-link:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.faq-section {
    max-width: 860px;
    margin: 56px auto 28px auto;
    padding: 0 16px;
}

.faq-header {
    text-align: center;
    margin-bottom: 32px;
}

.faq-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.faq-subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.faq-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.faq-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all 0.2s ease;
}

.faq-item[open] {
    border-color: rgba(34, 197, 94, 0.4);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.faq-question {
    padding: 16px 20px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    list-style: none;
}

.faq-question::-webkit-details-marker {
    display: none;
}

.faq-question::after {
    content: "+";
    font-size: 1.25rem;
    font-weight: 400;
    color: var(--text-secondary);
    transition: transform 0.2s ease, color 0.2s ease;
    margin-left: 12px;
}

.faq-item[open] .faq-question::after {
    content: "−";
    color: #22c55e;
}

.faq-answer {
    padding: 0 20px 18px 20px;
    font-size: 0.92rem;
    color: var(--text-secondary);
    line-height: 1.6;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    margin-top: 4px;
    padding-top: 12px;
}

.faq-answer p + p {
    margin-top: 8px;
}

.faq-highlight {
    color: #22c55e;
    font-weight: 600;
}

@media (max-width: 640px) {
    .faq-section {
        margin: 40px auto 20px auto;
        padding: 0 12px;
    }
    .faq-title {
        font-size: 1.4rem;
    }
    .faq-question {
        padding: 14px 16px;
        font-size: 0.95rem;
    }
    .faq-answer {
        padding: 0 16px 14px 16px;
        font-size: 0.88rem;
    }
    .btn-faq-link {
        display: none;
    }
}

.submit-wrap-spaced {
    margin-top: 48px !important;
    padding-top: 24px !important;
    border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
}

@media (max-width: 640px) {
    .submit-wrap-spaced {
        margin-top: 36px !important;
        padding-top: 18px !important;
    }
    .file-list-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    .file-list-item {
        flex-wrap: wrap;
    }
    .file-item-name {
        flex: 1 1 calc(100% - 100px);
    }
    .file-item-meta {
        order: 5;
        flex: 1 1 100%;
        padding-left: 58px;
    }
}


/* ---- Interactive PDF pages manager ---- */
.pages-manager {
    margin-top: 24px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: rgba(15, 23, 42, 0.5);
    overflow: hidden;
}

.pages-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 12px 16px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    background: rgba(15, 23, 42, 0.6);
}

.pages-head-actions {
    display: flex;
    gap: 8px;
}

.pages-grid {
    list-style: none;
    margin: 0;
    padding: 16px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 16px;
}

.page-card {
    position: relative;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    padding: 6px;
    cursor: grab;
    transition: border-color 0.15s, transform 0.15s;
}

.page-card:hover {
    border-color: var(--accent);
}

.page-card.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.page-card.drop-target {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.4);
}

.page-thumb {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 4px;
    background: #fff;
    transition: transform 0.15s;
}

.page-card-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 8px;
}

.page-num {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.page-card-controls {
    display: flex;
    gap: 2px;
}

.page-card-controls .icon-btn {
    width: 34px;
    height: 34px;
    font-size: 1.15rem;
    line-height: 1;
}

/* ---- Hover zoom preview ---- */
.page-zoom {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.35);
    padding: 24px;
    pointer-events: none;
    animation: pageZoomIn 0.15s ease-out;
}

.page-zoom-img {
    max-width: 100%;
    max-height: 100%;
    border-radius: var(--radius-md);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
    background: #fff;
}

@keyframes pageZoomIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.pages-actions {
    padding: 0 16px 16px;
}

.pages-actions .btn {
    width: 100%;
}

@media (max-width: 640px) {
    .pages-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 12px;
        padding: 12px;
    }
}

/* ---- SEO tools section ---- */
.seo-tools {
    padding: 48px 0 8px;
}

.seo-tools-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 10px;
}

.seo-tools-subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 32px;
}

.seo-tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.seo-tool-card {
    display: flex;
    flex-direction: column;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s ease, transform 0.2s ease, background-color 0.2s ease;
}

.seo-tool-card:hover {
    border-color: var(--border-focus);
    background-color: var(--bg-card-hover);
    transform: translateY(-2px);
}

.seo-tool-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin-bottom: 14px;
    font-size: 1.35rem;
    line-height: 1;
    border-radius: 12px;
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.25);
}

.seo-tool-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.35;
}

.seo-tool-card p {
    color: var(--text-secondary);
    font-size: 0.92rem;
    line-height: 1.55;
    margin: 0;
}

@media (max-width: 640px) {
    .seo-tools {
        padding: 32px 0 8px;
    }

    .seo-tools-title {
        font-size: 1.35rem;
    }

    .seo-tools-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }
}

/* ---- One-off encrypted file transfer (share) ---- */
.share-result {
    margin-top: 24px;
    padding: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.share-result-title {
    margin: 0 0 14px;
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
}

.share-link-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
    flex-wrap: wrap;
}

.share-link-input {
    flex: 1 1 260px;
    min-width: 0;
    padding: 11px 13px;
    font-size: 13px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    color: var(--text-primary);
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.share-link-input:focus {
    outline: 2px solid #93c5fd;
    border-color: #3b82f6;
}

.share-link-row .btn-secondary,
.share-link-row .btn-danger {
    flex: 0 0 auto;
    min-width: 140px;
    margin-top: 0;
    padding: 11px 18px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s, border-color .15s;
}

.btn-secondary {
    color: #93c5fd;
    background: rgba(59, 130, 246, 0.14);
    border: 1px solid rgba(59, 130, 246, 0.45);
}

.btn-secondary:hover {
    background: rgba(59, 130, 246, 0.24);
    border-color: rgba(59, 130, 246, 0.7);
}

.btn-danger {
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.14);
    border: 1px solid rgba(239, 68, 68, 0.45);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.24);
    border-color: rgba(239, 68, 68, 0.7);
}

#share-revoke {
    margin-top: 14px;
    min-width: 220px;
}

.btn-danger:disabled {
    opacity: .6;
    cursor: wait;
}

.share-qr {
    display: flex;
    justify-content: center;
    margin: 18px 0 4px;
}

.share-qr svg {
    width: 168px;
    height: 168px;
    max-width: 60vw;
    max-height: 60vw;
    background: #fff;
    padding: 8px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

.share-status,
.share-note {
    margin: 12px 0 0;
    font-size: 13px;
    line-height: 1.55;
    color: var(--text-secondary);
}

.share-note {
    color: var(--text-muted);
}

/* The list lives OUTSIDE .share-result so active links are visible before any
   upload in the current session. It therefore needs its own card styling. */
.share-links {
    margin-top: 20px;
    padding: 18px 20px;
    background: var(--bg-card-hover);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.share-links .share-result-title {
    margin-bottom: 8px;
}

.share-links .share-status {
    margin-top: 0;
    margin-bottom: 12px;
}

.share-link-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.share-link-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.share-link-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.share-link-name {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-primary);
    word-break: break-all;
}

.share-link-size,
.share-link-time {
    font-size: 12px;
    color: var(--text-secondary);
}

.share-link-head-name {
    margin: -6px 0 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    word-break: break-all;
}

.share-link-row {
    margin-bottom: 0;
}

/* Download page */
.share-dl-card {
    max-width: 560px;
    margin: 0 auto;
    padding: 28px 24px;
    text-align: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
}

.share-dl-icon {
    font-size: 40px;
    line-height: 1;
    margin-bottom: 14px;
}

.share-dl-meta {
    margin: 0 0 10px;
    font-size: 13px;
    color: var(--text-secondary);
}

.share-dl-status {
    margin: 0 0 18px;
    font-size: 15px;
    line-height: 1.55;
    color: var(--text-primary);
}

.share-dl-status.error {
    color: #fca5a5;
    font-weight: 500;
}

.share-dl-status.ok {
    color: #4ade80;
    font-weight: 500;
}

.share-dl-note {
    margin: 18px 0 0;
    font-size: 12.5px;
    line-height: 1.6;
    color: var(--text-secondary);
    text-align: left;
}

@media (max-width: 480px) {
    .share-link-row { flex-direction: column; }
    .btn-secondary { width: 100%; }
    .share-dl-card { padding: 22px 16px; }
}

/* ---- One-off encrypted file transfer (share) ---- */
.share-result {
    margin-top: 24px;
    padding: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.share-result-title {
    margin: 0 0 14px;
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
}

.share-link-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
    flex-wrap: wrap;
}

.share-link-input {
    flex: 1 1 260px;
    min-width: 0;
    padding: 11px 13px;
    font-size: 13px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    color: var(--text-primary);
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.share-link-input:focus {
    outline: 2px solid #93c5fd;
    border-color: #3b82f6;
}

.share-link-row .btn-secondary,
.share-link-row .btn-danger {
    flex: 0 0 auto;
    min-width: 140px;
    margin-top: 0;
    padding: 11px 18px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s, border-color .15s;
}

.btn-secondary {
    color: #93c5fd;
    background: rgba(59, 130, 246, 0.14);
    border: 1px solid rgba(59, 130, 246, 0.45);
}

.btn-secondary:hover {
    background: rgba(59, 130, 246, 0.24);
    border-color: rgba(59, 130, 246, 0.7);
}

.btn-danger {
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.14);
    border: 1px solid rgba(239, 68, 68, 0.45);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.24);
    border-color: rgba(239, 68, 68, 0.7);
}

#share-revoke {
    margin-top: 14px;
    min-width: 220px;
}

.btn-danger:disabled {
    opacity: .6;
    cursor: wait;
}

.share-qr {
    display: flex;
    justify-content: center;
    margin: 18px 0 4px;
}

.share-qr svg {
    width: 168px;
    height: 168px;
    max-width: 60vw;
    max-height: 60vw;
    background: #fff;
    padding: 8px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

.share-status,
.share-note {
    margin: 12px 0 0;
    font-size: 13px;
    line-height: 1.55;
    color: var(--text-secondary);
}

.share-note {
    color: var(--text-muted);
}

/* Invisible captcha renders into a zero-height holder: the challenge is an
   overlay, so any reserved space here would show as a layout hole. */
/* Widget holder: must have real dimensions or the challenge iframe renders
   0x0 and never displays. Hidden until a captcha is actually required. */
#captcha-share {
    min-height: 80px;
    margin: 12px auto;
    max-width: 420px;
}

/* Highlight flashed after a submit that needs the checkbox, so the widget the
   user is told to tick is visibly pointed at (it can be below the fold). */
#captcha-share.captcha-attention {
    outline: 2px solid #3b82f6;
    outline-offset: 6px;
    border-radius: 8px;
    transition: outline-color .3s;
}

/* The list lives OUTSIDE .share-result so active links are visible before any
   upload in the current session. It therefore needs its own card styling. */
.share-links {
    margin-top: 20px;
    padding: 18px 20px;
    background: var(--bg-card-hover);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.share-links .share-result-title {
    margin-bottom: 8px;
}

.share-links .share-status {
    margin-top: 0;
    margin-bottom: 12px;
}

.share-link-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.share-link-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.share-link-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.share-link-name {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-primary);
    word-break: break-all;
}

.share-link-size,
.share-link-time {
    font-size: 12px;
    color: var(--text-secondary);
}

.share-link-head-name {
    margin: -6px 0 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    word-break: break-all;
}

.share-link-row {
    margin-bottom: 0;
}

/* Download page */
.share-dl-card {
    max-width: 560px;
    margin: 0 auto;
    padding: 28px 24px;
    text-align: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
}

.share-dl-icon {
    font-size: 40px;
    line-height: 1;
    margin-bottom: 14px;
}

.share-dl-meta {
    margin: 0 0 10px;
    font-size: 13px;
    color: var(--text-secondary);
}

.share-dl-status {
    margin: 0 0 18px;
    font-size: 15px;
    line-height: 1.55;
    color: var(--text-primary);
}

.share-dl-status.error {
    color: #fca5a5;
    font-weight: 500;
}

.share-dl-status.ok {
    color: #4ade80;
    font-weight: 500;
}

.share-dl-note {
    margin: 18px 0 0;
    font-size: 12.5px;
    line-height: 1.6;
    color: var(--text-secondary);
    text-align: left;
}

@media (max-width: 480px) {
    .share-link-row { flex-direction: column; }
    .btn-secondary { width: 100%; }
    .share-dl-card { padding: 22px 16px; }
}

/* Captcha block injected into any tool pane when the server demands a token. */
/* The widget iframe inside any captcha block centers horizontally */
.smart-captcha iframe {
    margin: 0 auto;
}


/* Anti-bot dialog for server-side tools. The widget sits in a window over the
   page, the user ticks it and the paused operation continues by itself. There is
   deliberately NO card/background behind the widget - the SmartCaptcha iframe is
   its own visual block. */
.captcha-modal {
    position: fixed;
    inset: 0;
    z-index: 1300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(15, 23, 42, 0.72);
}

.captcha-modal[hidden] {
    display: none;
}

body.captcha-modal-open {
    overflow: hidden;
}

.captcha-modal-dialog {
    width: 100%;
    max-width: 380px;
    box-sizing: border-box;
    padding: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    text-align: center;
}

.captcha-modal-title {
    margin: 0 0 6px;
    font-size: 17px;
    color: var(--text-primary);
}

.captcha-modal-text {
    margin: 0 0 14px;
    font-size: 13px;
    color: var(--text-secondary);
}

.captcha-modal-slot {
    display: flex;
    justify-content: center;
}

.captcha-modal-slot .captcha-slot {
    min-height: 80px;
}

.captcha-modal-slot iframe {
    display: block;
    margin: 0 auto;
}

.captcha-modal-actions {
    margin-top: 14px;
}

.captcha-modal-actions .btn {
    width: 100%;
}

/* QR CODE GENERATOR */
.qr-textarea {
    resize: vertical;
    min-height: 96px;
    font-family: inherit;
    line-height: 1.5;
}

.qr-canvas {
    width: 100%;
    max-width: 320px;
    height: auto;
    background: #fff;
    padding: 8px;
    border-radius: 10px;
    image-rendering: pixelated;
}

.qr-logo-preview-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.qr-logo-preview {
    width: 44px;
    height: 44px;
    object-fit: contain;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 3px;
}

.qr-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 16px;
}

.qr-actions .btn {
    padding: 11px 18px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
}

@media (max-width: 560px) {
    .qr-actions .btn {
        flex: 1 1 100%;
    }
}

/* IMAGE RESIZE & CROP */
.resize-editor {
    margin-bottom: 24px;
}

.resize-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.crop-wrap {
    display: flex;
    justify-content: center;
}

.crop-stage {
    position: relative;
    display: inline-block;
    max-width: 100%;
    line-height: 0;
    border-radius: var(--radius-md);
    overflow: hidden;
    /* Checkerboard: transparent pixels of the source must not look like a
       solid colour - the user needs to see that PNG keeps transparency. */
    background-color: #0b1220;
    background-image:
        linear-gradient(45deg, #1b2740 25%, transparent 25%, transparent 75%, #1b2740 75%),
        linear-gradient(45deg, #1b2740 25%, transparent 25%, transparent 75%, #1b2740 75%);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.crop-stage canvas {
    display: block;
    max-width: 100%;
    max-height: 420px;
    width: auto;
    height: auto;
}

.crop-box {
    position: absolute;
    border: 2px solid var(--primary);
    box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.62);
    cursor: move;
    touch-action: none;
}

.crop-handle {
    position: absolute;
    width: 18px;
    height: 18px;
    background: var(--primary);
    border: 2px solid #fff;
    border-radius: 4px;
    box-shadow: var(--shadow-sm);
}

/* Handles sit INSIDE the crop box and overhang its 2px border on purpose:
   .crop-stage clips its overflow (needed for the dimming box-shadow), so a
   handle straddling the outer edge loses half of its clickable area to the
   clip, and one aligned exactly to the padding edge leaves the corner border
   hit-testing as the crop box itself (drag becomes a clamped move). */
.crop-handle[data-h="nw"] { left: -2px; top: -2px; cursor: nwse-resize; }
.crop-handle[data-h="ne"] { right: -2px; top: -2px; cursor: nesw-resize; }
.crop-handle[data-h="sw"] { left: -2px; bottom: -2px; cursor: nesw-resize; }
.crop-handle[data-h="se"] { right: -2px; bottom: -2px; cursor: nwse-resize; }

.crop-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-align: center;
    margin: 10px 0 20px;
}

.resize-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.resize-check {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.resize-check input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
    flex: 0 0 auto;
}

@media (max-width: 560px) {
    .crop-handle {
        width: 24px;
        height: 24px;
    }

    .crop-stage canvas {
        max-height: 320px;
    }

    .preview-stage canvas {
        max-height: 240px;
    }

    .resize-row {
        flex-direction: column;
        align-items: stretch;
    }

    .resize-row .btn {
        width: 100%;
    }
}

.preview-block {
    margin-bottom: 24px;
}

.preview-head {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 10px;
}

.preview-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.preview-info {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.preview-stage {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: #0b1220;
    background-image:
        linear-gradient(45deg, #1b2740 25%, transparent 25%, transparent 75%, #1b2740 75%),
        linear-gradient(45deg, #1b2740 25%, transparent 25%, transparent 75%, #1b2740 75%);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
}

.preview-stage canvas {
    display: block;
    max-width: 100%;
    max-height: 320px;
    width: auto;
    height: auto;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
}
