/* ═══════════════════════════════════════════════
   NexToolsX · image-to-pdf.css
   Image to PDF Converter — consistent with site theme
   ═══════════════════════════════════════════════ */

/* ── Fallback variables (if tools.css hasn't set them) ── */
:root {
    --radius-md: 16px;
    --radius-sm: 8px;
    --surface-3: #2a2a2e;
}

[data-theme="light"] {
    --surface-3: #dcdce0;
}

/* ── Hero ── */
.pdf-hero {
    min-height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 2.5rem 1rem 4rem;
    position: relative;
}

.hero-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

.glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.15;
}

.glow-1 {
    width: 500px;
    height: 500px;
    background: var(--red);
    top: -100px;
    left: -150px;
}

.glow-2 {
    width: 400px;
    height: 400px;
    background: #ff6b35;
    bottom: 0;
    right: -100px;
    opacity: 0.08;
}

.grid-overlay {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
    background-size: 40px 40px;
}

[data-theme="light"] .grid-overlay {
    background-image:
        linear-gradient(rgba(0, 0, 0, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 0, 0, 0.04) 1px, transparent 1px);
}

.hero-content {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 660px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

/* ── Badge ── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(255, 45, 45, 0.12);
    border: 1px solid rgba(255, 45, 45, 0.3);
    border-radius: var(--radius-pill);
    padding: 0.35rem 1rem;
    font-family: var(--font-display);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--red);
    margin-bottom: 1.25rem;
    text-transform: uppercase;
}

/* ── Hero Title ── */
#hero-title {
    font-family: var(--font-display);
    font-size: clamp(2rem, 7vw, 3.5rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.03em;
    text-align: center;
    margin-bottom: 0.75rem;
    color: var(--text);
}

#hero-title em {
    font-style: normal;
    color: var(--red);
    display: block;
}

.hero-sub {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 2rem;
    max-width: 480px;
    line-height: 1.6;
}

/* ── Upload Area ── */
.upload-area {
    width: 100%;
    min-height: 160px;
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface-2);
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.25rem;
    position: relative;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--red);
    background: var(--surface-3);
    transform: translateY(-2px);
    box-shadow: 0 0 0 4px rgba(255, 45, 45, 0.08);
}

.upload-content {
    text-align: center;
    padding: 2rem 1.5rem;
    pointer-events: none;
}

.upload-icon {
    font-size: 2.8rem;
    margin-bottom: 0.6rem;
    line-height: 1;
}

.upload-text {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.35rem;
}

.upload-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ── Image List ── */
.image-list-section {
    width: 100%;
    display: none;
    flex-direction: column;
    gap: 0.8rem;
    margin-bottom: 1.25rem;
}

.image-list-section.visible {
    display: flex;
}

.image-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0.2rem;
}

.image-list-title {
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.image-count-badge {
    background: var(--red);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.15rem 0.55rem;
    border-radius: var(--radius-pill);
    font-family: var(--font-display);
}

.btn-clear-all {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    padding: 0.3rem 0.75rem;
    font-size: 0.72rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font-body);
}

.btn-clear-all:hover {
    border-color: var(--red);
    color: var(--red);
}

/* ── Image Items (sortable list) ── */
.image-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    list-style: none;
}

.image-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.6rem 0.8rem;
    cursor: grab;
    transition: all var(--transition);
    user-select: none;
    position: relative;
}

.image-item:active {
    cursor: grabbing;
}

.image-item.dragging {
    opacity: 0.4;
    border-style: dashed;
    border-color: var(--red);
}

.image-item.drag-over {
    border-color: var(--red);
    background: var(--surface-3);
    transform: scale(1.01);
}

.drag-handle {
    color: var(--text-faint);
    font-size: 1rem;
    cursor: grab;
    flex-shrink: 0;
    line-height: 1;
    touch-action: none;
}

.item-order {
    font-family: var(--font-display);
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    min-width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.item-thumb {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    background: var(--surface-3);
    flex-shrink: 0;
    border: 1px solid var(--border);
}

.item-info {
    flex: 1;
    min-width: 0;
}

.item-name {
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text);
    margin-bottom: 0.15rem;
}

.item-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.btn-remove-item {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0.2rem;
    border-radius: 50%;
    transition: color var(--transition), background var(--transition);
    flex-shrink: 0;
}

.btn-remove-item:hover {
    color: var(--red);
    background: rgba(255, 45, 45, 0.1);
}

/* ── PDF Controls ── */
.pdf-controls {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    display: none;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.pdf-controls.visible {
    display: flex;
}

.controls-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.control-group label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-family: var(--font-display);
}

.control-group select {
    background: var(--surface-2);
    border: 1px solid var(--border);
    padding: 0.45rem 0.75rem;
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.85rem;
    font-family: var(--font-body);
    min-width: 130px;
    cursor: pointer;
    transition: border-color var(--transition);
}

.control-group select:focus {
    outline: none;
    border-color: var(--red);
}

.margin-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    cursor: pointer;
}

.margin-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--red);
    cursor: pointer;
}

/* ── Action Buttons ── */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
}

.btn-create-pdf {
    width: 100%;
    background: var(--red);
    color: white;
    border: none;
    padding: 0.85rem 1.5rem;
    border-radius: var(--radius-md);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-create-pdf:hover:not(:disabled) {
    background: var(--red-dim);
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(255, 45, 45, 0.3);
}

.btn-create-pdf:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

.btn-download-pdf {
    width: 100%;
    background: var(--green);
    color: white;
    border: none;
    padding: 0.85rem 1.5rem;
    border-radius: var(--radius-md);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: all var(--transition);
    display: none;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-download-pdf.visible {
    display: flex;
}

.btn-download-pdf:hover {
    background: #16a34a;
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(34, 197, 94, 0.25);
}

/* ── Loading Overlay ── */
.loading-overlay {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    margin-bottom: 1rem;
}

.loading-overlay.visible {
    display: flex;
}

.pdf-loader {
    width: 44px;
    height: 44px;
    border: 3px solid var(--surface-3);
    border-top-color: var(--red);
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-text {
    font-size: 0.88rem;
    color: var(--text-muted);
    font-weight: 500;
}

.loading-progress {
    width: 200px;
    height: 4px;
    background: var(--surface-3);
    border-radius: var(--radius-pill);
    overflow: hidden;
}

.loading-progress-bar {
    height: 100%;
    background: var(--red);
    border-radius: var(--radius-pill);
    width: 0%;
    transition: width 0.3s ease;
}

/* ── Success State ── */
.success-info {
    display: none;
    align-items: center;
    gap: 0.75rem;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    width: 100%;
    margin-bottom: 0.75rem;
}

.success-info.visible {
    display: flex;
}

.success-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.success-text {
    font-size: 0.82rem;
    color: var(--green);
    font-weight: 600;
}

/* ── Error Message ── */
.error-msg {
    color: var(--red);
    font-size: 0.8rem;
    margin-top: 0.5rem;
    min-height: 1.2em;
    text-align: center;
    width: 100%;
}

/* ── Add More Button ── */
.btn-add-more {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    width: 100%;
    background: var(--surface-2);
    border: 1.5px dashed var(--border);
    border-radius: var(--radius-md);
    padding: 0.6rem;
    font-size: 0.82rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font-body);
}

.btn-add-more.visible {
    display: flex;
}

.btn-add-more:hover {
    border-color: var(--red);
    color: var(--red);
    background: var(--surface-3);
}

/* ── Info Section (reused from existing) ── */
.info-section {
    width: 100%;
    padding: 4rem 1.5rem;
    background: var(--surface);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.info-inner {
    max-width: 900px;
    margin: 0 auto;
}

.info-inner h2 {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 2rem;
    color: var(--text);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.info-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.25rem 1rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.info-card:hover {
    border-color: var(--red);
    background: var(--surface-3);
    transform: translateY(-3px);
}

.info-icon {
    font-size: 1.75rem;
    line-height: 1;
    margin-bottom: 0.15rem;
}

.info-card h3 {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
    line-height: 1.3;
}

.info-card p {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.5;
}

/* ── FAQ Section ── */
.faq-section {
    padding: 4rem 1.5rem;
}

.faq-inner {
    max-width: 720px;
    margin: 0 auto;
}

.faq-inner h2 {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--text);
}

.faq-item {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 0.6rem;
    overflow: hidden;
    transition: border-color 0.2s ease;
}

.faq-item[open] {
    border-color: var(--red);
}

.faq-item summary {
    padding: 1rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text);
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::after {
    content: '+';
    font-size: 1.2rem;
    font-weight: 400;
    color: var(--red);
    transition: transform 0.2s ease;
    flex-shrink: 0;
    margin-left: 1rem;
}

.faq-item[open] summary::after {
    transform: rotate(45deg);
}

.faq-body {
    padding: 0 1.25rem 1rem;
}

.faq-body p {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin: 0;
}

/* ── Back link ── */
.back-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

.back-link:hover {
    color: var(--text);
    background: var(--surface-2);
}

/* ── Responsive ── */
@media (max-width: 860px) {
    .info-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.85rem;
    }
}

@media (max-width: 600px) {
    .pdf-hero {
        padding: 2rem 0.75rem 3rem;
    }

    .back-link {
        display: none;
    }

    .controls-row {
        flex-direction: column;
        align-items: stretch;
    }

    .control-group select {
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .info-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.7rem;
    }

    .info-section {
        padding: 2.5rem 1rem;
    }

    .info-inner h2,
    .faq-inner h2 {
        font-size: 1.25rem;
    }

    .info-card {
        padding: 1rem 0.75rem;
        border-radius: 12px;
    }

    .info-icon {
        font-size: 1.5rem;
    }

    .info-card h3 {
        font-size: 0.78rem;
    }

    .info-card p {
        font-size: 0.7rem;
    }
}