/* ============================================================
   CYBER//TYPE — Shared Components
   Кнопки, формы, модалки, тосты, загрузка
   ============================================================ */

/* ==================== BUTTONS ==================== */
.btn {
    display: inline-block;
    padding: 14px 36px;
    font-family: 'Orbitron', sans-serif;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 2px;
    border: none;
    background: none;
}

.btn-block { display: block; width: 100%; }

.btn-primary {
    background: linear-gradient(90deg, rgba(0, 255, 200, 0.2), rgba(0, 255, 200, 0.1));
    border: 2px solid var(--primary);
    color: var(--primary);
}
.btn-primary:hover {
    background: var(--primary);
    color: #000;
    box-shadow: 0 0 30px var(--primary);
}
.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background: transparent;
    border: 1px solid rgba(255, 0, 100, 0.5);
    color: var(--secondary);
}
.btn-secondary:hover {
    border-color: var(--secondary);
    box-shadow: 0 0 20px rgba(255, 0, 100, 0.3);
}

.btn-small {
    padding: 10px 20px;
    font-size: 12px;
}

.btn-danger {
    background: rgba(255, 0, 100, 0.1);
    border: 1px solid var(--secondary);
    color: var(--secondary);
}
.btn-danger:hover {
    background: var(--secondary);
    color: #000;
}

/* ==================== MODAL ==================== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 200;
    align-items: center;
    justify-content: center;
}
.modal-overlay.active { display: flex; }

.modal {
    background: linear-gradient(135deg, #0a0a0f 0%, #1a0a1f 100%);
    border: 2px solid var(--primary);
    padding: 40px;
    max-width: 450px;
    width: 90%;
    position: relative;
}
.modal::before {
    content: '';
    position: absolute;
    top: -5px; left: -5px;
    right: -5px; bottom: -5px;
    border: 1px solid rgba(0, 255, 200, 0.3);
    pointer-events: none;
}

.modal-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 24px;
    color: var(--primary);
    text-align: center;
    margin-bottom: 30px;
    text-shadow: 0 0 10px var(--primary);
}

.modal-close {
    position: absolute;
    top: 15px; right: 15px;
    background: none;
    border: none;
    color: var(--secondary);
    font-size: 24px;
    cursor: pointer;
    transition: transform 0.2s;
}
.modal-close:hover { transform: scale(1.2); }

.modal .btn {
    display: block;
    width: 100%;
}

.modal form .btn {
    margin-top: 10px;
}

.modal form + .btn {
    margin-top: 12px;
}

/* ==================== FORMS ==================== */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    color: var(--primary);
    margin-bottom: 8px;
    font-size: 12px;
    letter-spacing: 2px;
}

.form-input {
    width: 100%;
    padding: 15px;
    background: rgba(0, 255, 200, 0.05);
    border: 1px solid rgba(0, 255, 200, 0.3);
    color: var(--primary);
    font-family: 'Share Tech Mono', monospace;
    font-size: 16px;
    transition: all 0.3s;
}
.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(0, 255, 200, 0.3);
}
.form-input::placeholder { color: rgba(0, 255, 200, 0.3); }

.form-input.code-input {
    text-align: center;
    font-size: 32px;
    letter-spacing: 10px;
}

.form-error {
    color: var(--secondary);
    font-size: 12px;
    margin-top: 5px;
    display: none;
}
.form-error.show { display: block; }

.form-textarea {
    width: 100%;
    padding: 12px;
    background: rgba(0, 255, 200, 0.05);
    border: 1px solid rgba(0, 255, 200, 0.3);
    color: var(--primary);
    font-family: 'Share Tech Mono', monospace;
    font-size: 14px;
    resize: vertical;
    min-height: 80px;
}
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
}

/* ==================== TOAST ==================== */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 15px 30px;
    background: rgba(0, 0, 0, 0.95);
    border: 1px solid var(--primary);
    color: var(--primary);
    z-index: 300;
    transition: transform 0.3s;
    font-size: 13px;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.error { border-color: var(--secondary); color: var(--secondary); }
.toast.success { border-color: var(--success); color: var(--success); }

/* ==================== LAYOUT WARNING ==================== */
.layout-warning {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    z-index: 500;
    padding: 30px 50px;
    background: rgba(10, 0, 15, 0.95);
    border: 2px solid var(--secondary);
    box-shadow:
        0 0 40px rgba(255, 0, 100, 0.5),
        0 0 80px rgba(255, 0, 100, 0.2),
        inset 0 0 30px rgba(255, 0, 100, 0.1);
    text-align: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s, transform 0.15s;
}
.layout-warning.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}
.layout-warning-text {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(18px, 4vw, 28px);
    font-weight: 700;
    color: var(--secondary);
    text-shadow: 0 0 10px var(--secondary), 0 0 30px var(--secondary);
    letter-spacing: 3px;
    text-transform: uppercase;
    animation: none;
}
.layout-warning.show .layout-warning-text {
    animation: layoutPulse 0.3s ease-in-out 2;
}
@keyframes layoutPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ==================== LOADING ==================== */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
    flex-direction: column;
    gap: 15px;
}

.spinner {
    width: 40px; height: 40px;
    border: 3px solid rgba(0, 255, 200, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-text {
    color: rgba(255, 255, 255, 0.4);
    font-size: 13px;
}

/* ==================== EMPTY STATE ==================== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: rgba(255, 255, 255, 0.4);
}
.empty-state-icon {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}
.empty-state-text {
    font-size: 14px;
    line-height: 1.6;
}

/* ==================== BACK LINK ==================== */
.back-link {
    color: var(--secondary);
    text-decoration: none;
    font-size: 14px;
    cursor: pointer;
    transition: color 0.3s;
}
.back-link:hover { color: var(--primary); }

/* ==================== TOP BAR (shared layout) ==================== */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid rgba(0, 255, 200, 0.15);
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 10px;
}

.page-title {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(20px, 4vw, 36px);
    color: var(--primary);
    text-shadow: 0 0 10px var(--primary), 0 0 20px var(--primary);
    letter-spacing: 4px;
}

/* User info (top-right) */
.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}
.user-email-tag {
    color: rgba(0, 255, 200, 0.5);
    font-size: 12px;
}
.btn-logout {
    padding: 6px 14px;
    background: rgba(255, 0, 100, 0.1);
    border: 1px solid rgba(255, 0, 100, 0.4);
    color: var(--secondary);
    font-family: 'Share Tech Mono', monospace;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.3s;
}
.btn-logout:hover { background: var(--secondary); color: #000; }

/* ==================== SCREEN SWITCHING ==================== */
.screen { display: none; }
.screen.active { display: block; }

/* ==================== TYPING CHARACTERS ==================== */
.char { transition: color 0.1s; }
.char.correct {
    color: var(--success);
    text-shadow: 0 0 6px rgba(0, 255, 0, 0.5), 0 0 12px rgba(0, 255, 0, 0.2);
}
.char.incorrect {
    color: var(--secondary);
    text-decoration: underline;
    text-shadow: 0 0 6px rgba(255, 0, 100, 0.5), 0 0 12px rgba(255, 0, 100, 0.2);
}
.char.current {
    background: var(--primary);
    color: #000;
    animation: blink 0.5s infinite;
}
.char.pending {
    color: var(--warning);
    text-shadow: 0 0 8px rgba(255, 204, 0, 0.6), 0 0 16px rgba(255, 204, 0, 0.3);
}

@keyframes blink { 50% { opacity: 0.7; } }
@keyframes cursorBlink { 50% { opacity: 0; } }

/* ==================== TYPING TEXT DISPLAY ==================== */
.text-display {
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid var(--primary);
    padding: 25px;
    margin-bottom: 20px;
    font-size: 20px;
    line-height: 1.8;
    min-height: 100px;
    cursor: text;
}

.hidden-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

/* ==================== STATS BAR ==================== */
.stats-bar {
    display: flex;
    justify-content: space-around;
    background: rgba(0, 255, 200, 0.05);
    border: 1px solid rgba(0, 255, 200, 0.15);
    padding: 15px;
    margin-bottom: 15px;
}

.stat-item { text-align: center; }

.stat-value {
    font-family: 'Orbitron', sans-serif;
    font-size: 24px;
    color: var(--primary);
}
.stat-value.error { color: var(--secondary); }

.stat-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 1px;
    margin-top: 3px;
}

/* ==================== SECTION TITLE ==================== */
.section-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 18px;
    color: var(--primary);
    margin: 40px 0 20px;
    padding-left: 20px;
    border-left: 3px solid var(--secondary);
}

.section-label {
    font-family: 'Orbitron', sans-serif;
    font-size: 13px;
    color: var(--primary);
    margin-bottom: 15px;
    padding-left: 15px;
    border-left: 3px solid var(--secondary);
}

/* ==================== TABS ==================== */
.tabs {
    display: flex;
    gap: 0;
    margin-bottom: 25px;
    border-bottom: 2px solid rgba(0, 255, 200, 0.15);
}

.tab {
    padding: 12px 24px;
    font-family: 'Orbitron', sans-serif;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    border: none;
    background: none;
    transition: all 0.3s;
    letter-spacing: 1px;
    position: relative;
}
.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); }
.tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0; right: 0;
    height: 2px;
    background: var(--primary);
    box-shadow: 0 0 10px var(--primary);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ==================== LANG TOGGLE ==================== */
.lang-toggle {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
}

.lang-btn {
    padding: 8px 20px;
    font-family: 'Orbitron', sans-serif;
    font-size: 12px;
    border: 1px solid rgba(0, 255, 200, 0.3);
    background: transparent;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    transition: all 0.3s;
    letter-spacing: 2px;
}
.lang-btn:first-child { border-radius: 4px 0 0 4px; }
.lang-btn:last-child { border-radius: 0 4px 4px 0; }
.lang-btn.active {
    background: rgba(0, 255, 200, 0.15);
    border-color: var(--primary);
    color: var(--primary);
}

/* ==================== UTILITY CLASSES ==================== */
/* Замена inline-стилей для CSP style-src без unsafe-inline */

.hidden { display: none !important; }
.text-center { text-align: center; }
.no-decoration { text-decoration: none; }
.w-full { width: 100%; }
.gap-15 { gap: 15px; }

/* Colors */
.text-primary { color: var(--primary); }
.text-secondary { color: var(--secondary); }
.text-warning { color: var(--warning); }
.text-success { color: var(--success); }
.text-mastery { color: var(--mastery); }
.text-stable { color: var(--stable); }
.text-learning { color: var(--learning); }
.text-weak { color: var(--weak); }
.text-unknown { color: var(--unknown); }
.text-muted { color: rgba(255, 255, 255, 0.5); }
.text-muted-dark { color: rgba(255, 255, 255, 0.4); }
.text-info-blue { color: #00aaff; }
.text-info-orange { color: #ff8800; }

/* Margins */
.mb-0  { margin-bottom: 0; }
.mb-10 { margin-bottom: 10px; }
.mb-15 { margin-bottom: 15px; }
.mb-20 { margin-bottom: 20px; }
.mb-30 { margin-bottom: 30px; }
.mt-15 { margin-top: 15px; }
.mt-20 { margin-top: 20px; }
.mt-30 { margin-top: 30px; }

/* Modal/Form hints */
.modal-hint {
    text-align: center;
    margin-top: 20px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
}
.modal-code-hint {
    text-align: center;
    margin-bottom: 20px;
    color: rgba(255, 255, 255, 0.5);
}

/* Purchase modal */
.purchase-name {
    text-align: center;
    margin-bottom: 15px;
    color: var(--primary);
}
.purchase-price {
    text-align: center;
    margin-bottom: 30px;
    font-size: 32px;
    color: var(--warning);
}

/* Title variants */
.title-sm { font-size: 24px; }

/* Inline flex row */
.flex-row {
    display: flex;
    align-items: center;
}

