﻿:root {
    --bg: #f6f7fb;
    --surface: #ffffff;
    --surface-2: #f9fafc;
    --text: #172033;
    --muted: #667085;
    --border: #e4e7ec;
    --primary: #2563eb;
    --primary-600: #1d4ed8;
    --primary-soft: rgba(37, 99, 235, 0.12);
    --success: #0f9d58;
    --danger: #dc2626;
    --shadow: 0 12px 30px rgba(16, 24, 40, 0.08);
    --radius: 18px;
}

html, body {
    margin: 0;
    padding: 0;
    background: radial-gradient(circle at top, #ffffff 0%, var(--bg) 60%, #eef2ff 100%);
    color: var(--text);
    font-family: Vazirmatn, IRANSans, Tahoma, Arial, sans-serif;
    direction: rtl;
}

.page {
    max-width: 1240px;
    margin: 0 auto;
    padding: 32px 20px 48px;
}

.hero {
    display: grid;
    grid-template-columns: 1.4fr 0.8fr;
    gap: 18px;
    align-items: stretch;
    margin-bottom: 22px;
}

.hero-card,
.panel,
.result-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.hero-card {
    padding: 28px;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--primary);
    background: var(--primary-soft);
    padding: 8px 12px;
    border-radius: 999px;
    margin-bottom: 16px;
}

.title {
    margin: 0 0 10px;
    font-size: clamp(28px, 3vw, 40px);
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.subtitle {
    margin: 0;
    color: var(--muted);
    line-height: 1.9;
    max-width: 820px;
    font-size: 15px;
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 22px;
}

.stat {
    padding: 16px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 14px;
}

    .stat strong {
        display: block;
        font-size: 18px;
        margin-bottom: 4px;
    }

    .stat span {
        color: var(--muted);
        font-size: 13px;
        line-height: 1.7;
    }

.side-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 24px;
    gap: 12px;
}

    .side-card h3 {
        margin: 0;
        font-size: 18px;
    }

    .side-card p {
        margin: 0;
        color: var(--muted);
        line-height: 1.9;
        font-size: 14px;
    }

.alert-box {
    margin: 18px 0 0;
    padding: 18px 20px;
    border-radius: 16px;
    border: 1px solid rgba(37, 99, 235, 0.18);
    background: #eff6ff;
    color: #0f172a;
}

    .alert-box pre {
        margin: 0;
        white-space: pre-wrap;
        word-break: break-word;
        font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
        font-size: 13px;
        line-height: 1.8;
    }

.layout {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 18px;
    margin-top: 18px;
    align-items: start;
}

.panel {
    padding: 22px;
}

    .panel h2,
    .panel h3,
    .panel h4 {
        margin: 0 0 10px;
    }

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

    .section-title h3 {
        font-size: 18px;
    }

    .section-title p {
        margin: 0;
        color: var(--muted);
        font-size: 13px;
    }

.field {
    display: grid;
    gap: 8px;
    margin-bottom: 16px;
}

    .field label {
        font-size: 14px;
        font-weight: 700;
        color: #1f2937;
    }

    .field small {
        color: var(--muted);
        font-size: 12px;
        line-height: 1.8;
    }

.file-input {
    position: relative;
    display: block;
    border: 1.5px dashed #cfd6e4;
    border-radius: 16px;
    background: #fbfcff;
    padding: 18px;
    cursor: pointer;
    transition: 0.2s ease;
}

    .file-input:hover {
        border-color: var(--primary);
        background: #f8fbff;
    }

    .file-input input[type="file"] {
        width: 100%;
        border: 0;
        padding: 0;
        background: transparent;
        cursor: pointer;
        color: var(--muted);
        font-size: 14px;
    }

.note {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px 16px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.9;
}

.tiles-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.tile-card {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: #fff;
    transition: 0.22s ease;
    box-shadow: 0 6px 18px rgba(16, 24, 40, 0.05);
}

    .tile-card:hover {
        transform: translateY(-2px);
        border-color: rgba(37, 99, 235, 0.35);
        box-shadow: 0 12px 24px rgba(16, 24, 40, 0.09);
    }

    .tile-card.is-selected {
        border-color: var(--primary);
        box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14), 0 12px 24px rgba(16, 24, 40, 0.09);
    }

.tile-image-wrap {
    aspect-ratio: 4 / 3;
    background: linear-gradient(135deg, #eef2ff, #f8fafc);
    overflow: hidden;
}

    .tile-image-wrap img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }

.tile-body {
    padding: 14px;
    display: grid;
    gap: 10px;
}

.tile-name {
    font-size: 14px;
    line-height: 1.8;
    font-weight: 700;
    margin: 0;
}

.tile-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.tile-status {
    font-size: 12px;
    color: var(--muted);
}

.select-btn {
    border: 0;
    background: var(--primary);
    color: #fff;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s ease;
}

    .select-btn:hover {
        background: var(--primary-600);
    }

    .select-btn.is-selected {
        background: var(--success);
    }

.selected-summary {
    margin-top: 14px;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid #dbeafe;
    background: #eff6ff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

    .selected-summary strong {
        display: block;
        margin-bottom: 4px;
    }

    .selected-summary span {
        color: var(--muted);
        font-size: 13px;
        word-break: break-word;
    }

.submit-row {
    margin-top: 18px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

.submit-btn {
    border: 0;
    background: linear-gradient(135deg, var(--primary), #4f46e5);
    color: #fff;
    padding: 14px 20px;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    min-width: 180px;
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.24);
    transition: 0.2s ease;
}

    .submit-btn:hover {
        transform: translateY(-1px);
        box-shadow: 0 14px 28px rgba(37, 99, 235, 0.28);
    }

    .submit-btn:active {
        transform: translateY(0);
    }

.validation {
    margin-bottom: 14px;
    color: var(--danger);
    font-size: 13px;
    line-height: 1.8;
}

.results {
    margin-top: 22px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.result-card {
    overflow: hidden;
}

    .result-card header {
        padding: 14px 16px;
        border-bottom: 1px solid var(--border);
        background: #fbfcfe;
        font-weight: 700;
        font-size: 14px;
    }

    .result-card .image-box {
        aspect-ratio: 4 / 3;
        background: #f8fafc;
    }

    .result-card img {
        width: 100%;
        height: 100%;
        object-fit: contain;
        display: block;
        background: #fff;
    }

.empty-state {
    margin-top: 16px;
    border: 1px dashed #d1d5db;
    border-radius: 16px;
    background: #fafafa;
    padding: 18px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.9;
    text-align: center;
}

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}

    .loading-overlay.is-visible {
        display: flex;
    }

.loading-card {
    width: min(92vw, 420px);
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(16, 24, 40, 0.16);
    padding: 28px 24px;
    text-align: center;
}

.loading-spinner {
    width: 54px;
    height: 54px;
    margin: 0 auto 18px;
    border-radius: 50%;
    border: 4px solid #dbeafe;
    border-top-color: var(--primary);
    animation: spin 0.9s linear infinite;
}

.loading-title {
    margin: 0 0 8px;
    font-size: 18px;
    font-weight: 800;
    color: var(--text);
}

.loading-text {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.9;
}

.submit-btn.is-loading {
    opacity: 0.75;
    cursor: wait;
    pointer-events: none;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}



@media (max-width: 980px) {
    .hero,
    .layout,
    .results {
        grid-template-columns: 1fr;
    }

    .tiles-grid {
        grid-template-columns: 1fr;
    }

    .stats {
        grid-template-columns: 1fr;
    }
}
