/* =========================================================================
   Free Tools -- Shared styles for /tools/* pages.
   Global (non-isolated) so multiple Razor pages can reference these classes.
   Referenced from FreeToolLayout.razor <HeadContent>.
   ========================================================================= */

/* -- Sections -- */

.aitool-hero {
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
    padding: 4rem 1.5rem 3rem;
    text-align: center;
}

.aitool-hero__title {
    font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 800;
    color: #f1f5f9;
    margin: 0 0 0.75rem;
    letter-spacing: -0.025em;
    line-height: 1.15;
}

.aitool-hero__sub {
    font-size: clamp(0.95rem, 1.5vw, 1.125rem);
    color: #94a3b8;
    max-width: 640px;
    margin: 0 auto;
    line-height: 1.65;
}

.aitool-main {
    background: #0f172a;
    padding: 2rem 1.5rem 4rem;
    min-height: 50vh;
}

.aitool-container {
    max-width: 820px;
    margin: 0 auto;
}

/* -- Panels (shared card style) -- */

.aitool-panel {
    background: linear-gradient(145deg, #1e293b 0%, #1a2332 100%);
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: 16px;
    padding: 2.5rem 2rem;
}

.aitool-panel--cta {
    text-align: center;
}

.aitool-panel--error {
    text-align: center;
    color: #f87171;
}

/* -- CTA (out of credits) -- */

.aitool-cta__icon {
    width: 48px;
    height: 48px;
    color: #94a3b8;
    margin: 0 auto 1rem;
    display: block;
}

.aitool-cta__heading {
    font-size: 1.375rem;
    font-weight: 700;
    color: #f1f5f9;
    margin: 0 0 0.5rem;
}

.aitool-cta__text {
    color: #94a3b8;
    line-height: 1.6;
    margin: 0 0 1.75rem;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
}

.aitool-cta__actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* -- Buttons -- */

.aitool-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.7rem 1.75rem;
    border-radius: 10px;
    font-size: 0.925rem;
    font-weight: 600;
    font-family: inherit;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all 0.15s ease;
    line-height: 1;
}

.aitool-btn--primary {
    background: linear-gradient(135deg, #4f46e5, #6366f1);
    color: #fff;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}

.aitool-btn--primary:hover {
    background: linear-gradient(135deg, #4338ca, #4f46e5);
    box-shadow: 0 4px 16px rgba(79, 70, 229, 0.4);
    transform: translateY(-1px);
}

.aitool-btn--ghost {
    background: transparent;
    color: #94a3b8;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.aitool-btn--ghost:hover {
    color: #e2e8f0;
    border-color: rgba(148, 163, 184, 0.4);
    background: rgba(148, 163, 184, 0.06);
}

/* -- Upload zone -- */

.aitool-upload {
    padding: 0;
    overflow: hidden;
}

.aitool-upload__zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 260px;
    padding: 3rem 2rem;
    border: 2px dashed rgba(99, 102, 241, 0.25);
    border-radius: 16px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    text-align: center;
}

.aitool-upload__zone:hover {
    border-color: rgba(99, 102, 241, 0.5);
    background: rgba(99, 102, 241, 0.04);
}

.aitool-upload__icon {
    width: 48px;
    height: 48px;
    color: #6366f1;
    margin-bottom: 1rem;
}

.aitool-upload__label {
    font-size: 1.1rem;
    font-weight: 600;
    color: #e2e8f0;
    margin-bottom: 0.35rem;
}

.aitool-upload__hint {
    font-size: 0.85rem;
    color: #64748b;
}

/* -- Feature cards below upload -- */

.aitool-features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-top: 1.75rem;
}

.aitool-feature {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(148, 163, 184, 0.08);
    border-radius: 12px;
    padding: 1.25rem;
}

.aitool-feature h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: #e2e8f0;
    margin: 0 0 0.35rem;
}

.aitool-feature p {
    font-size: 0.8rem;
    color: #64748b;
    line-height: 1.5;
    margin: 0;
}

/* -- Processing state -- */

.aitool-processing {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    text-align: center;
    padding: 3.5rem 2rem;
}

.aitool-processing__text {
    color: #e2e8f0;
    font-size: 1.05rem;
    font-weight: 500;
    margin: 0;
}

.aitool-processing__hint {
    color: #64748b;
    font-size: 0.85rem;
    margin: 0;
}

/* -- Verdict banner -- */

.aitool-verdict {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    border-radius: 14px;
    margin-bottom: 1.25rem;
}

.aitool-verdict__badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    flex-shrink: 0;
}

.aitool-verdict--authentic {
    background: rgba(34, 197, 94, 0.08);
    border: 1px solid rgba(34, 197, 94, 0.2);
    color: #4ade80;
}
.aitool-verdict--authentic .aitool-verdict__badge { background: rgba(34, 197, 94, 0.15); }

.aitool-verdict--synthetic {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #f87171;
}
.aitool-verdict--synthetic .aitool-verdict__badge { background: rgba(239, 68, 68, 0.15); }

.aitool-verdict--manipulated {
    background: rgba(249, 115, 22, 0.08);
    border: 1px solid rgba(249, 115, 22, 0.2);
    color: #fb923c;
}
.aitool-verdict--manipulated .aitool-verdict__badge { background: rgba(249, 115, 22, 0.15); }

.aitool-verdict--inconclusive {
    background: rgba(148, 163, 184, 0.08);
    border: 1px solid rgba(148, 163, 184, 0.15);
    color: #94a3b8;
}
.aitool-verdict--inconclusive .aitool-verdict__badge { background: rgba(148, 163, 184, 0.1); }

.aitool-verdict__label {
    display: block;
    font-size: 1.2rem;
    font-weight: 700;
}

.aitool-verdict__conf {
    display: block;
    font-size: 0.8rem;
    font-weight: 400;
    opacity: 0.65;
    margin-top: 0.15rem;
}

/* -- Split layout: sticky image left, scrollable details right -- */

.aitool-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: start;
}

.aitool-split__image {
    position: sticky;
    top: 4.5rem;
    background: #0c1222;
    border: 1px solid rgba(148, 163, 184, 0.08);
    border-radius: 14px;
    padding: 0.5rem;
}

.aitool-split__details {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-height: 0;
}

/* Image with bbox overlays */

.aitool-image__frame {
    position: relative;
    width: 100%;
}

.aitool-image__img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 10px;
}

.aitool-image__bbox {
    position: absolute;
    border: 2px solid;
    border-radius: 3px;
    pointer-events: none;
    transition: opacity 0.15s;
}

.aitool-image__bbox-label {
    position: absolute;
    top: -1px;
    left: -1px;
    font-size: 0.65rem;
    font-weight: 700;
    color: #fff;
    padding: 1px 4px;
    border-radius: 0 0 4px 0;
    line-height: 1.2;
}

/* Tamper heatmap: dark dim layer sits between image and heatmap */
.aitool-image__dim {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    border-radius: 10px;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 1;
}

/* Tamper heatmap overlay -- renders above the dim layer */
.aitool-image__heatmap {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 10px;
    pointer-events: none;
    z-index: 2;
    transition: opacity 0.2s;
}

/* -- Detail cards -- */

.aitool-detail {
    background: linear-gradient(145deg, #1e293b 0%, #1a2332 100%);
    border: 1px solid rgba(148, 163, 184, 0.08);
    border-radius: 12px;
    padding: 1rem 1.25rem;
}

.aitool-detail__header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: #e2e8f0;
    margin-bottom: 0.75rem;
}

.aitool-detail__row {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.4rem 0;
    flex-wrap: wrap;
}

.aitool-detail__row + .aitool-detail__row {
    border-top: 1px solid rgba(148, 163, 184, 0.06);
}

.aitool-detail__row--hoverable {
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.12s;
    margin: 0 -0.35rem;
    padding-left: 0.35rem;
    padding-right: 0.35rem;
}

.aitool-detail__row--hoverable:hover {
    background: rgba(99, 102, 241, 0.08);
}

.aitool-detail__row--flagged {
    background: rgba(239, 68, 68, 0.05);
    margin: 0 -0.5rem;
    padding: 0.5rem;
    border-radius: 8px;
}

.aitool-detail__sub {
    margin-top: 0.25rem;
    padding-left: 0.5rem;
    border-left: 2px solid rgba(99, 102, 241, 0.15);
}

.aitool-detail__show-all {
    margin-left: auto;
    background: none;
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: #818cf8;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.15rem 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.12s, color 0.12s;
}

.aitool-detail__show-all:hover {
    background: rgba(99, 102, 241, 0.12);
    color: #a5b4fc;
}

.aitool-detail__name {
    font-size: 0.85rem;
    font-weight: 500;
    color: #cbd5e1;
    min-width: 64px;
    flex-shrink: 0;
}

.aitool-detail__bar {
    flex: 1;
    min-width: 80px;
}

.aitool-detail__value {
    font-size: 0.85rem;
    font-weight: 700;
    color: #e2e8f0;
    min-width: 40px;
    text-align: right;
    flex-shrink: 0;
}

.aitool-detail__muted {
    font-size: 0.8rem;
    color: #64748b;
}

.aitool-detail__chip {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
}

.aitool-detail__chip--danger {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

/* Force MudBlazor checkbox/radio labels to be visible on dark backgrounds */
.aitool-detail .mud-input-control-input-container .mud-typography,
.aitool-detail label.mud-checkbox .mud-typography {
    color: #cbd5e1 !important;
}

/* -- Provenance signals -- */

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

.aitool-signals li {
    padding: 0.3rem 0;
    font-size: 0.875rem;
    color: #cbd5e1;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.aitool-signals li::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #f59e0b;
    flex-shrink: 0;
}

/* -- Actions bar -- */

.aitool-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}

/* -- Tooltip width cap -- */

.aitool-tooltip {
    max-width: 420px !important;
}

/* -- Responsive -- */

@media (max-width: 900px) {
    .aitool-split {
        grid-template-columns: 1fr;
    }

    .aitool-split__image {
        position: sticky;
        top: 4.5rem;
        z-index: 10;
    }

    .aitool-image__frame {
        width: fit-content;
        margin: 0 auto;
    }

    .aitool-image__img {
        max-height: 40vh;
        width: auto;
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    .aitool-hero { padding: 2.5rem 1rem 2rem; }
    .aitool-main { padding: 1.5rem 1rem 3rem; }
    .aitool-features { grid-template-columns: 1fr; }
    .aitool-panel { padding: 1.75rem 1.25rem; }
}

@media (max-width: 480px) {
    .aitool-upload__zone { min-height: 200px; padding: 2rem 1rem; }
}
