@font-face {
    font-family: 'Vazirmatn';
    src: url('/static/assets/fonts/Vazirmatn/Vazirmatn-VariableFont_wght.ttf') format('truetype');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

:root {
    --primary-bg: #add8e6f2;
    --secondary-bg: #87cefad9;
    --accent-gold: #ffd700e6;
    --accent-gold-dark: #daa520d9;
    --text-primary: #212121f2;
    --text-secondary: #464646b3;

    /* Panel surfaces (control panel, market panel) */
    --panel-bg: rgba(255, 255, 255, 0.95);
    --panel-header-bg: rgba(255, 255, 255, 0.8);
    --panel-border: #eee;
    --panel-text: #333;
    --panel-muted: #666;

    /* Input & surface colors */
    --surface-bg: #ffffff;
    --surface-border: #ddd;
    --surface-hover-border: #f0f0f0;
    --surface-hover-bg: rgba(0, 0, 0, 0.03);
}

/* ── Dark Theme ── */
[data-theme="dark"] {
    --primary-bg: #1a1a2ed9;
    --secondary-bg: #16213ee6;
    --accent-gold: #ffd700e6;
    --accent-gold-dark: #daa520d9;
    --text-primary: #e4e6f0f2;
    --text-secondary: #a0a4b8b3;

    --panel-bg: rgba(26, 29, 46, 0.96);
    --panel-header-bg: rgba(26, 29, 46, 0.9);
    --panel-border: #2a2f45;
    --panel-text: #e4e6f0;
    --panel-muted: #888ca0;

    --surface-bg: #1e2235;
    --surface-border: #3a3f55;
    --surface-hover-border: #2a2f45;
    --surface-hover-bg: rgba(255, 255, 255, 0.04);
}

/* ── Smooth Theme Transitions ── */

html,
body {
    transition: background 0.35s ease, color 0.35s ease;
}

.header,
.clock-container,
.clock,
.date,
.price-label,
.price,
.price-unit,
.calculated-price,
.timestamp,
.bottom-section,
.status-item,
.company-name,
.control-panel-btn,
.market-btn,
.sidebar-btn,
.control-panel,
.market-panel,
.panel-header,
.panel-header h3,
.panel-content h4,
.asset-item,
.asset-name,
.asset-price,
.asset-subtitle,
.bubble-info,
.update-time,
.format-select,
.sound-select,
.text-input,
.color-input,
.checkbox-label,
.radio-label,
.formula-preview small,
.helper-text,
.theme-preview-card,
.theme-preview-name,
.code-send-hint,
.code-send-status {
    transition: background 0.35s ease, background-color 0.35s ease,
                color 0.35s ease, border-color 0.35s ease,
                box-shadow 0.35s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

html,
body {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    font-family: 'Vazirmatn', sans-serif;
    background: linear-gradient(135deg, var(--primary-bg) 0%, var(--secondary-bg) 100%);
    color: var(--text-primary);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.container {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 20px;
    position: relative;
}

.color-picker {
    margin-bottom: 15px;
}

.color-picker label {
    display: block;
    color: var(--primary-bg);
    margin-bottom: 5px;
    font-weight: 500;
}

.color-input {
    width: 100%;
    padding: 8px;
    border: 2px solid var(--surface-border);
    border-radius: 8px;
    font-family: 'Vazirmatn', sans-serif;
    background: var(--surface-bg);
}

.color-presets {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 10px 0;
}

.color-preset {
    width: 100%;
    height: 30px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.color-preset:hover {
    transform: scale(1.05);
}

/* Header Section */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.brand-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.verified-badge {
    width: 20px;
    height: 20px;
    background: var(--accent-gold);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--primary-bg);
    font-weight: bold;
}

.brand {
    font-size: 2.2em;
    font-weight: 900;
    color: var(--accent-gold);
    text-shadow: 3px 3px 8px rgba(0, 0, 0, 0.4);
    letter-spacing: -1px;
}

.union-title {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.4em;
    font-weight: 700;
    color: var(--text-primary);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.clock-container {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.15);
    padding: 10px 20px;
    border-radius: 20px;
    backdrop-filter: blur(15px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    min-height: 60px;
    /* Ensure consistent height */
    transition: all 0.3s ease;
}

/* When only time or only date is shown */
.clock-container.single-item {
    gap: 0;
    padding: 10px 15px;
}

.clock {
    font-size: 1.6em;
    font-weight: 700;
    direction: rtl;
    font-feature-settings: "tnum";
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
}

.date {
    font-size: 1.1em;
    font-weight: 500;
    color: var(--text-secondary);
    direction: ltr;
}

.clock-container.clock-hidden {
    display: none !important;
}

.clock,
.date {
    transition: all 0.3s ease;
}

/* Main Price Section */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 10px 0;
}

.price-section {
    margin-bottom: 20px;
}

.price-label {
    font-size: 1.8em;
    font-weight: 500;
    margin-bottom: 30px;
    opacity: 0.9;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    color: var(--text-primary);
}

.price {
    font-size: 10em;
    font-weight: 900;
    color: var(--accent-gold);
    text-shadow: 4px 4px 15px rgba(0, 0, 0, 0.6);
    margin: 20px 0;
    line-height: 1;
    letter-spacing: -2px;
}

.price-unit {
    font-size: 0.25em;
    font-weight: 400;
    color: var(--text-secondary);
    margin-right: 15px;
}

.calculated-price {
    font-size: 1.8em;
    font-weight: 600;
    margin: 25px 0;
    opacity: 0.9;
    color: var(--text-primary);
}

.calculated-price-value {
    color: var(--accent-gold);
    font-weight: 700;
    margin-right: 10px;
}

.timestamp {
    font-size: 1.3em;
    opacity: 0.8;
    margin-top: 15px;
    direction: rtl;
    color: var(--text-secondary);
}

.format-picker {
    margin-bottom: 15px;
}

.format-picker label {
    display: block;
    color: var(--primary-bg);
    margin-bottom: 5px;
    font-weight: 500;
    font-size: 0.9em;
}

.format-select {
    width: 100%;
    padding: 10px;
    border: 2px solid var(--surface-border);
    border-radius: 8px;
    font-family: 'Vazirmatn', sans-serif;
    font-size: 0.9em;
    background: var(--surface-bg);
    color: var(--panel-text);
}

.format-select:focus {
    border-color: var(--primary-bg);
    outline: none;
}

.visibility-option {
    margin-bottom: 15px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    color: var(--primary-bg);
    font-weight: 500;
    font-size: 0.9em;
    padding: 8px 0;
}

/* Checkbox styles */

.visibility-checkbox {
    display: none;
    /* Hide default checkbox */
}

.checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid var(--surface-border);
    border-radius: 4px;
    margin-left: 10px;
    position: relative;
    transition: all 0.3s ease;
    background: var(--surface-bg);
}

.checkbox-label:hover .checkmark {
    border-color: var(--primary-bg);
}

.visibility-checkbox:checked+.checkmark {
    background: var(--primary-bg);
    border-color: var(--primary-bg);
}

.visibility-checkbox:checked+.checkmark::after {
    content: "✓";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 14px;
    font-weight: bold;
}

/* Focus state for accessibility */
.visibility-checkbox:focus+.checkmark {
    box-shadow: 0 0 0 3px rgba(26, 35, 126, 0.2);
}

/* Bottom Section - All in one line */
.bottom-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-top: 2px solid rgba(255, 255, 255, 0.2);
}

.status-container {
    display: flex;
    gap: 15px;
    align-items: center;
}

.status-item {
    font-size: 0.9em;
    opacity: 0.9;
    color: var(--text-secondary);
}

.status-item.connected {
    color: #4CAF50;
}

.status-item.disconnected {
    color: #f44336;
}

/* Status */ {
    color: var(--accent-gold);
    font-weight: 600;
    font-size: 0.9em;
}

/* ── Right Sidebar ── */

.right-sidebar {
    position: absolute;
    top: 50%;
    right: 5px;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1000;
}

.sidebar-btn {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 8px;
    font-size: 1.5em;
    color: var(--text-primary);
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: background 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.sidebar-btn:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: scale(1.08);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
}

.sidebar-btn:active {
    transform: scale(0.93);
}

.sidebar-icon {
    display: inline-block;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease;
}

.sidebar-btn.spin-out .sidebar-icon {
    transform: rotate(180deg) scale(0);
    opacity: 0;
}

.sidebar-btn.spin-in .sidebar-icon {
    animation: iconSpinIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes iconSpinIn {
    0% {
        transform: rotate(-180deg) scale(0);
        opacity: 0;
    }
    60% {
        opacity: 1;
    }
    100% {
        transform: rotate(0deg) scale(1);
        opacity: 1;
    }
}

/* Gentle glow on idle */
.sidebar-btn {
    animation: gentleGlow 4s ease-in-out infinite;
}

.sidebar-btn:hover {
    animation: none;
}

@keyframes gentleGlow {
    0%, 100% { box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); }
    50% { box-shadow: 0 4px 18px rgba(255, 215, 0, 0.15), 0 0 8px 1px rgba(255, 215, 0, 0.08); }
}

/* Control Panel Button */
.control-panel-btn {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 8px;
    font-size: 1.5em;
    color: var(--text-primary);
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: background 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.control-panel-btn:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: scale(1.08);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
}

.control-panel-btn:active {
    transform: scale(0.93);
}

/* Control Panel */
.control-panel {
    position: absolute;
    top: 50%;
    right: 80px;
    transform: translateY(-50%);
    background: var(--panel-bg);
    border-radius: 15px;
    backdrop-filter: blur(20px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    z-index: 999;
    display: none;
    width: 320px;
    max-height: 70vh;
    overflow: hidden;
    transition: background 0.35s ease, box-shadow 0.35s ease;
}

.control-panel.show {
    display: flex;
    flex-direction: column;
}

/* Fullscreen hiding - MUST come after the base styles */
:fullscreen .right-sidebar,
:fullscreen .control-panel,
:fullscreen .market-panel {
    display: none !important;
}

:-webkit-full-screen .right-sidebar,
:-webkit-full-screen .control-panel,
:-webkit-full-screen .market-panel {
    display: none !important;
}

:-moz-full-screen .right-sidebar,
:-moz-full-screen .control-panel,
:-moz-full-screen .market-panel {
    display: none !important;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid var(--panel-border);
    background: var(--panel-header-bg);
    transition: background 0.35s ease, border-color 0.35s ease;
}

.panel-header h3 {
    color: var(--primary-bg);
    margin: 0;
    font-size: 1.2em;
}

.close-panel {
    background: none;
    border: none;
    font-size: 1.2em;
    color: var(--panel-muted);
    cursor: pointer;
    padding: 5px;
    transition: color 0.2s ease;
}

.close-panel:hover {
    color: var(--panel-text);
}

.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 0 20px 20px;
}

.panel-section {
    margin: 20px 0;
}

.panel-section h4 {
    color: var(--primary-bg);
    margin-bottom: 15px;
    font-size: 1em;
    border-bottom: 1px solid var(--panel-border);
    padding-bottom: 8px;
}

/* Market Button */
.market-btn {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 8px;
    font-size: 0.9em;
    color: var(--text-primary);
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: background 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-family: 'Vazirmatn', sans-serif;
    font-weight: 600;
}

.market-btn:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: scale(1.08);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
}

.market-btn:active {
    transform: scale(0.93);
}

/* Rotated Text */
.rotated-text {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    font-size: 0.85em;
    letter-spacing: 1px;
}

/* Market Panel Positioning */
.market-panel {
    position: absolute;
    top: 50%;
    right: 80px;
    transform: translateY(-50%);
    background: var(--panel-bg);
    border-radius: 15px;
    backdrop-filter: blur(20px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    z-index: 999;
    display: none;
    width: 320px;
    max-height: 70vh;
    overflow: hidden;
    animation: slideInFromRight 0.3s ease-out;
    transition: background 0.35s ease, box-shadow 0.35s ease;
}

.market-panel.show {
    display: flex;
    flex-direction: column;
}

@keyframes slideInFromRight {
    from {
        opacity: 0;
        transform: translateY(-50%) translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateY(-50%) translateX(0);
    }
}

/* Market Assets Styling */
.market-section {
    padding: 0;
}

.asset-group {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--panel-border);
}

.asset-group:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.asset-group h4 {
    color: var(--primary-bg);
    margin-bottom: 12px;
    font-size: 0.95em;
    padding: 0 5px;
    border-bottom: 1px solid var(--panel-border);
    padding-bottom: 8px;
}

.asset-item {
    padding: 10px 8px;
    margin-bottom: 8px;
    border-radius: 8px;
    transition: background-color 0.2s ease, border-color 0.35s ease;
    border: 1px solid var(--surface-hover-border);
}

.asset-item:hover {
    background-color: var(--surface-hover-bg);
    border-color: var(--surface-border);
}

.asset-name {
    font-size: 0.85em;
    color: var(--panel-text);
    font-weight: 600;
}

.asset-price {
    font-size: 0.9em;
    color: var(--primary-bg);
    font-weight: 700;
    direction: ltr;
    font-family: 'Vazirmatn', monospace;
}

.asset-subtitle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75em;
    color: var(--panel-muted);
    margin-top: 2px;
}

.bubble-info {
    color: #d32f2f;
    font-weight: 500;
}

.update-time {
    color: var(--panel-muted);
    font-size: 0.7em;
    direction: ltr;
}

.asset-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Scrollbar for panel */
.panel-content::-webkit-scrollbar {
    width: 6px;
}

.panel-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.panel-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.panel-content::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.sound-picker {
    margin-bottom: 15px;
}

.sound-picker label {
    display: block;
    color: var(--primary-bg);
    margin-bottom: 5px;
    font-weight: 500;
    font-size: 0.9em;
}

.sound-select {
    width: 100%;
    padding: 10px;
    border: 2px solid var(--surface-border);
    border-radius: 8px;
    font-family: 'Vazirmatn', sans-serif;
    font-size: 0.9em;
    background: var(--surface-bg);
    color: var(--panel-text);
    margin-bottom: 10px;
}

.sound-select:focus {
    border-color: var(--primary-bg);
    outline: none;
}

.text-input {
    width: 100%;
    padding: 10px;
    border: 2px solid var(--surface-border);
    border-radius: 8px;
    font-family: 'Vazirmatn', sans-serif;
    font-size: 0.9em;
    background: var(--surface-bg);
    color: var(--panel-text);
    margin-bottom: 10px;
}

.text-input:focus {
    border-color: var(--primary-bg);
    outline: none;
}

.test-sound-btn {
    width: 100%;
    padding: 12px;
    background: var(--primary-bg);
    color: white;
    border: none;
    border-radius: 8px;
    font-family: 'Vazirmatn', sans-serif;
    font-size: 0.9em;
    cursor: pointer;
    transition: background 0.3s ease;
}

.test-sound-btn:hover {
    background: var(--secondary-bg);
}

.test-sound-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.test-sound-btn:disabled:hover {
    background: var(--primary-bg);
}

.secondary-btn {
    background: #607d8b;
}

.secondary-btn:hover {
    background: #78909c;
}

.danger-btn {
    background: #d32f2f;
}

.danger-btn:hover {
    background: #e53935;
}

.panel-logout-section {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--panel-border);
}

.panel-logout-btn {
    width: 100%;
    padding: 12px;
    background: #c62828;
    color: white;
    border: none;
    border-radius: 8px;
    font-family: 'Vazirmatn', sans-serif;
    font-size: 0.9em;
    cursor: pointer;
    transition: background 0.3s ease;
}

.panel-logout-btn:hover {
    background: #d32f2f;
}

.theme-manager {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--panel-border);
}

.theme-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-top: 8px;
}

.theme-actions.two-col {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.helper-text {
    display: block;
    margin-top: 8px;
    color: var(--panel-muted);
    line-height: 1.4;
    font-size: 0.8em;
}

.helper-text.success {
    color: #2e7d32;
}

.helper-text.error {
    color: #c62828;
}

.theme-preview-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 10px;
}

.theme-preview-card {
    width: 100%;
    border: 1px solid var(--surface-border);
    border-radius: 10px;
    background: var(--surface-bg);
    padding: 8px;
    cursor: pointer;
    text-align: right;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    font-family: 'Vazirmatn', sans-serif;
    appearance: none;
}

.theme-preview-card:hover {
    transform: translateY(-1px);
    border-color: var(--primary-bg);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.theme-preview-card.active {
    border-color: var(--primary-bg);
    box-shadow: 0 0 0 2px rgba(26, 35, 126, 0.14);
}

.theme-preview-card:focus-visible {
    outline: 2px solid var(--primary-bg);
    outline-offset: 2px;
}

.theme-preview-card.empty {
    cursor: default;
    color: var(--panel-muted);
    text-align: center;
    grid-column: 1 / -1;
}

.theme-preview-card.empty:hover {
    transform: none;
    border-color: var(--surface-border);
    box-shadow: none;
}

.theme-preview-swatch {
    width: 100%;
    height: 34px;
    border-radius: 8px;
    margin-bottom: 6px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background:
        linear-gradient(120deg, var(--tp-primary) 0%, var(--tp-secondary) 100%);
    position: relative;
    overflow: hidden;
}

.theme-preview-swatch::before,
.theme-preview-swatch::after {
    content: "";
    position: absolute;
    top: 6px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.theme-preview-swatch::before {
    right: 8px;
    background: var(--tp-accent);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.theme-preview-swatch::after {
    right: 22px;
    background: var(--tp-accent-dark);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.theme-preview-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.theme-preview-name {
    color: var(--panel-text);
    font-size: 0.78em;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.theme-preview-badge {
    font-size: 0.7em;
    color: var(--panel-muted);
    background: var(--surface-hover-bg);
    border-radius: 999px;
    padding: 2px 6px;
    flex-shrink: 0;
}

.formula-option {
    margin-bottom: 12px;
}

.radio-label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    color: var(--primary-bg);
    font-weight: 500;
    font-size: 0.85em;
    padding: 8px 0;
    line-height: 1.4;
}

.formula-radio {
    display: none;
    /* Hide default radio */
}

.radiomark {
    width: 18px;
    height: 18px;
    border: 2px solid var(--surface-border);
    border-radius: 50%;
    margin-left: 10px;
    margin-top: 2px;
    position: relative;
    transition: all 0.3s ease;
    background: var(--surface-bg);
    flex-shrink: 0;
}

.radio-label:hover .radiomark {
    border-color: var(--primary-bg);
}

.formula-radio:checked+.radiomark {
    border-color: var(--primary-bg);
}

.formula-radio:checked+.radiomark::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary-bg);
}

.formula-preview {
    margin-top: 10px;
    padding: 8px 12px;
    background: var(--surface-hover-bg);
    border-radius: 6px;
    border-right: 3px solid var(--primary-bg);
}

.formula-custom-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    margin-right: 28px;
}

.formula-custom-input-row label {
    color: #555;
    font-size: 0.85em;
    margin: 0;
}

.percent-input {
    width: 90px;
    padding: 8px 10px;
    border: 2px solid var(--surface-border);
    border-radius: 8px;
    font-family: 'Vazirmatn', sans-serif;
    font-size: 0.85em;
    direction: ltr;
    text-align: center;
    background: var(--surface-bg);
    color: var(--panel-text);
}

.percent-input:focus {
    border-color: var(--primary-bg);
    outline: none;
}

.percent-input.disabled {
    background: var(--surface-hover-bg);
    color: var(--panel-muted);
}

.percent-input.input-error {
    border-color: #d32f2f;
    box-shadow: 0 0 0 2px rgba(211, 47, 47, 0.12);
}

.percent-suffix {
    color: #666;
    font-size: 0.85em;
    font-weight: 600;
}

.formula-preview small {
    color: #666;
    font-size: 0.8em;
    line-height: 1.4;
}

/* Code Send Section */
.code-send-section {
    margin-bottom: 15px;
    padding: 12px;
    background: var(--surface-hover-bg);
    border-radius: 10px;
    border: 1px solid var(--surface-border);
}

.code-send-hint {
    color: var(--panel-text);
    font-size: 0.8em;
    margin-bottom: 10px;
    line-height: 1.5;
}

.code-send-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.code-input {
    flex: 1;
    padding: 10px 12px;
    border: 2px solid var(--surface-border);
    border-radius: 8px;
    font-family: 'Vazirmatn', sans-serif;
    font-size: 1em;
    direction: ltr;
    text-align: center;
    letter-spacing: 6px;
    transition: border-color 0.2s ease;
    background: var(--surface-bg);
    color: var(--panel-text);
}

.code-input:focus {
    border-color: var(--primary-bg);
    outline: none;
    box-shadow: 0 0 0 3px rgba(26, 35, 126, 0.1);
}

.code-input::placeholder {
    letter-spacing: 0;
    direction: rtl;
    color: var(--panel-muted);
    font-size: 0.85em;
}

.code-send-btn {
    padding: 10px 18px;
    background: var(--primary-bg);
    color: white;
    border: none;
    border-radius: 8px;
    font-family: 'Vazirmatn', sans-serif;
    font-size: 0.9em;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s ease, transform 0.15s ease;
    min-width: 60px;
}

.code-send-btn:hover {
    background: var(--secondary-bg);
    transform: scale(1.03);
}

.code-send-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.code-send-status {
    display: block;
    margin-top: 8px;
    font-size: 0.78em;
    line-height: 1.4;
    min-height: 1.2em;
    transition: color 0.2s ease;
}

.code-send-status.success {
    color: #2e7d32;
}

.code-send-status.error {
    color: #c62828;
}

/* Focus state for accessibility */
.formula-radio:focus+.radiomark {
    box-shadow: 0 0 0 3px rgba(26, 35, 126, 0.2);
}

/* Animations */
@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes glow {
    0% {
        text-shadow: 4px 4px 15px rgba(0, 0, 0, 0.6);
    }

    50% {
        text-shadow: 4px 4px 30px rgba(255, 222, 32, 0.74);
    }

    100% {
        text-shadow: 4px 4px 15px rgba(0, 0, 0, 0.6);
    }
}

.price-update {
    animation: pulse 0.8s ease-in-out, glow 0.8s ease-in-out;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .header {
        padding: 10px 0;
    }

    .union-title {
        font-size: 1.1em;
        top: 15px;
    }

    .brand {
        font-size: 1.8em;
    }

    .verified-badge {
        width: 16px;
        height: 16px;
        font-size: 10px;
    }

    .clock-container {
        padding: 8px 15px;
        gap: 10px;
    }

    .clock {
        font-size: 1.3em;
    }

    .date {
        font-size: 0.9em;
    }

    .price {
        font-size: 6em;
    }

    .price-label {
        font-size: 1.4em;
    }

    .calculated-price {
        font-size: 1.4em;
    }

    .timestamp {
        font-size: 1.1em;
    }

    .bottom-section {
        padding: 8px 0;
        font-size: 0.8em;
    }

    .status-container {
        gap: 10px;
    }

    .settings-btn {
        top: 15px;
        left: 15px;
        width: 40px;
        height: 40px;
        font-size: 1.2em;
    }

    .settings-panel {
        top: 65px;
        left: 15px;
        min-width: 280px;
    }

    .theme-actions {
        grid-template-columns: 1fr;
    }

    .theme-actions.two-col {
        grid-template-columns: 1fr 1fr;
    }

    .theme-preview-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }

    .union-title {
        font-size: 0.9em;
        top: 12px;
    }

    .brand {
        font-size: 1.4em;
    }

    .clock-container {
        padding: 6px 12px;
        gap: 8px;
    }

    .clock {
        font-size: 1.1em;
    }

    .date {
        font-size: 0.8em;
    }

    .price {
        font-size: 4.5em;
    }

    .price-label {
        font-size: 1.1em;
        margin-bottom: 20px;
    }

    .calculated-price {
        font-size: 1.1em;
        margin: 15px 0;
    }

    .bottom-section {
        flex-direction: column;
        gap: 5px;
        padding: 5px 0;
    }

    .status-container {
        gap: 8px;
    }
}

@media (max-height: 600px) {
    .price {
        font-size: 5em;
    }

    .main-content {
        padding: 5px 0;
    }
}

/* Fullscreen support */
:fullscreen .container {
    padding: 25px;
}

:-webkit-full-screen .container {
    padding: 25px;
}

:-moz-full-screen .container {
    padding: 25px;
}

/* No scroll bars */
::-webkit-scrollbar {
    display: none;
}

/* Selection color */
::selection {
    background: rgba(255, 215, 0, 0.3);
}

/* Source picker */
.source-picker {
    margin-bottom: 20px;
}

.source-picker label {
    display: block;
    color: var(--primary-bg);
    margin-bottom: 5px;
    font-weight: 500;
    font-size: 0.9em;
}

.source-select {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--surface-border);
    border-radius: 4px;
    background: var(--surface-bg);
    color: var(--panel-text);
    font-family: inherit;
}

.source-info {
    margin-top: 5px;
    color: var(--panel-muted);
    font-size: 0.9em;
}
