/* Slotly — Shared UI Components
   Единые стили для всех страниц */

img { max-width: 100%; height: auto; }

/* === LIGHT THEME === */
@media (prefers-color-scheme: light) {
    :root.auto-theme {
        --bg-primary: #f5f5f7;
        --bg-secondary: #ffffff;
        --card-bg: #ffffff;
        --text-primary: #1a1a2e;
        --text-secondary: #666;
        --text-tertiary: #999;
        --border-glass: rgba(0,0,0,0.08);
        --accent: #6C5CE7;
    }
}

/* Manual light theme toggle */
:root[data-theme="light"] {
    --bg-primary: #f5f5f7;
    --bg-secondary: #ffffff;
    --bg-card: rgba(0,0,0,0.02);
    --card-bg: #ffffff;
    --text-primary: #1a1a2e;
    --text-secondary: #555;
    --text-tertiary: #888;
    --bg-glass: rgba(0,0,0,0.03);
    --border-glass: rgba(0,0,0,0.08);
    --text-muted: rgba(0,0,0,0.45);
    --bg-tertiary: #f0f0f2;
    --shadow-card: 0 1px 3px rgba(0,0,0,0.08);
    --accent: #6C5CE7;
    --neon-purple: #7c3aed;
    --neon-blue: #2563eb;
    --neon-green: #059669;
    --gradient-primary: linear-gradient(135deg, #6C5CE7, #a78bfa);
    --gradient-neon: linear-gradient(135deg, #6C5CE7, #818cf8);
    --glow-purple: 0 0 0 transparent;
    --glow-blue: 0 0 0 transparent;
    --glow-cyan: 0 0 0 transparent;
}
:root[data-theme="light"] body {
    background: var(--bg-primary) !important;
    color: var(--text-primary) !important;
}
:root[data-theme="light"] .screen,
:root[data-theme="light"] .card,
:root[data-theme="light"] .modal-content {
    background: var(--card-bg);
}
:root[data-theme="light"] .profile-header,
:root[data-theme="light"] .screen-header {
    background: #ffffff;
    border-bottom: 1px solid rgba(0,0,0,0.06);
}
:root[data-theme="light"] #bottom-nav {
    background: #ffffff;
    border-top: 1px solid rgba(0,0,0,0.06);
}

/* === BUTTONS === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--accent, #6C5CE7);
    color: #fff;
}
.btn-primary:hover:not(:disabled) {
    background: #5a4bd5;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(108, 92, 231, 0.3);
}

.btn-outline {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.15);
    color: var(--text-primary, #fff);
}
.btn-outline:hover:not(:disabled) {
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.25);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}
.btn-danger:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.25);
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 8px;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-secondary, #888);
}
.btn-icon:hover {
    background: rgba(255,255,255,0.06);
    color: var(--text-primary, #fff);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 12px;
    border-radius: 8px;
}

.btn-full {
    width: 100%;
}

/* === CARDS === */
.card {
    background: var(--card-bg, rgba(255,255,255,0.04));
    border: 1px solid var(--border-glass, rgba(255,255,255,0.06));
    border-radius: 14px;
    padding: 16px;
}

/* === INPUTS === */
.input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.1);
    background: var(--bg-secondary, rgba(255,255,255,0.04));
    color: var(--text-primary, #fff);
    font-size: 14px;
    transition: border-color 0.2s;
}
.input:focus {
    outline: none;
    border-color: var(--accent, #6C5CE7);
}
.input::placeholder {
    color: var(--text-tertiary, #555);
}

/* === MODAL === */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.modal-card {
    background: var(--card-bg, #1e1e2e);
    border-radius: 16px;
    padding: 24px;
    width: 100%;
    max-width: 420px;
    max-height: 85vh;
    overflow-y: auto;
}

/* === BADGE === */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    background: var(--accent, #6C5CE7);
    color: #fff;
}
.badge-success { background: #10b981; }
.badge-warning { background: #f59e0b; color: #000; }
.badge-danger { background: #ef4444; }

/* === TABS === */
.tab-group {
    display: flex;
    gap: 4px;
}
.tab-btn {
    padding: 6px 14px;
    font-size: 13px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.08);
    background: transparent;
    color: var(--text-secondary, #888);
    cursor: pointer;
    transition: all 0.2s;
}
.tab-btn:hover {
    background: rgba(255,255,255,0.06);
    color: #ccc;
}
.tab-btn.active {
    background: rgba(108, 92, 231, 0.15);
    color: var(--accent, #6C5CE7);
    border-color: rgba(108, 92, 231, 0.3);
    font-weight: 500;
}

/* === EMPTY STATE === */
.empty-state {
    text-align: center;
    padding: 40px 20px;
}
.empty-state .empty-icon {
    font-size: 48px;
    color: var(--text-tertiary, #555);
    margin-bottom: 12px;
}
.empty-state .empty-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary, #fff);
    margin-bottom: 6px;
}
.empty-state .empty-text {
    font-size: 14px;
    color: var(--text-secondary, #888);
}

/* === TOAST === */
.toast {
    position: fixed;
    bottom: calc(80px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 14px;
    z-index: 99999;
    animation: toastIn 0.3s ease;
    max-width: 90%;
    text-align: center;
}

/* === SKELETON === */
.skeleton {
    background: rgba(255,255,255,0.06);
    border-radius: 10px;
    position: relative;
    overflow: hidden;
}
.skeleton::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.06), transparent);
    animation: shimmer 1.5s infinite;
}
@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}
.skeleton-card {
    height: 80px;
    margin-bottom: 8px;
    border-radius: 12px;
}
.skeleton-line {
    height: 14px;
    margin-bottom: 8px;
    border-radius: 6px;
    width: 60%;
}

/* === LIGHT THEME: Component Overrides === */
:root[data-theme="light"] .btn-outline {
    border-color: rgba(0,0,0,0.15);
    color: var(--text-primary);
}
:root[data-theme="light"] .btn-outline:hover {
    background: rgba(0,0,0,0.04);
    border-color: rgba(0,0,0,0.2);
}
:root[data-theme="light"] .btn-icon {
    border-color: rgba(0,0,0,0.1);
}
:root[data-theme="light"] .btn-icon:hover {
    background: rgba(0,0,0,0.04);
}
:root[data-theme="light"] .card {
    background: #ffffff;
    border-color: rgba(0,0,0,0.08);
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
:root[data-theme="light"] .input,
:root[data-theme="light"] input,
:root[data-theme="light"] select,
:root[data-theme="light"] textarea {
    border-color: rgba(0,0,0,0.15);
    background: #ffffff;
    color: var(--text-primary);
}
:root[data-theme="light"] .tab-btn {
    border-color: rgba(0,0,0,0.08);
}
:root[data-theme="light"] .tab-btn:hover {
    background: rgba(0,0,0,0.04);
}
:root[data-theme="light"] .skeleton {
    background: rgba(0,0,0,0.06);
}
:root[data-theme="light"] .toast {
    background: #1a1a2e;
    color: #fff;
}

/* Skip link */
.skip-link:focus { top: 0; }
