/* ===== RESET ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #8B5CF6;
    --primary-l: #A78BFA;
    --primary-d: #7C3AED;
    --accent: #C084FC;
    --bg: #07060b;
    --surface: rgba(139, 92, 246, 0.06);
    --border: rgba(139, 92, 246, 0.12);
    --text-1: #F5F3FF;
    --text-2: rgba(245, 243, 255, 0.55);
    --text-3: rgba(245, 243, 255, 0.3);
    --green: #34D399;
    --red: #F87171;
    --radius: 20px;
    --glass: blur(24px) saturate(1.8);
}

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
    font-family: 'Vazirmatn', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text-1);
    min-height: 100dvh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(139, 92, 246, 0.35); }

/* ===== BACKGROUND ===== */
.bg-mesh {
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 20% 10%, rgba(139, 92, 246, 0.12) 0%, transparent 60%),
        radial-gradient(ellipse 60% 80% at 85% 90%, rgba(192, 132, 252, 0.08) 0%, transparent 60%),
        radial-gradient(circle at 50% 50%, rgba(124, 58, 237, 0.04) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.bg-particles {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.bg-particles .dot {
    position: absolute;
    border-radius: 50%;
    background: rgba(167, 139, 250, 0.4);
    will-change: transform, opacity;
    animation: dotFloat var(--dur) var(--delay) ease-in-out infinite alternate;
}

@keyframes dotFloat {
    0%   { transform: translate(0, 0) scale(1); opacity: 0.15; }
    100% { transform: translate(var(--tx), var(--ty)) scale(var(--sc)); opacity: 0.6; }
}

.bg-glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(100px);
    pointer-events: none;
    z-index: 0;
    will-change: transform;
}

.bg-glow-1 {
    width: 350px; height: 350px;
    background: rgba(139, 92, 246, 0.13);
    top: -120px; right: -80px;
    animation: glowDrift 10s ease-in-out infinite alternate;
}

.bg-glow-2 {
    width: 280px; height: 280px;
    background: rgba(192, 132, 252, 0.09);
    bottom: -100px; left: -60px;
    animation: glowDrift 14s 2s ease-in-out infinite alternate-reverse;
}

.bg-glow-3 {
    width: 200px; height: 200px;
    background: rgba(124, 58, 237, 0.1);
    top: 45%; left: 50%;
    animation: glowDrift 12s 4s ease-in-out infinite alternate;
}

@keyframes glowDrift {
    0%   { transform: translate(0, 0) scale(1); }
    100% { transform: translate(30px, -25px) scale(1.15); }
}

/* ===== LAYOUT ===== */
.container {
    position: relative;
    z-index: 1;
    max-width: 460px;
    margin: 0 auto;
    padding: 24px 18px 50px;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 22px;
}

/* ===== HEADER ===== */
.header {
    text-align: center;
    padding-top: 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}

.logo-container {
    position: relative;
    width: 82px;
    height: 82px;
}

.logo-pulse {
    position: absolute;
    inset: -8px;
    border-radius: 28px;
    border: 2px solid rgba(139, 92, 246, 0.2);
    animation: logoPulse 3s ease-in-out infinite;
}

.logo-pulse-2 {
    animation-delay: 1.5s;
    border-color: rgba(192, 132, 252, 0.15);
}

@keyframes logoPulse {
    0%, 100% { transform: scale(1); opacity: 0; }
    50%      { transform: scale(1.25); opacity: 1; }
}

.logo {
    width: 82px;
    height: 82px;
    border-radius: 26px;
    background: linear-gradient(145deg, var(--primary), #9333EA, var(--accent));
    background-size: 200% 200%;
    animation: logoGradient 6s ease infinite, logoBob 5s ease-in-out infinite;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    color: #fff;
    box-shadow:
        0 6px 40px rgba(139, 92, 246, 0.35),
        0 0 80px rgba(139, 92, 246, 0.08),
        inset 0 1px 0 rgba(255,255,255,0.18);
    position: relative;
    z-index: 1;
}

@keyframes logoGradient {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes logoBob {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-6px); }
}

.header-text { display: flex; flex-direction: column; gap: 4px; }

.title {
    font-size: 34px;
    font-weight: 900;
    letter-spacing: 3px;
    color: var(--text-1);
}

.title-accent {
    background: linear-gradient(135deg, var(--primary-l), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 12px;
    color: var(--text-3);
    font-weight: 300;
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* ===== GLASS CARD ===== */
.glass-card {
    width: 100%;
    border-radius: var(--radius);
    padding: 26px 22px;
    position: relative;
    overflow: hidden;
    background: linear-gradient(165deg,
        rgba(139, 92, 246, 0.07) 0%,
        rgba(20, 16, 36, 0.6) 40%,
        rgba(139, 92, 246, 0.04) 100%);
    border: 1px solid var(--border);
    backdrop-filter: var(--glass);
    -webkit-backdrop-filter: var(--glass);
    box-shadow:
        0 8px 40px rgba(0,0,0,0.35),
        inset 0 1px 0 rgba(255,255,255,0.04),
        inset 0 0 0 0.5px rgba(139, 92, 246, 0.08);
    transition: transform 0.35s cubic-bezier(.4,0,.2,1),
                box-shadow 0.35s ease,
                border-color 0.35s ease;
}

.glass-card:hover {
    border-color: rgba(139, 92, 246, 0.22);
    box-shadow:
        0 14px 50px rgba(0,0,0,0.45),
        0 0 50px rgba(139, 92, 246, 0.06),
        inset 0 1px 0 rgba(255,255,255,0.06);
}

.card-glow {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(from 0deg,
        transparent,
        rgba(139, 92, 246, 0.03),
        transparent,
        rgba(192, 132, 252, 0.02),
        transparent);
    animation: cardGlowSpin 20s linear infinite;
    pointer-events: none;
}

@keyframes cardGlowSpin {
    to { transform: rotate(360deg); }
}

/* ===== INPUTS ===== */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 22px;
}

.input-box {
    display: flex;
    align-items: center;
    background: rgba(139, 92, 246, 0.05);
    border: 1px solid rgba(139, 92, 246, 0.08);
    border-radius: 14px;
    position: relative;
    overflow: hidden;
    transition: all 0.35s ease;
}

.input-box:focus-within {
    border-color: var(--primary);
    background: rgba(139, 92, 246, 0.09);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.06), 0 0 24px rgba(139, 92, 246, 0.08);
}

.input-icon-wrap {
    width: 50px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: var(--primary-l);
    opacity: 0.45;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.input-box:focus-within .input-icon-wrap {
    opacity: 1;
    color: var(--accent);
    transform: scale(1.12);
}

.input-box input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-1);
    font-family: inherit;
    font-size: 15px;
    font-weight: 400;
    padding: 15px 14px 15px 0;
}

.input-box input::placeholder {
    color: var(--text-3);
    font-weight: 300;
    font-size: 13px;
}

.input-focus-line {
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 2px;
    transition: all 0.4s cubic-bezier(.4,0,.2,1);
    transform: translateX(-50%);
}

.input-box:focus-within .input-focus-line {
    width: 100%;
}

/* ===== SEARCH BUTTON ===== */
.btn-search {
    width: 100%;
    height: 54px;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    font-family: inherit;
    transition: transform 0.25s ease, box-shadow 0.35s ease;
    background: transparent;
    -webkit-tap-highlight-color: transparent;
}

.btn-bg-animate {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--primary-d), var(--primary), #9333EA, var(--accent));
    background-size: 300% 300%;
    animation: btnGradient 5s ease infinite;
    border-radius: 14px;
}

@keyframes btnGradient {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.btn-content {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    height: 100%;
}

.btn-icon {
    font-size: 16px;
    transition: transform 0.3s ease;
}

.btn-shine {
    position: absolute;
    top: 0;
    left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.12), transparent);
    z-index: 1;
    animation: btnShine 4s ease-in-out infinite;
}

@keyframes btnShine {
    0%, 100% { left: -100%; }
    50%      { left: 120%; }
}

.btn-search:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 35px rgba(139, 92, 246, 0.4), 0 0 80px rgba(139, 92, 246, 0.08);
}

.btn-search:hover .btn-icon { transform: scale(1.2) rotate(-8deg); }

.btn-search:active { transform: translateY(0) scale(0.98); }

.btn-search:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* ===== LOADING ===== */
.loading-wrap {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}

.loading-wrap.active { display: flex; animation: fadeIn 0.4s ease; }

.loader {
    width: 76px;
    height: 76px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loader-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2.5px solid transparent;
}

.loader-ring:nth-child(1) {
    border-top-color: var(--primary);
    border-right-color: var(--primary);
    animation: spin 1.4s linear infinite;
}

.ring-2 {
    inset: 8px;
    border-bottom-color: var(--accent) !important;
    border-left-color: var(--accent) !important;
    animation: spin 1s linear infinite reverse !important;
}

.ring-3 {
    inset: 16px;
    border-top-color: var(--primary-l) !important;
    animation: spin 0.75s linear infinite !important;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loader-gem {
    font-size: 17px;
    color: var(--accent);
    animation: gemPulse 1.2s ease-in-out infinite;
}

@keyframes gemPulse {
    0%, 100% { transform: scale(1); opacity: 0.4; }
    50%      { transform: scale(1.35); opacity: 1; }
}

.loading-text {
    color: var(--text-2);
    font-size: 13px;
    font-weight: 300;
}

.dots::after {
    content: '';
    animation: dots 1.5s steps(4) infinite;
}

@keyframes dots {
    0%  { content: ''; }
    25% { content: '.'; }
    50% { content: '..'; }
    75% { content: '...'; }
}

/* ===== ERROR ===== */
.card-error {
    display: none;
    text-align: center;
    border-color: rgba(248, 113, 113, 0.15);
    background: linear-gradient(165deg,
        rgba(248, 113, 113, 0.06) 0%,
        rgba(20, 16, 36, 0.6) 100%);
    gap: 14px;
}

.card-error.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: popIn 0.5s cubic-bezier(.4,0,.2,1);
}

.error-icon-wrap {
    position: relative;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    color: var(--red);
}

.error-icon-bg {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(248, 113, 113, 0.08);
    animation: errorPulse 2s ease-in-out infinite;
}

@keyframes errorPulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50%      { transform: scale(1.3); opacity: 0; }
}

.error-msg {
    color: rgba(248, 113, 113, 0.9);
    font-size: 13.5px;
    line-height: 1.8;
    font-weight: 400;
}

.btn-retry {
    background: rgba(248, 113, 113, 0.08);
    border: 1px solid rgba(248, 113, 113, 0.15);
    color: var(--red);
    padding: 10px 22px;
    border-radius: 10px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.25s ease;
    -webkit-tap-highlight-color: transparent;
}

.btn-retry:hover {
    background: rgba(248, 113, 113, 0.14);
    transform: translateY(-1px);
}

/* ===== RESULT ===== */
.card-result {
    display: none;
}

.card-result.active {
    display: block;
    animation: popIn 0.6s cubic-bezier(.4,0,.2,1);
}

@keyframes popIn {
    0%   { opacity: 0; transform: translateY(24px) scale(0.96); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Result Top */
.result-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.result-avatar {
    width: 60px;
    height: 60px;
    border-radius: 18px;
    background: linear-gradient(145deg, var(--primary), #9333EA, var(--accent));
    background-size: 200% 200%;
    animation: logoGradient 5s ease infinite;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    color: #fff;
    position: relative;
    box-shadow: 0 4px 30px rgba(139, 92, 246, 0.3);
}

.avatar-glow {
    position: absolute;
    inset: -5px;
    border-radius: 22px;
    border: 1.5px solid rgba(139, 92, 246, 0.25);
    animation: logoPulse 3s ease-in-out infinite;
}

.result-status {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px 15px;
    border-radius: 50px;
    background: rgba(52, 211, 153, 0.08);
    border: 1px solid rgba(52, 211, 153, 0.15);
    color: var(--green);
    font-size: 12px;
    font-weight: 500;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--green);
    animation: statusBlink 2s ease-in-out infinite;
}

@keyframes statusBlink {
    0%, 100% { opacity: 1; box-shadow: 0 0 6px var(--green); }
    50%      { opacity: 0.3; box-shadow: none; }
}

/* Result Body */
.result-body {
    display: flex;
    flex-direction: column;
}

.info-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 0;
    transition: transform 0.2s ease;
}

.info-row:hover { transform: translateX(-4px); }

.info-row-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(139, 92, 246, 0.08);
    border: 1px solid rgba(139, 92, 246, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: var(--primary-l);
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.info-row:hover .info-row-icon {
    background: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.2);
    transform: scale(1.08);
    color: var(--accent);
}

.icon-region {
    background: rgba(192, 132, 252, 0.08) !important;
    color: var(--accent) !important;
}

.info-row-data {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
    min-width: 0;
}

.info-row-label {
    font-size: 10.5px;
    color: var(--text-3);
    font-weight: 300;
    text-transform: uppercase;
    letter-spacing: 1.2px;
}

.info-row-value {
    font-size: 15.5px;
    font-weight: 600;
    color: var(--text-1);
    word-break: break-all;
}

.info-sep {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(139, 92, 246, 0.1), transparent);
}

/* Region / Flag */
.region-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.flag-container {
    width: 36px;
    height: 26px;
    border-radius: 5px;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow:
        0 2px 8px rgba(0,0,0,0.3),
        0 0 0 1px rgba(255,255,255,0.06);
    position: relative;
    background: rgba(139, 92, 246, 0.1);
}

.flag-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.info-row-region:hover .flag-img {
    transform: scale(1.15);
}

/* ===== FOOTER ===== */
.footer {
    margin-top: auto;
    padding-top: 40px;
    padding-bottom: 10px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
    position: relative;
    z-index: 2;
}

.footer-text {
    font-size: 12px;
    color: var(--text-3);
    font-weight: 300;
}

.footer-brand {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 18px;
    border-radius: 50px;
    background: rgba(139, 92, 246, 0.08);
    border: 1px solid rgba(139, 92, 246, 0.12);
    color: var(--primary-l);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}

.footer-brand:hover {
    background: rgba(139, 92, 246, 0.16);
    border-color: rgba(139, 92, 246, 0.25);
    color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(139, 92, 246, 0.15);
}

.footer-brand i {
    font-size: 12px;
    animation: gemFloat 3s ease-in-out infinite;
}

@keyframes gemFloat {
    0%, 100% { transform: rotate(0deg) scale(1); }
    25%      { transform: rotate(10deg) scale(1.15); }
    75%      { transform: rotate(-5deg) scale(1.05); }
}

/* ===== ANIMATIONS ===== */
[data-animate] {
    opacity: 0;
    transform: translateY(20px);
}

[data-animate="fade-down"] { transform: translateY(-20px); }

[data-animate].animated {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.7s cubic-bezier(.4,0,.2,1),
                transform 0.7s cubic-bezier(.4,0,.2,1);
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(139, 92, 246, 0.25); border-radius: 10px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 380px) {
    .container { padding: 18px 14px 40px; }
    .glass-card { padding: 22px 16px; border-radius: 16px; }
    .title { font-size: 28px; }
    .logo { width: 70px; height: 70px; font-size: 30px; border-radius: 22px; }
    .logo-container { width: 70px; height: 70px; }
    .info-row-value { font-size: 14px; }
}

@media (min-width: 768px) {
    .container { padding-top: 60px; gap: 26px; }
}

/* ===== PERFORMANCE ===== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}