:root {
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.1);
    --success: #10b981;
    --danger: #ef4444;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* Telegram theme variables if available */
body.tg-theme {
    --bg-color: var(--tg-theme-bg-color, #0f172a);
    --card-bg: var(--tg-theme-secondary-bg-color, rgba(30, 41, 59, 0.7));
    --primary: var(--tg-theme-button-color, #3b82f6);
    --text-main: var(--tg-theme-text-color, #f8fafc);
    --text-muted: var(--tg-theme-hint-color, #94a3b8);
}

.page {
    display: none;
    padding: 20px;
    min-height: 100vh;
    animation: fadeIn 0.3s ease;
}

.page.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

header {
    margin-bottom: 24px;
}

.header-content h1 {
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(135deg, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-content p {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 4px;
}

.sub-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.back-btn {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    padding: 8px 0;
}

.sub-header h2 {
    font-size: 20px;
}

.glass-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.mb-4 { margin-bottom: 16px; }
.mt-4 { margin-top: 16px; }
.mt-3 { margin-top: 12px; }
.mt-2 { margin-top: 8px; }
.p-0 { padding: 0; }
.p-3 { padding: 16px; }
.w-100 { width: 100%; }
.text-center { text-align: center; }
.border-bottom { border-bottom: 1px solid var(--border); }

/* Toggles */
.toggle-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.toggle-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toggle-info .icon {
    font-size: 24px;
}

.toggle-info h3 {
    font-size: 16px;
    font-weight: 600;
}

.toggle-info p {
    font-size: 13px;
    color: var(--text-muted);
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(255,255,255,0.1);
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--success);
}

input:checked + .slider:before {
    transform: translateX(22px);
}

.small-switch {
    width: 40px;
    height: 22px;
}
.small-switch .slider:before {
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
}
.small-switch input:checked + .slider:before {
    transform: translateX(18px);
}

/* Grid */
.section-title {
    font-size: 18px;
    font-weight: 600;
    margin: 24px 0 16px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.grid-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.module-card {
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    display: flex;
    flex-direction: column;
}

.module-card:active {
    transform: scale(0.97);
    background: rgba(255,255,255,0.1);
}

.module-card.full-width {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: center;
    gap: 16px;
}

.module-card.full-width .module-header {
    margin-bottom: 0;
}

.module-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.module-header .icon {
    font-size: 24px;
}

.module-status {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--danger);
}

.module-status.active {
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.module-card h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
}

.module-card p {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Blockquote */
.blockquote {
    background: rgba(59, 130, 246, 0.1);
    border-left: 4px solid var(--primary);
    padding: 12px 16px;
    border-radius: 0 8px 8px 0;
    font-size: 14px;
    color: var(--text-main);
}
.blockquote.warning {
    background: rgba(239, 68, 68, 0.1);
    border-left-color: var(--danger);
}
.blockquote p {
    margin-bottom: 8px;
}
.blockquote p:last-child {
    margin-bottom: 0;
}

/* Forms */
textarea, input[type="text"], input[type="number"] {
    width: 100%;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}

textarea:focus, input[type="text"]:focus, input[type="number"]:focus {
    border-color: var(--primary);
}

.btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn:active {
    background: var(--primary-hover);
}

.input-group label {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

/* Radio buttons */
.radio-group {
    display: flex;
    flex-direction: column;
}

.radio-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
}

.radio-label input {
    display: none;
}

.custom-radio {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-radius: 50%;
    margin-right: 12px;
    position: relative;
    transition: border-color 0.2s;
}

.custom-radio::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 10px;
    height: 10px;
    background: var(--primary);
    border-radius: 50%;
    transition: transform 0.2s;
}

.radio-label input:checked + .custom-radio {
    border-color: var(--primary);
}

.radio-label input:checked + .custom-radio::after {
    transform: translate(-50%, -50%) scale(1);
}

/* List group */
.list-group {
    list-style: none;
}

.list-item {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.list-item:last-child {
    border-bottom: none;
}

.remove-btn {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

/* Loader */
.loader-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--bg-color);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.3s;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255,255,255,0.1);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s ease-in-out infinite;
}

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

/* Toast */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--success);
    color: white;
    padding: 12px 24px;
    border-radius: 30px;
    font-weight: 500;
    font-size: 14px;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 2000;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}
