*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg-primary: #0a0e17;
    --bg-card: rgba(17, 24, 39, 0.7);
    --border-color: rgba(99, 102, 241, 0.2);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --accent-glow: rgba(99, 102, 241, 0.35);
    --input-bg: rgba(15, 23, 42, 0.8);
    --radius: 16px;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
    font-size: 16px;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: "Vazirmatn", system-ui, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    min-height: 100dvh;
    width: 100%;
    max-width: 100%;
    line-height: 1.6;
    overflow-x: hidden;
    overscroll-behavior-x: none;
}

.app-scroll {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
}

.background-glow {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(ellipse 60% 50% at 50% -10%, var(--accent-glow), transparent),
        radial-gradient(ellipse 40% 30% at 80% 80%, rgba(139, 92, 246, 0.15), transparent);
}

.telegram-link {
    position: fixed;
    left: 1.5rem;
    top: 1.5rem;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(145deg, #2aabee, #229ed9);
    color: #fff;
    text-decoration: none;
    box-shadow:
        0 4px 20px rgba(34, 158, 217, 0.35),
        0 0 0 1px rgba(255, 255, 255, 0.12) inset;
    transition:
        transform var(--transition),
        box-shadow var(--transition),
        background var(--transition);
}

.telegram-link:hover {
    transform: scale(1.08);
    background: linear-gradient(145deg, #3bb8f5, #2aabee);
    box-shadow:
        0 8px 28px rgba(34, 158, 217, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.18) inset;
}

.telegram-link:active {
    transform: scale(1.02);
}

.telegram-icon {
    width: 26px;
    height: 26px;
}

.container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 720px;
    padding: 2rem 1.5rem;
    overflow-x: hidden;
}

.header {
    text-align: center;
    margin-bottom: 2rem;
}

.logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    margin-bottom: 1.25rem;
    box-shadow: 0 8px 32px var(--accent-glow);
}

.logo-icon {
    width: 28px;
    height: 28px;
    color: white;
}

.title {
    font-size: 2.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #f1f5f9 0%, #a5b4fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 400;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.75rem;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow:
        0 4px 24px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.input-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.config-input {
    width: 100%;
    max-width: 100%;
    min-height: 220px;
    padding: 1rem 1.25rem;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: "Cascadia Code", "Fira Code", "Consolas", monospace;
    font-size: 0.875rem;
    line-height: 1.7;
    resize: vertical;
    direction: ltr;
    text-align: left;
    overflow-wrap: anywhere;
    word-break: break-word;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.config-input::placeholder {
    color: #475569;
    font-family: "Vazirmatn", system-ui, sans-serif;
    direction: rtl;
    text-align: right;
}

.config-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.fix-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    width: 100%;
    margin-top: 1.25rem;
    padding: 0.875rem 1.5rem;
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    border: none;
    border-radius: 12px;
    color: white;
    font-family: "Vazirmatn", system-ui, sans-serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition), opacity var(--transition);
    box-shadow: 0 4px 20px var(--accent-glow);
}

.fix-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 28px var(--accent-glow);
}

.fix-btn:active {
    transform: translateY(0);
}

.fix-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-icon {
    width: 20px;
    height: 20px;
}

.footer {
    text-align: center;
    margin-top: 1.75rem;
}

.footer p {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.hidden {
    display: none !important;
}

.message-box {
    margin-top: 1rem;
    padding: 0.875rem 1rem;
    border-radius: 10px;
    font-size: 0.875rem;
    line-height: 1.6;
}

.error-box {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #fca5a5;
}

.notice-box {
    margin-bottom: 1rem;
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.35);
    color: #86efac;
}

.toast {
    position: fixed;
    top: 1.25rem;
    left: 50%;
    transform: translateX(-50%);
    opacity: 1;
    visibility: visible;
    z-index: 1000;
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.4);
    color: #86efac;
    font-size: 0.9375rem;
    font-weight: 600;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast.hidden {
    display: block !important;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-50%) translateY(-12px);
    pointer-events: none;
}

.result-section {
    margin-top: 1.25rem;
}

.result-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #a5b4fc;
}

.client-info {
    margin-bottom: 1.25rem;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.info-item {
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.75rem 0.875rem;
    font-size: 0.8125rem;
}

.info-item span {
    display: block;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.info-item strong {
    color: var(--text-primary);
    font-weight: 600;
    word-break: break-all;
}

.fixed-info-layout {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
}

.info-item-email,
.info-item-expiry {
    text-align: center;
}

.fixed-info-columns {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.875rem;
}

.fixed-info-group {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    padding: 0.875rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: rgba(15, 23, 42, 0.45);
}

.fixed-info-heading {
    font-size: 0.9375rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.125rem;
}

.fixed-info-old .fixed-info-heading,
.fixed-info-old .info-item span,
.fixed-info-old .info-item strong {
    color: #fca5a5;
}

.fixed-info-old {
    border-color: rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.06);
}

.fixed-info-old .info-item {
    border-color: rgba(239, 68, 68, 0.2);
    background: rgba(239, 68, 68, 0.04);
}

.fixed-info-new .fixed-info-heading,
.fixed-info-new .info-item span,
.fixed-info-new .info-item strong {
    color: #86efac;
}

.fixed-info-new {
    border-color: rgba(34, 197, 94, 0.3);
    background: rgba(34, 197, 94, 0.06);
}

.fixed-info-new .info-item {
    border-color: rgba(34, 197, 94, 0.2);
    background: rgba(34, 197, 94, 0.04);
}

.info-value-ltr {
    direction: ltr;
    unicode-bidi: plaintext;
    display: inline-block;
}

.result-config-row {
    display: flex;
    gap: 0.75rem;
    align-items: stretch;
}

.result-config {
    min-height: 100px;
    flex: 1;
}

.copy-btn {
    flex-shrink: 0;
    padding: 0 1.25rem;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: "Vazirmatn", system-ui, sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition);
}

.copy-btn:hover {
    background: rgba(99, 102, 241, 0.25);
    border-color: var(--accent);
}

.qr-wrapper {
    margin-top: 1.25rem;
    text-align: center;
}

.qr-image {
    display: inline-block;
    margin-top: 0.5rem;
    padding: 0.75rem;
    background: white;
    border-radius: 12px;
    max-width: 220px;
    width: 100%;
}

@media (max-width: 768px) {
    html {
        height: 100%;
        overflow: hidden;
    }

    body {
        position: fixed;
        inset: 0;
        height: 100%;
        min-height: 0;
        overflow: hidden;
        touch-action: pan-y;
    }

    .app-scroll {
        height: 100%;
        min-height: 0;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: none;
        touch-action: pan-y;
        justify-content: flex-start;
    }

    textarea,
    input,
    select,
    button {
        font-size: 16px !important;
    }

    .telegram-link {
        left: 1rem;
        top: 1rem;
        width: 46px;
        height: 46px;
    }

    .telegram-icon {
        width: 22px;
        height: 22px;
    }

    .container {
        padding: 4.5rem 1rem 2rem;
        max-width: 100%;
    }

    .title {
        font-size: 1.75rem;
    }

    .card {
        padding: 1.25rem;
        max-width: 100%;
        overflow-x: hidden;
    }

    .config-input {
        min-height: 180px;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .fixed-info-columns {
        grid-template-columns: 1fr;
    }

    .result-config-row {
        flex-direction: column;
    }

    .copy-btn {
        padding: 0.75rem;
    }
}
