@import url('https://fonts.googleapis.com/css2?family=Lalezar&family=Vazirmatn:wght@400;500;700&display=swap');

:root {
    --bg: #f5eee4;
    --bg-soft: #efe3d1;
    --ink: #112c2e;
    --ink-soft: #345658;
    --accent: #c15d2f;
    --accent-deep: #8e3f1d;
    --mint: #5f8f86;
    --card: rgba(255, 251, 244, 0.82);
    --line: rgba(17, 44, 46, 0.16);
    --shadow: 0 20px 50px rgba(36, 31, 26, 0.18);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    font-family: 'Vazirmatn', sans-serif;
    color: var(--ink);
    background:
        radial-gradient(1200px 500px at 8% -12%, rgba(193, 93, 47, 0.16), transparent 60%),
        radial-gradient(900px 600px at 95% 3%, rgba(95, 143, 134, 0.2), transparent 58%),
        linear-gradient(150deg, var(--bg), var(--bg-soft));
    overflow-x: hidden;
}

.grain {
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0.22;
    background-image: radial-gradient(circle at 1px 1px, rgba(0, 0, 0, 0.2) 1px, transparent 0);
    background-size: 3px 3px;
    mix-blend-mode: multiply;
}

.shape {
    position: fixed;
    border-radius: 999px;
    filter: blur(18px);
    pointer-events: none;
}

.shape-a {
    width: 260px;
    height: 260px;
    right: -80px;
    top: 24%;
    background: rgba(193, 93, 47, 0.28);
    animation: floatA 9s ease-in-out infinite;
}

.shape-b {
    width: 240px;
    height: 240px;
    left: -60px;
    bottom: -20px;
    background: rgba(95, 143, 134, 0.26);
    animation: floatB 11s ease-in-out infinite;
}

.layout {
    width: min(1140px, calc(100% - 2rem));
    margin: 2rem auto 3rem;
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 1rem;
    position: relative;
    z-index: 1;
}

.card {
    background: var(--card);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    backdrop-filter: blur(6px);
    border-radius: 22px;
    padding: 1.1rem 1.2rem;
}

.intro {
    grid-column: 1 / -1;
    padding: 1.5rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(17, 44, 46, 0.08);
    color: var(--ink-soft);
    border: 1px solid rgba(17, 44, 46, 0.15);
    border-radius: 99px;
    margin: 0;
    padding: 0.2rem 0.75rem;
    font-size: 0.82rem;
}

.intro h1 {
    font-family: 'Lalezar', cursive;
    margin: 0.65rem 0 0.8rem;
    font-size: clamp(1.8rem, 4vw, 2.9rem);
    line-height: 1.28;
    color: var(--ink);
    letter-spacing: 0.3px;
}

.lead {
    margin: 0;
    color: var(--ink-soft);
    line-height: 1.95;
    max-width: 68ch;
}

.search-panel {
    margin-top: 1rem;
    padding: 1rem;
    border: 1px dashed rgba(17, 44, 46, 0.27);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.55);
}

.search-panel label {
    display: block;
    font-size: 0.93rem;
    color: var(--ink-soft);
    margin-bottom: 0.48rem;
}

.search-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.58rem;
}

input[type="text"] {
    width: 100%;
    font: inherit;
    font-size: 1rem;
    padding: 0.76rem 0.85rem;
    border-radius: 12px;
    border: 1px solid rgba(17, 44, 46, 0.28);
    background: #fffdf7;
    color: var(--ink);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type="text"]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(193, 93, 47, 0.16);
}

button {
    border: none;
    font: inherit;
    font-weight: 700;
    padding: 0.74rem 1.05rem;
    border-radius: 12px;
    color: #fff7f2;
    background: linear-gradient(165deg, var(--accent), var(--accent-deep));
    cursor: pointer;
    transition: transform 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease;
    box-shadow: 0 10px 18px rgba(142, 63, 29, 0.25);
}

button:hover:not(:disabled) {
    transform: translateY(-2px);
}

button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

button.alt {
    background: linear-gradient(165deg, var(--mint), #386560);
    box-shadow: 0 10px 18px rgba(56, 101, 96, 0.25);
}

.hint {
    margin: 0.55rem 0 0;
    color: var(--ink-soft);
    font-size: 0.86rem;
}

.status {
    margin-top: 0.9rem;
    padding: 0.68rem 0.8rem;
    border-radius: 11px;
    border: 1px solid rgba(17, 44, 46, 0.15);
    background: rgba(255, 255, 255, 0.65);
    min-height: 45px;
}

.status.error {
    background: rgba(179, 37, 37, 0.08);
    border-color: rgba(179, 37, 37, 0.3);
    color: #7f1616;
}

.status.success {
    background: rgba(35, 125, 90, 0.11);
    border-color: rgba(35, 125, 90, 0.35);
    color: #124f39;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.7rem;
    margin-bottom: 0.82rem;
}

.section-head h2 {
    margin: 0;
    font-size: 1.08rem;
}

.counter {
    font-size: 0.88rem;
    background: rgba(17, 44, 46, 0.1);
    border: 1px solid rgba(17, 44, 46, 0.2);
    border-radius: 999px;
    padding: 0.2rem 0.72rem;
}

.results-list {
    display: grid;
    gap: 0.55rem;
}

.results-list.empty,
.fields-table.empty {
    color: rgba(17, 44, 46, 0.65);
    font-size: 0.95rem;
    padding: 0.5rem 0.2rem;
}

.result-item {
    border: 1px solid rgba(17, 44, 46, 0.2);
    background: rgba(255, 255, 255, 0.78);
    border-radius: 14px;
    padding: 0.72rem;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.result-item:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.result-top {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 0.6rem;
}

.result-title {
    font-weight: 700;
    margin: 0;
    line-height: 1.65;
}

.result-meta {
    margin-top: 0.38rem;
    color: var(--ink-soft);
    font-size: 0.88rem;
}

.small-button {
    font-size: 0.85rem;
    padding: 0.5rem 0.75rem;
    border-radius: 10px;
}

.actions {
    display: flex;
    gap: 0.55rem;
}

.meta {
    margin-bottom: 0.6rem;
    padding: 0.55rem 0.65rem;
    border: 1px solid rgba(17, 44, 46, 0.15);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.63);
    font-size: 0.91rem;
}

.fields-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 12px;
    overflow: hidden;
}

.fields-table th,
.fields-table td {
    border-bottom: 1px solid rgba(17, 44, 46, 0.12);
    padding: 0.55rem;
    vertical-align: top;
    text-align: right;
}

.fields-table th {
    width: 28%;
    color: var(--ink-soft);
    background: rgba(17, 44, 46, 0.05);
}

.ai {
    grid-column: 1 / -1;
}

.provider {
    font-size: 0.85rem;
}

.ai-output {
    margin: 0;
    direction: ltr;
    text-align: left;
    background: #101d1f;
    color: #eff6f5;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 0.8rem;
    font-size: 0.86rem;
    line-height: 1.75;
    max-height: 460px;
    overflow: auto;
}

.muted {
    color: rgba(17, 44, 46, 0.7);
}

.reveal {
    opacity: 0;
    transform: translateY(12px);
    animation: revealUp 0.7s forwards;
}

.reveal:nth-child(2) {
    animation-delay: 0.09s;
}

.reveal:nth-child(3) {
    animation-delay: 0.18s;
}

.reveal:nth-child(4) {
    animation-delay: 0.27s;
}

@keyframes revealUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes floatA {
    0%,
    100% { transform: translateY(0) translateX(0); }
    50% { transform: translateY(-26px) translateX(-10px); }
}

@keyframes floatB {
    0%,
    100% { transform: translateY(0) translateX(0); }
    50% { transform: translateY(20px) translateX(12px); }
}

@media (max-width: 980px) {
    .layout {
        grid-template-columns: 1fr;
    }

    .actions {
        flex-wrap: wrap;
    }
}

@media (max-width: 640px) {
    .search-row {
        grid-template-columns: 1fr;
    }

    .card {
        padding: 0.95rem;
    }

    .intro {
        padding: 1rem;
    }
}
