/* ==========================================================================
   Paneliux — Login Screen
   IRANSansX (modern variant) + Vazirmatn fallback
   ========================================================================== */

@import url('https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/Vazirmatn-font-face.css');

@font-face {
    font-family: 'IRANSansX';
    src: url('https://cdn.jsdelivr.net/gh/morteza-ebadi/iransansx-fontface@1.0.0/dist/IRANSansXFaNum-Light.woff2') format('woff2');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'IRANSansX';
    src: url('https://cdn.jsdelivr.net/gh/morteza-ebadi/iransansx-fontface@1.0.0/dist/IRANSansXFaNum-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'IRANSansX';
    src: url('https://cdn.jsdelivr.net/gh/morteza-ebadi/iransansx-fontface@1.0.0/dist/IRANSansXFaNum-Medium.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'IRANSansX';
    src: url('https://cdn.jsdelivr.net/gh/morteza-ebadi/iransansx-fontface@1.0.0/dist/IRANSansXFaNum-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg-deep: #050a18;
    --bg-mid: #081024;
    --c-text: #e8eeff;
    --c-muted: #94a3b8;
    --c-dim: #64748b;
    --c-faint: #475569;
    --c-cyan: #5eead4;
    --c-cyan-mid: #22d3ee;
    --c-cyan-deep: #0891b2;
    --c-danger: #ef4444;
    --c-glow: rgba(34, 211, 238, 0.4);
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'IRANSansX', 'Vazirmatn', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
    background: var(--bg-deep);
    color: var(--c-text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    direction: rtl;
    line-height: 1.6;
    position: relative;
}

::selection {
    background: var(--c-cyan-mid);
    color: var(--bg-deep);
}

/* ==========================================================================
   Background — world map dots + cyan glow
   ========================================================================== */

.bg-layer {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
    background: radial-gradient(ellipse 80% 60% at 50% 50%, var(--bg-mid) 0%, var(--bg-deep) 70%);
}

.bg-map {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0.18;
    animation: map-fade-in 1.6s ease-out;
}

.bg-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 900px;
    height: 700px;
    background: radial-gradient(ellipse 50% 50% at 50% 50%, rgba(34, 211, 238, 0.18) 0%, transparent 60%);
    filter: blur(80px);
    pointer-events: none;
    animation: glow-pulse 8s ease-in-out infinite;
}

@keyframes map-fade-in {
    from { opacity: 0; }
    to { opacity: 0.18; }
}

@keyframes glow-pulse {
    0%, 100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 0.7; transform: translate(-50%, -50%) scale(1.08); }
}

/* ==========================================================================
   Topbar — small logo top-left
   ========================================================================== */

.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    padding: 22px 32px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    pointer-events: none;
}

.brand {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    pointer-events: auto;
    transition: transform 0.3s;
}

.brand:hover { transform: scale(1.03); }

.brand-logo {
    height: 44px;
    width: auto;
    filter: drop-shadow(0 0 14px var(--c-glow));
    transition: filter 0.3s;
}

.brand:hover .brand-logo {
    filter: drop-shadow(0 0 22px var(--c-glow));
}

/* ==========================================================================
   Stage — main container, centers the login card
   ========================================================================== */

.stage {
    position: relative;
    z-index: 10;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 100px 24px 80px;
}

/* ==========================================================================
   Login card
   ========================================================================== */

.login-card {
    width: 100%;
    max-width: 420px;
    background: linear-gradient(155deg, rgba(15, 23, 42, 0.85) 0%, rgba(8, 12, 24, 0.92) 100%);
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    border: 0.5px solid rgba(94, 234, 212, 0.18);
    border-radius: 20px;
    padding: 36px 36px 28px;
    box-shadow:
        0 30px 80px rgba(0, 0, 0, 0.55),
        0 0 0 0.5px rgba(94, 234, 212, 0.08) inset,
        0 0 100px rgba(34, 211, 238, 0.08);
    animation: card-rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both;
    position: relative;
}

@keyframes card-rise {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Logo on top of card */

.login-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 22px;
}

.login-logo img {
    height: 110px;
    width: auto;
    filter: drop-shadow(0 0 24px rgba(34, 211, 238, 0.45));
    animation: logo-float 5s ease-in-out infinite;
}

@keyframes logo-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

/* Title + subtitle */

.login-title {
    font-size: 22px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 6px;
    color: var(--c-text);
    letter-spacing: -0.01em;
}

.login-subtitle {
    font-size: 13px;
    color: var(--c-dim);
    text-align: center;
    margin-bottom: 26px;
    font-weight: 400;
}

/* Alert (error) */

.login-alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    margin-bottom: 18px;
    background: rgba(239, 68, 68, 0.1);
    border: 0.5px solid rgba(239, 68, 68, 0.3);
    border-radius: 10px;
    color: #fca5a5;
    font-size: 13px;
    line-height: 1.5;
}

.login-alert svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Form fields */

.login-form {
    display: block;
}

.login-field {
    margin-bottom: 14px;
}

.field-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--c-muted);
    margin-bottom: 7px;
    text-align: right;
}

.field-wrap {
    position: relative;
    background: rgba(255, 255, 255, 0.03);
    border: 0.5px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    flex-direction: row-reverse;
}

.field-wrap:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(94, 234, 212, 0.2);
}

.field-wrap:focus-within {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(94, 234, 212, 0.5);
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.12);
}

.field-icon {
    width: 16px;
    height: 16px;
    color: var(--c-faint);
    margin-right: 14px;
    flex-shrink: 0;
    transition: color 0.2s;
}

.field-wrap:focus-within .field-icon {
    color: var(--c-cyan);
}

.field-wrap input {
    flex: 1;
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    padding: 13px 12px 13px 14px;
    font-family: inherit;
    font-size: 14px;
    color: var(--c-text);
    direction: ltr;
    text-align: left;
}

.field-wrap input::placeholder {
    color: var(--c-faint);
    opacity: 0.7;
    font-family: 'IRANSansX', 'Vazirmatn', sans-serif;
    direction: rtl;
    text-align: right;
}

.field-wrap input:-webkit-autofill,
.field-wrap input:-webkit-autofill:hover,
.field-wrap input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 50px rgba(15, 23, 42, 0.95) inset;
    -webkit-text-fill-color: var(--c-text);
    caret-color: var(--c-text);
}

.field-toggle {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px 12px;
    color: var(--c-faint);
    transition: color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.field-toggle:hover { color: var(--c-cyan); }
.field-toggle svg { width: 16px; height: 16px; }
.field-toggle.is-shown svg { color: var(--c-cyan); }

/* Submit button */

.login-submit {
    width: 100%;
    margin-top: 8px;
    padding: 14px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--c-cyan) 0%, var(--c-cyan-deep) 100%);
    color: #042f2e;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow:
        0 10px 30px rgba(34, 211, 238, 0.4),
        0 0 0 0.5px rgba(255, 255, 255, 0.18) inset;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s;
    position: relative;
    overflow: hidden;
}

.login-submit::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 30%, rgba(255, 255, 255, 0.3) 50%, transparent 70%);
    transform: translateX(-100%);
    transition: transform 0.7s;
}

.login-submit:hover::before { transform: translateX(100%); }

.login-submit:hover {
    transform: translateY(-2px);
    box-shadow:
        0 14px 38px rgba(34, 211, 238, 0.55),
        0 0 0 0.5px rgba(255, 255, 255, 0.25) inset;
}

.login-submit:active {
    transform: translateY(0);
}

.login-submit svg {
    width: 17px;
    height: 17px;
}

/* Footer note */

.login-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 22px;
    padding-top: 18px;
    border-top: 0.5px solid rgba(255, 255, 255, 0.06);
    font-size: 11px;
    color: var(--c-faint);
}

.login-note-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--c-cyan-mid);
    box-shadow: 0 0 8px var(--c-cyan-mid);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

/* ==========================================================================
   Bottom strip (copyright)
   ========================================================================== */

.bottom {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 50;
    padding: 16px 24px;
    text-align: center;
    font-size: 11px;
    color: var(--c-faint);
    pointer-events: none;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 540px) {
    html, body { overflow-y: auto; }

    .topbar { padding: 16px 20px; }
    .brand-logo { height: 36px; }

    .stage { padding: 80px 16px 60px; min-height: 100vh; height: auto; }

    .login-card {
        padding: 28px 24px 22px;
        border-radius: 18px;
    }

    .login-logo img { height: 88px; }
    .login-title { font-size: 19px; }
    .login-subtitle { font-size: 12px; margin-bottom: 22px; }

    .field-wrap input { padding: 12px; font-size: 13px; }
    .login-submit { padding: 13px; font-size: 14px; }

    .bottom { padding: 12px 16px; font-size: 10px; }
}

@media (max-height: 700px) and (min-width: 541px) {
    .login-logo { margin-bottom: 14px; }
    .login-logo img { height: 84px; }
    .login-subtitle { margin-bottom: 18px; }
    .login-field { margin-bottom: 11px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
