/* DOFAI DESIGN SYSTEM: Obsidian Flow / LiquidGlass */

:root {
    /* TRINITY PALETTE */
    --color-void: #050505;
    --color-ghost: #F2F2F2;
    --color-neon: #6366F1;

    /* OPACITY LAYERS for Ghost White */
    --text-primary: rgba(242, 242, 242, 0.9);
    /* Headers */
    --text-secondary: rgba(242, 242, 242, 0.6);
    /* Body */
    --text-tertiary: rgba(242, 242, 242, 0.4);
    /* Meta */
    --border-color: rgba(242, 242, 242, 0.1);
    /* Borders */

    /* PHYSICS CURVES */
    --curve-spring: cubic-bezier(0.25, 0.8, 0.25, 1);
    --curve-bouncy: cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* FONT IMPORT */
@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500&display=swap');
/* Using Fira Code as fallback/proxy for 'Google Sans Code' if available, or just monospace feel */

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

body {
    background-color: var(--color-void);
    color: var(--text-primary);
    font-family: 'Google Sans Code', 'Fira Code', 'JetBrains Mono', monospace;
    font-size: 14px;
    letter-spacing: -0.02em;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;

    /* GRID BACKGROUND */
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 40px 40px;
}

/* AMBIENT GLOW (Z-Index -1) */
.ambient-glow {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80vw;
    height: 80vw;
    background: var(--color-neon);
    filter: blur(120px);
    opacity: 0.15;
    z-index: -1;
    pointer-events: none;
}

/* ACCENT LINE */
.accent-line-left {
    position: fixed;
    left: 20px;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--color-ghost);
    opacity: 0.05;
    z-index: -1;
}

/* APP CONTAINER */
.app-container {
    padding: 24px;
    max-width: 100%;
    /* Mobile First: Safe Area handling if needed */
    padding-bottom: 80px;
    /* Space for bottom interaction */
}

/* GLASSMORPHISM CARD RECIPE */
.dofai-glass {
    background: rgba(5, 5, 5, 0.65);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
    border-radius: 20px;
    transition: transform 0.3s var(--curve-bouncy),
        box-shadow 0.3s var(--curve-bouncy),
        border-color 0.3s var(--curve-spring);
}

/* HEADER */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding: 0 4px;
}

h1 {
    font-weight: 500;
    font-size: 20px;
    color: var(--text-primary);
}

.neon-dot {
    color: var(--color-neon);
}

.status-badge {
    font-size: 12px;
    color: var(--text-tertiary);
    border: 1px solid var(--border-color);
    padding: 4px 10px;
    border-radius: 12px;
    background: rgba(5, 5, 5, 0.3);
}

/* NAVIGATION */
nav {
    display: flex;
    margin-bottom: 24px;
    background: rgba(5, 5, 5, 0.3);
    border-radius: 16px;
    padding: 4px;
    border: 1px solid var(--border-color);
}

.nav-btn {
    flex: 1;
    background: transparent;
    border: none;
    padding: 12px;
    color: var(--text-tertiary);
    font-family: inherit;
    font-size: 14px;
    border-radius: 12px;
    position: relative;
    transition: all 0.4s var(--curve-spring);
}

.nav-btn.active {
    color: var(--color-neon);
    background: rgba(99, 102, 241, 0.1);
    font-weight: 500;
}

.tab-content {
    display: none;
}

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


.card {
    padding: 24px;
    margin-bottom: 16px;
    position: relative;
    overflow: hidden;
}

/* Hover State (Desktop or touch start) */
.card:active,
.stat-box:active {
    transform: scale(0.98);
    /* Less drastic than 0.96 for cards */
}

/* TEXTY */
.label {
    font-size: 12px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 12px;
    display: block;
}

.big-value {
    font-size: 48px;
    font-weight: 400;
    /* Regular per spec */
    color: var(--text-primary);
    margin-bottom: 4px;
    letter-spacing: -2px;
}

.sub-value {
    font-size: 14px;
    color: var(--text-secondary);
    transition: color 0.4s var(--curve-spring);
}

.stat-val {
    transition: color 0.4s var(--curve-spring);
}

.big-value {
    transition: color 0.4s var(--curve-spring);
}

.profit-pos {
    color: #4ADE80;
}

/* Keep green for profit positive logic */
.profit-neg {
    color: #EF4444;
}

/* STATS GRID */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 24px;
}

.stat-box {
    padding: 20px;
    text-align: center;
}

.stat-val {
    font-size: 20px;
    color: var(--text-primary);
    margin-top: 4px;
}

/* BUTTONS */
.main-btn {
    width: 100%;
    padding: 22px;
    border: none;
    border-radius: 20px;
    background: var(--color-neon);
    color: #fff;
    font-family: inherit;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 0 30px rgba(99, 102, 241, 0.3);
    transition: transform 0.1s var(--curve-spring), box-shadow 0.3s;
    margin-top: 12px;
}

/* Tap State Logic */
.main-btn:active {
    transform: scale(0.96);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.2);
}

.main-btn.stop {
    background: #111;
    border: 1px solid #ef4444;
    color: #ef4444;
    box-shadow: none;
}

.status-text {
    text-align: center;
    margin-top: 16px;
    font-size: 12px;
    color: var(--text-tertiary);
}

/* SETTINGS INPUTS */
.input-row {
    margin-bottom: 24px;
}

input[type="number"] {
    width: 100%;
    background: rgba(5, 5, 5, 0.5);
    border: 1px solid var(--border-color);
    padding: 16px;
    border-radius: 12px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 16px;
    outline: none;
    transition: border-color 0.3s;
    appearance: textfield;
    -moz-appearance: textfield;
}

/* Hide Spin Buttons */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"]:focus {
    border-color: var(--color-neon);
}

/* Slider Customization */
input[type=range] {
    -webkit-appearance: none;
    width: 100%;
    background: transparent;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 20px;
    width: 20px;
    border-radius: 50%;
    background: var(--color-neon);
    cursor: pointer;
    margin-top: -8px;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
}

input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: var(--border-color);
    border-radius: 2px;
}

/* TOGGLE SWITCH */
.switch-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(5, 5, 5, 0.3);
    padding: 16px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.toggle {
    position: relative;
    width: 44px;
    height: 24px;
}

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #333;
    transition: 0.4s var(--curve-spring);
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.4s var(--curve-spring);
    border-radius: 50%;
}

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

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

.save-btn {
    width: 100%;
    padding: 18px;
    background: transparent;
    border: 1px solid var(--color-neon);
    color: var(--color-neon);
    border-radius: 16px;
    font-family: inherit;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 24px;
    margin-bottom: 40px;
}

.save-btn:active {
    background: rgba(99, 102, 241, 0.1);
    transform: scale(0.98);
}

/* SYNC ANIMATIONS */
.main-btn {
    transition: transform 0.2s var(--curve-bouncy);
}