/* ===== Base Reset & Background ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

.hidden { display: none !important; }

body {
    min-height: 100vh;
    font-family: 'Inter', 'Segoe UI', sans-serif;
    color: #e2e8f0;
    background: #0a0a1a;
    overflow-x: hidden;
}

.bg-animated { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.bg-gradient {
    position: absolute; inset: 0;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(139, 92, 246, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(99, 102, 241, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(236, 72, 153, 0.08) 0%, transparent 50%);
}

/* ===== App Container ===== */
.app-container {
    position: relative; z-index: 1;
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; padding: 24px;
}

.glass-card {
    background: rgba(15, 15, 35, 0.75);
    -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 80px rgba(139, 92, 246, 0.06);
}

.app-card { width: 100%; max-width: 440px; padding: 32px; text-align: center; }

/* ===== Header ===== */
.app-header { margin-bottom: 24px; }
.app-icon { font-size: 36px; color: #8b5cf6; margin-bottom: 12px; }
.app-title { font-size: 22px; font-weight: 700; color: #fff; margin-bottom: 6px; }
.app-subtitle { font-size: 13px; color: #94a3b8; }

/* ===== Mode Tabs ===== */
.mode-tabs {
    display: flex; gap: 8px; margin-bottom: 28px; justify-content: center;
}

.mode-tab {
    padding: 10px 18px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(139, 92, 246, 0.15);
    border-radius: 10px;
    color: #94a3b8;
    font-size: 13px; font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    display: flex; align-items: center; gap: 6px;
}

.mode-tab:hover { background: rgba(139, 92, 246, 0.1); color: #e2e8f0; }

.mode-tab.active {
    background: rgba(139, 92, 246, 0.2);
    border-color: rgba(139, 92, 246, 0.4);
    color: #a78bfa;
}

.mode-tab.active[data-mode="work"] { background: rgba(139, 92, 246, 0.2); border-color: rgba(139, 92, 246, 0.4); color: #a78bfa; }
.mode-tab.active[data-mode="short"] { background: rgba(52, 211, 153, 0.15); border-color: rgba(52, 211, 153, 0.4); color: #34d399; }
.mode-tab.active[data-mode="long"] { background: rgba(59, 130, 246, 0.15); border-color: rgba(59, 130, 246, 0.4); color: #60a5fa; }

/* ===== Timer Display ===== */
.timer-display {
    display: flex; justify-content: center; margin-bottom: 28px;
}

/* ===== Custom Time Settings ===== */
.time-settings {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.time-setting {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.time-setting-label {
    font-size: 11px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.time-input-group {
    display: flex;
    align-items: center;
    gap: 0;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 10px;
    overflow: hidden;
}

.time-btn {
    width: 32px;
    height: 36px;
    background: rgba(139, 92, 246, 0.1);
    border: none;
    color: #a78bfa;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
}

.time-btn:hover {
    background: rgba(139, 92, 246, 0.25);
    color: #c4b5fd;
}

.time-input {
    width: 44px;
    height: 36px;
    background: transparent;
    border: none;
    color: #e2e8f0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    outline: none;
    -moz-appearance: textfield;
    appearance: textfield;
}

.time-input::-webkit-outer-spin-button,
.time-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.time-unit {
    font-size: 10px;
    color: #475569;
    font-weight: 500;
}

.timer-ring { position: relative; width: 220px; height: 220px; }

.timer-svg { width: 100%; height: 100%; transform: rotate(-90deg); }

.timer-bg-circle {
    fill: none;
    stroke: rgba(139, 92, 246, 0.1);
    stroke-width: 6;
}

.timer-progress-circle {
    fill: none;
    stroke: #8b5cf6;
    stroke-width: 6;
    stroke-linecap: round;
    stroke-dasharray: 565.48;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear, stroke 0.3s ease;
}

.timer-text {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.timer-time {
    font-size: 48px;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    color: #fff;
    letter-spacing: 2px;
}

.timer-label {
    font-size: 13px;
    color: #94a3b8;
    margin-top: 4px;
    font-weight: 500;
}

/* ===== Controls ===== */
.timer-controls {
    display: flex; gap: 12px; justify-content: center; margin-bottom: 24px;
}

.btn-control {
    padding: 12px 28px;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    font-family: inherit;
}

.btn-start {
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    color: #fff;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.btn-start:hover { transform: translateY(-2px); box-shadow: 0 6px 25px rgba(139, 92, 246, 0.45); }

.btn-pause {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

.btn-pause:hover { transform: translateY(-2px); }

.btn-reset {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #94a3b8;
}

.btn-reset:hover { background: rgba(255, 255, 255, 0.1); color: #e2e8f0; }

/* ===== Session Stats ===== */
.session-stats {
    display: flex; gap: 20px; justify-content: center;
    padding-top: 20px;
    border-top: 1px solid rgba(139, 92, 246, 0.1);
}

.stat-item { text-align: center; }

.stat-value {
    display: block;
    font-size: 20px;
    font-weight: 700;
    color: #a78bfa;
    font-family: 'JetBrains Mono', monospace;
}

.stat-label {
    font-size: 11px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== Floating Overlay Panel ===== */
.overlay-panel {
    position: fixed; bottom: 24px; right: 24px; z-index: 1000;
    background: rgba(15, 15, 35, 0.85);
    -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
    border: 1px solid rgba(139, 92, 246, 0.25);
    border-radius: 16px; padding: 20px;
    min-width: 260px; max-width: 320px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 60px rgba(139, 92, 246, 0.1);
    font-family: 'Inter', 'Segoe UI', sans-serif;
    color: #e2e8f0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}
.overlay-panel.collapsed { transform: translateY(calc(100% - 48px)); }
.overlay-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.overlay-title { font-size: 15px; font-weight: 700; color: #fff; display: flex; align-items: center; gap: 8px; }
.overlay-title .icon-3d { color: #8b5cf6; font-size: 18px; }
.overlay-toggle { background: rgba(139, 92, 246, 0.15); border: 1px solid rgba(139, 92, 246, 0.3); border-radius: 8px; color: #a78bfa; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.2s; font-size: 12px; }
.overlay-toggle:hover { background: rgba(139, 92, 246, 0.3); }
.overlay-body { display: flex; flex-direction: column; gap: 10px; }
.overlay-desc { font-size: 12px; color: #94a3b8; line-height: 1.5; }
.overlay-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border-radius: 10px; font-size: 13px; font-weight: 600; text-decoration: none; cursor: pointer; transition: all 0.3s ease; border: none; font-family: inherit; }
.btn-back { background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.1); color: #94a3b8; }
.btn-back:hover { background: rgba(255, 255, 255, 0.1); color: #e2e8f0; transform: translateX(-2px); }
.btn-source { background: linear-gradient(135deg, #8b5cf6, #6366f1); color: #fff; box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3); }
.btn-source:hover { transform: translateY(-2px); box-shadow: 0 6px 25px rgba(139, 92, 246, 0.45); }
.open-source-badge { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 8px; font-size: 12px; font-weight: 600; color: #34d399; background: rgba(52, 211, 153, 0.1); border: 1px solid rgba(52, 211, 153, 0.3); }
.overlay-desc .accent-text { color: #a78bfa; }

/* ===== Source Code Viewer ===== */
.source-viewer { position: fixed; inset: 0; z-index: 3000; background: rgba(10, 10, 26, 0.98); display: flex; flex-direction: column; opacity: 0; visibility: hidden; transition: all 0.3s ease; }
.source-viewer.active { opacity: 1; visibility: visible; }
.source-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 24px; background: rgba(15, 15, 35, 0.95); border-bottom: 1px solid rgba(139, 92, 246, 0.2); }
.source-header-left { display: flex; align-items: center; gap: 12px; }
.source-filename { font-family: 'JetBrains Mono', monospace; font-size: 13px; color: #a78bfa; font-weight: 600; }
.source-badge { background: rgba(52, 211, 153, 0.15); border: 1px solid rgba(52, 211, 153, 0.3); border-radius: 6px; padding: 2px 8px; font-size: 11px; color: #34d399; font-weight: 600; }
.source-header-right { display: flex; align-items: center; gap: 8px; }
.btn-copy-source, .btn-close-source { background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 8px; color: #94a3b8; padding: 8px 14px; font-size: 12px; font-weight: 500; cursor: pointer; transition: all 0.2s; display: flex; align-items: center; gap: 6px; font-family: inherit; }
.btn-copy-source:hover, .btn-close-source:hover { background: rgba(255, 255, 255, 0.1); color: #e2e8f0; }
.source-body { flex: 1; overflow: auto; padding: 0; }
.source-body pre { margin: 0; padding: 24px; font-size: 13px; line-height: 1.6; }
.source-body code { font-family: 'JetBrains Mono', monospace; }

/* ===== Responsive ===== */
@media (max-width: 600px) {
    .app-card { padding: 20px; }
    .mode-tabs { flex-wrap: wrap; }
    .mode-tab { padding: 8px 14px; font-size: 12px; }
    .timer-ring { width: 180px; height: 180px; }
    .timer-time { font-size: 36px; }
    .overlay-panel { bottom: 12px; right: 12px; left: 12px; min-width: unset; max-width: unset; }
    .source-header { padding: 12px 16px; flex-wrap: wrap; gap: 8px; }
    .source-body pre { padding: 16px; font-size: 11px; }
}
