/* ============================================
   Tool Page Styles
   ============================================ */

/* --- Tool Hero --- */
.tool-hero {
    padding: 7.5rem 0 2rem;
}

.tool-hero__back {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--c-text-muted);
    margin-bottom: 1.25rem;
    transition: color var(--t-fast);
}

.tool-hero__back:hover {
    color: var(--c-primary-light);
}

.tool-hero__title {
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.15;
    margin-bottom: 0.75rem;
}

.tool-hero__subtitle {
    font-size: 1.05rem;
    color: var(--c-text-muted);
    line-height: 1.6;
    max-width: 520px;
}

/* --- Upload / Drop Zone --- */
.tool-upload {
    padding: 1.5rem 0 4rem;
}

.dropzone {
    border: 2px dashed var(--c-border);
    border-radius: var(--r-xl);
    background: var(--c-surface);
    transition: all var(--t-smooth);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

/* Subtle shimmer overlay on hover */
.dropzone::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg,
            transparent 30%,
            rgba(99, 102, 241, 0.03) 50%,
            transparent 70%);
    background-size: 200% 100%;
    opacity: 0;
    transition: opacity var(--t-normal);
}

.dropzone:hover::before {
    opacity: 1;
    animation: shimmer 2.5s linear infinite;
}

.dropzone:hover {
    border-color: var(--c-primary);
    background: rgba(99, 102, 241, 0.03);
    box-shadow: 0 0 32px rgba(99, 102, 241, 0.08);
}

.dropzone.dragover {
    border-color: var(--c-primary-light);
    background: rgba(99, 102, 241, 0.06);
    transform: scale(1.01);
    box-shadow: 0 0 50px rgba(99, 102, 241, 0.15), inset 0 0 30px rgba(99, 102, 241, 0.04);
}

.dropzone__inner {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3.5rem 2rem;
    text-align: center;
}

.dropzone__icon {
    color: var(--c-text-muted);
    margin-bottom: 1rem;
    opacity: 0.5;
    transition: all var(--t-smooth);
}

.dropzone:hover .dropzone__icon {
    opacity: 0.8;
    color: var(--c-primary-light);
    transform: translateY(-3px);
}

.dropzone.dragover .dropzone__icon {
    color: var(--c-primary-light);
    opacity: 1;
    transform: translateY(-6px) scale(1.1);
}

.dropzone__title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
}

.dropzone__or {
    font-size: 0.82rem;
    color: var(--c-text-muted);
    margin-bottom: 0.8rem;
}

.dropzone__btn {
    cursor: pointer;
    margin-bottom: 0.8rem;
    position: relative;
    z-index: 2;
}

.dropzone__input {
    display: none;
}

.dropzone__hint {
    font-size: 0.78rem;
    color: var(--c-text-muted);
    opacity: 0.6;
}

/* --- PDF Preview Grid --- */
.file-list {
    margin-top: 1.5rem;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--r-lg);
    overflow: hidden;
    animation: fadeInUp 0.35s ease both;
    box-shadow: var(--shadow-card);
}

.file-list__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--c-border);
    background: var(--c-surface);
}

.file-list__title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--c-text);
}

.file-list__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 0.4rem;
    font-size: 0.72rem;
    font-weight: 700;
    background: var(--c-gradient);
    color: #fff;
    border-radius: 999px;
}

.file-list__clear {
    background: none;
    border: none;
    color: var(--c-text-muted);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--t-fast);
    font-family: inherit;
    padding: 0.3rem 0.6rem;
    border-radius: var(--r-md);
}

.file-list__clear:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.06);
}

/* --- Grid --- */
.pdf-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    padding: 1.25rem;
}

/* --- Card --- */
.pdf-card {
    position: relative;
    background: var(--c-surface-2);
    border: 1px solid var(--c-border);
    border-radius: var(--r-lg);
    overflow: hidden;
    cursor: grab;
    transition: all var(--t-normal);
    animation: fadeInUp 0.3s ease both;
}

.pdf-card:hover {
    border-color: var(--c-primary);
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.12);
    transform: translateY(-2px);
}

.pdf-card:active {
    cursor: grabbing;
}

.pdf-card.dragging {
    opacity: 0.35;
    transform: scale(0.95);
    border-color: var(--c-accent);
}

.pdf-card.drag-over {
    border-color: var(--c-primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.3);
    transform: scale(1.02);
}

/* Order badge */
.pdf-card__order {
    position: absolute;
    top: 6px;
    left: 6px;
    z-index: 2;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--c-gradient);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* Thumbnail area */
.pdf-card__thumb {
    width: 100%;
    aspect-ratio: 3 / 4;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--c-surface);
    border-bottom: 1px solid var(--c-border);
    overflow: hidden;
}

.pdf-card__canvas {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

/* Loader */
.pdf-card__loader {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--c-text-muted);
    opacity: 0.5;
}

.pdf-card__loader svg {
    animation: spin 1s linear infinite;
}

/* Remove button */
.pdf-card__remove {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 2;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    transform: scale(0.8);
    transition: all var(--t-fast);
}

.pdf-card:hover .pdf-card__remove {
    opacity: 1;
    transform: scale(1);
}

.pdf-card__remove:hover {
    background: #ef4444;
    transform: scale(1.15) !important;
}

/* File info */
.pdf-card__info {
    padding: 0.55rem 0.65rem;
}

.pdf-card__name {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--c-text);
}

.pdf-card__size {
    display: block;
    font-size: 0.68rem;
    color: var(--c-text-muted);
    margin-top: 0.1rem;
}

/* Drag hint */
.file-list__drag-hint {
    padding: 0.6rem 1.25rem;
    font-size: 0.75rem;
    color: var(--c-text-muted);
    opacity: 0.5;
    text-align: center;
    border-top: 1px solid var(--c-border);
}

/* --- Tool Actions --- */
.tool-actions {
    margin-top: 1.5rem;
    display: flex;
    justify-content: center;
    animation: fadeInUp 0.35s ease both;
}

.tool-actions__submit {
    min-width: 240px;
    padding: 1rem 2.2rem;
    font-size: 1.08rem;
    font-weight: 700;
    border-radius: 0.85rem;
    letter-spacing: 0.01em;
    position: relative;
    overflow: hidden;
}

.tool-actions__submit::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg,
            transparent 30%,
            rgba(255, 255, 255, 0.08) 50%,
            transparent 70%);
    background-size: 200% 100%;
    opacity: 0;
    transition: opacity var(--t-normal);
}

.tool-actions__submit:hover::after {
    opacity: 1;
    animation: shimmer 2s linear infinite;
}

.tool-actions__submit:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 36px rgba(99, 102, 241, 0.45);
}

.tool-actions__submit:active {
    transform: translateY(-1px) scale(1.0);
}

.tool-actions__submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.tool-actions__submit:disabled::after {
    display: none;
}

/* Loading spinner */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.tool-actions__submit .spin {
    animation: spin 0.75s linear infinite;
}

/* --- Privacy Notice --- */
.privacy-notice {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
    padding: 0.6rem 1rem;
    font-size: 0.78rem;
    color: var(--c-text-muted);
    opacity: 0.55;
    background: var(--c-surface-2);
    border-radius: var(--r-md);
    border: 1px solid var(--c-border);
}

.privacy-notice svg {
    flex-shrink: 0;
    opacity: 0.6;
}

/* --- Responsive --- */
@media (max-width: 900px) {
    .pdf-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 640px) {
    .tool-hero {
        padding: 6.5rem 0 1.5rem;
    }

    .dropzone__inner {
        padding: 2.5rem 1.25rem;
    }

    .tool-hero__title {
        font-size: 1.7rem;
    }

    .tool-actions__submit {
        min-width: 100%;
    }

    .pdf-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
        padding: 0.85rem;
    }
}

/* ============================================
   AD SLOTS — AdSense-Ready Placeholders
   ============================================ */
.ad-slot {
    width: 100%;
}

.ad-slot--banner {
    padding: 1rem 0;
}

.ad-slot--inline {
    margin-top: 1.5rem;
}

.ad-slot__inner {
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--c-surface);
    border: 1px dashed var(--c-border);
    border-radius: var(--r-lg);
    overflow: hidden;
}

.ad-slot--banner .ad-slot__inner {
    min-height: 90px;
    max-height: 250px;
}

.ad-slot--inline .ad-slot__inner {
    min-height: 100px;
    max-height: 280px;
}

/* Placeholder label — hidden when real ad is loaded */
.ad-slot__label {
    font-size: 0.68rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--c-text-muted);
    opacity: 0.25;
    user-select: none;
}

/* Auto-hide label once AdSense injects content */
.ad-slot__inner>ins+.ad-slot__label,
.ad-slot__inner>iframe~.ad-slot__label {
    display: none;
}

@media (max-width: 640px) {
    .ad-slot--banner .ad-slot__inner {
        min-height: 60px;
    }

    .ad-slot--inline .ad-slot__inner {
        min-height: 80px;
    }
}