/**
 * ChronoTherapy Pro - Styles
 * Cosmic precision aesthetic with mobile optimization
 */

/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'SF Mono', 'Monaco', 'Consolas', 'Courier New', monospace;
    background: linear-gradient(180deg, #1A1D23 0%, #0F1115 100%);
    min-height: 100vh;
    color: #9CA3AF;
    overflow-x: hidden;
    touch-action: manipulation;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===== CONTAINER ===== */
.app-container {
    max-width: 420px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
    z-index: 10;
}

/* ===== HEADER ===== */
.app-header {
    text-align: center;
    padding-bottom: 12px;
    border-bottom: 1px solid #2D2A27;
    margin-bottom: 8px;
    position: relative;
}

.header-content {
    text-align: center;
}

/* App Title Wrapper */
.app-title-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.app-logo {
    font-size: 28px;
    color: #D4A574;
    display: none; /* Hidden by default, shown in mini mode */
}

.app-title-text {
    display: flex;
    flex-direction: column;
}

.app-title {
    font-size: 24px;
    font-weight: 400;
    letter-spacing: 6px;
    color: #D4A574;
    margin-bottom: 4px;
}

.app-subtitle {
    font-size: 10px;
    letter-spacing: 3px;
    color: #6B7280;
    font-weight: 300;
}

.connection-status {
    margin-top: 8px;
    font-size: 9px;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.status-indicator {
    width: 6px;
    height: 6px;
    background: #4B5563;
    border-radius: 50%;
    transition: all 0.3s;
}

.status-indicator.active {
    background: #00D9B1;
    box-shadow: 0 0 8px rgba(0, 217, 177, 0.5);
    animation: pulse-indicator 2s ease-in-out infinite;
}

@keyframes pulse-indicator {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ===== FREQUENCY DISPLAY ===== */
.frequency-card {
    padding: 32px 24px;
    text-align: center;
    position: relative;
    overflow: visible;
}

.frequency-value {
    font-size: 64px;
    font-weight: bold;
    color: #FFFFFF;
    line-height: 1;
    margin-bottom: 8px;
    letter-spacing: -2px;
    position: relative;
    z-index: 1;
    text-shadow: 0 0 40px rgba(255, 255, 255, 0.3);
}

.frequency-card.playing .frequency-value {
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% {
        text-shadow: 0 0 40px rgba(255, 255, 255, 0.3);
    }
    50% {
        text-shadow: 0 0 60px rgba(255, 255, 255, 0.5),
                     0 0 80px rgba(255, 255, 255, 0.3);
    }
}

.frequency-type {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 8px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #4B5563;
    border-radius: 50%;
    transition: all 0.3s;
}

.status-dot.playing {
    background: #C9A571;
    box-shadow: 0 0 12px rgba(201, 165, 113, 0.5);
}

.brainwave-label {
    font-size: 13px;
    letter-spacing: 2px;
    color: #9CA3AF;
}

.frequency-correction {
    font-size: 10px;
    color: #6B7280;
    margin-top: 4px;
}

#offsetValue {
    color: #D4A574;
    font-weight: 600;
}

/* ===== PLAY BUTTON ===== */
.play-button {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 16px auto;
    transition: all 0.3s;
}

.play-button:hover {
    transform: scale(1.05);
}

.play-button:active {
    transform: scale(0.95);
}

.play-icon {
    width: 0;
    height: 0;
    border-left: 40px solid #FFFFFF;
    border-top: 24px solid transparent;
    border-bottom: 24px solid transparent;
}

.pause-icon {
    display: none;
    gap: 10px;
}

.pause-bar {
    width: 10px;
    height: 48px;
    background: #FFFFFF;
    border-radius: 2px;
}

/* ===== CARDS ===== */
.card {
    background: rgba(45, 42, 39, 0.3);
    border: 1px solid #3A3733;
    border-radius: 12px;
    padding: 16px;
    transition: all 0.3s;
}

.card:hover {
    border-color: #4A4743;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1px;
    color: #B8C5D6;
}

.card-icon {
    font-size: 18px;
    margin-right: 8px;
}

.card-title {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1px;
    color: #D4A574;
    margin-bottom: 12px;
}

/* ===== GRID DETECTION CARD ===== */
.grid-detection-card {
    background: rgba(45, 42, 39, 0.4);
}

.grid-value {
    color: #C9A571;
    font-weight: bold;
    font-size: 13px;
}

.detection-status {
    font-size: 11px;
    margin-top: 8px;
    color: #6B7280;
    line-height: 1.5;
}

.vector-display {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #2D2A27;
}

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

.vector-label {
    display: block;
    font-size: 9px;
    color: #6B7280;
    margin-bottom: 4px;
    letter-spacing: 1px;
}

.vector-value {
    display: block;
    font-size: 13px;
    color: #D4A574;
    font-weight: 600;
}

.alignment-indicator {
    margin-top: 12px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
}

.alignment-bar {
    width: 0%;
    height: 4px;
    background: #FF4757;
    border-radius: 2px;
    transition: all 0.5s;
    margin-bottom: 8px;
}

.alignment-text {
    font-size: 10px;
    color: #FF4757;
    text-align: center;
    transition: color 0.3s;
}

/* ===== FLASHLIGHT CARD ===== */
.flashlight-card {
    border-color: rgba(255, 182, 39, 0.2);
}

.flashlight-info {
    font-size: 11px;
    color: #9CA3AF;
    line-height: 1.4;
}

.flashlight-status {
    margin-top: 8px;
    font-size: 12px;
    color: #FFB627;
}

.flashlight-toggle-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid rgba(58, 55, 51, 0.3);
}

/* Gold toggle switch for flashlight */
.toggle-switch.gold-toggle {
    width: 52px;
    height: 28px;
}

.toggle-switch.gold-toggle.active {
    background: linear-gradient(135deg, #D4A574 0%, #C9A571 100%);
    box-shadow: 0 0 8px rgba(212, 165, 116, 0.3);
}

.toggle-switch.gold-toggle .toggle-slider {
    width: 22px;
    height: 22px;
    background: #F5F5F5;
    border-radius: 50%;
    position: absolute;
    top: 3px;
    left: 3px;
    transition: 0.3s;
}

.toggle-switch.gold-toggle.active .toggle-slider {
    transform: translateX(24px);
    background: #FFFFFF;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* ===== TOGGLE SWITCH ===== */
.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    background: rgba(58, 55, 51, 0.3);
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.3s;
}

.toggle-switch.active {
    background: #C9A571;
}

.toggle-slider {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: #FFFFFF;
    border-radius: 50%;
    transition: transform 0.3s;
}

.toggle-switch.active .toggle-slider {
    transform: translateX(20px);
}

/* ===== LUNAR CARD ===== */
.lunar-card {
    background: rgba(45, 42, 39, 0.4);
    border-color: rgba(58, 55, 51, 0.3);
}

.lunar-header {
    display: flex;
    align-items: center;
    gap: 16px;
}

.moon-emoji {
    font-size: 36px;
}

.lunar-info {
    flex: 1;
}

.lunar-phase {
    font-size: 14px;
    font-weight: 500;
    color: #B8C5D6;
    margin-bottom: 4px;
}

.lunar-distance {
    font-size: 11px;
    color: #6B7280;
}

.lunar-risk {
    text-align: right;
}

.risk-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1px;
}

/* ===== DASHBOARD GRID LAYOUT ===== */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.dashboard-left {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.dashboard-right {
    display: none; /* Hide combined card on mobile */
}

.combined-chip {
    min-height: 500px !important;
    display: flex;
    flex-direction: column;
}

.combined-chip .card-header {
    margin-bottom: 0;
}

.combined-chip .stat-value {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #D4A574;
    font-size: 10px;
    font-weight: 600;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(212, 165, 116, 0.15);
}

.section-title i {
    font-size: 11px;
}

.protocol-section,
.purpose-section {
    margin-bottom: 16px;
}

/* Desktop: Two-column layout */
@media (min-width: 769px) {
    /* Widen container for two-column layout */
    .app-container {
        max-width: 90%;
        padding: 40px;
    }

    .dashboard-grid {
        grid-template-columns: 1fr 1fr;
        gap: 16px;
    }

    .dashboard-left {
        grid-column: 1;
    }

    .dashboard-right {
        display: flex; /* Show on desktop */
        grid-column: 2;
        grid-row: 1 / 3;
    }

    .combined-chip {
        min-height: 100% !important;
        max-height: none !important;
    }

    .dashboard-frequency {
        min-height: auto;
    }
}

/* Legacy quick-stats (deprecated, kept for compatibility) */
.quick-stats {
    display: none;
}

.stat-chip {
    flex: 1;
    background: rgba(26, 29, 35, 0.6);
    border: 1px solid #3A3733;
    border-radius: 10px;
    padding: 10px;
    text-align: center;
    transition: all 0.3s;
    min-height: 70px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stat-chip.clickable {
    cursor: pointer;
}

.stat-chip.clickable:hover {
    background: rgba(26, 29, 35, 0.8);
    border-color: #D4A574;
    transform: translateY(-2px);
}

.stat-label {
    font-size: 9px;
    color: #6B7280;
    margin-bottom: 6px;
    letter-spacing: 1px;
}

.stat-value {
    font-size: 13px;
    font-weight: 600;
    color: #D4A574;
    line-height: 1.3;
}

.stat-value strong {
    color: #9CA3AF;
    font-weight: 500;
}

/* ===== ENHANCED STAT CHIPS - PROTOCOL & PURPOSE ===== */

/* Protocol Header */
.protocol-header,
.purpose-header {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #D4A574;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1px;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(212, 165, 116, 0.2);
}

.protocol-header i,
.purpose-header i {
    font-size: 12px;
}

/* Day Calendar View */
.day-calendar {
    display: flex;
    width: 100%;
    height: 50px;
    margin: 8px 0;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid rgba(212, 165, 116, 0.2);
}

.calendar-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4px 2px;
    transition: all 0.3s;
    position: relative;
}

.calendar-block.active {
    transform: scale(1.05);
    z-index: 2;
    box-shadow: 0 0 10px rgba(212, 165, 116, 0.4);
}

.calendar-time {
    font-size: 7px;
    font-weight: 600;
    opacity: 0.8;
}

.calendar-label {
    font-size: 8px;
    font-weight: 700;
    margin: 2px 0;
}

.calendar-freq {
    font-size: 6px;
    opacity: 0.7;
}

/* Protocol Current Status */
.protocol-current {
    text-align: center;
    padding: 6px;
    background: rgba(10, 14, 39, 0.5);
    border-radius: 6px;
    margin-top: 6px;
}

/* Purpose Objective */
.purpose-objective {
    text-align: center;
    padding: 4px;
}

/* Frequency Details */
.frequency-details {
    background: rgba(10, 14, 39, 0.5);
    border-radius: 6px;
    padding: 8px;
    margin: 6px 0;
}

.freq-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 9px;
    padding: 3px 0;
    color: #9CA3AF;
}

.freq-row i {
    width: 16px;
    text-align: center;
    margin-right: 4px;
    font-size: 10px;
}

.freq-row span {
    flex: 1;
}

.freq-row strong {
    color: #D4A574;
    font-weight: 600;
}

/* Wave Visualization */
.wave-visualization {
    margin: 10px 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

#waveCanvas {
    border-radius: 6px;
    border: 1px solid rgba(212, 165, 116, 0.2);
    background: rgba(10, 14, 39, 0.9);
}

/* Hormone Section */
.hormone-section {
    background: rgba(10, 14, 39, 0.5);
    border-radius: 6px;
    padding: 8px;
    margin-top: 8px;
}

.hormone-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 9px;
    color: #D4A574;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(212, 165, 116, 0.2);
}

.hormone-detail {
    margin: 6px 0;
    padding: 6px;
    background: rgba(45, 42, 39, 0.3);
    border-radius: 4px;
    border-left: 2px solid #D4A574;
}

.hormone-name {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 9px;
    color: #D4A574;
    margin-bottom: 4px;
}

.hormone-name i {
    font-size: 10px;
}

.hormone-name strong {
    font-weight: 600;
}

.hormone-mechanism {
    font-size: 8px;
    line-height: 1.4;
    color: #9CA3AF;
    opacity: 0.85;
}

/* Desktop Enhancements */
@media (min-width: 769px) {
    .stat-chip {
        min-height: 400px;
        max-height: 600px;
        overflow-y: auto;
        padding: 14px;
    }

    #waveCanvas {
        width: 100%;
        max-width: 400px;
    }

    .day-calendar {
        height: 60px;
    }

    .calendar-time {
        font-size: 8px;
    }

    .calendar-label {
        font-size: 9px;
    }

    .calendar-freq {
        font-size: 7px;
    }
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    /* Disable vertical scrolling on mobile */
    html, body {
        height: 100vh;
        overflow-y: hidden;
        position: fixed;
        width: 100%;
    }

    .app-container {
        height: 100vh;
        overflow-y: hidden;
        max-height: 100vh;
        padding: 16px;
    }

    .day-calendar {
        height: 40px;
    }

    .calendar-time,
    .calendar-label,
    .calendar-freq {
        font-size: 6px;
    }

    #waveCanvas {
        width: 280px;
        height: 100px;
    }

    .hormone-detail {
        margin: 4px 0;
        padding: 4px;
    }

    .hormone-mechanism {
        font-size: 7px;
    }
}

/* ===== DIAGNOSTICS ===== */
.diagnostics-toggle {
    text-align: center;
    font-size: 10px;
    letter-spacing: 2px;
    cursor: pointer;
    padding: 12px;
    transition: all 0.3s;
}

.diagnostics-toggle:hover {
    background: rgba(45, 42, 39, 0.5);
}

.advanced-section {
    display: none;
    flex-direction: column;
    gap: 12px;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(180deg, rgba(15, 17, 21, 0.98) 0%, rgba(15, 17, 21, 1) 100%);
    max-height: 80vh;
    border-radius: 20px 20px 0 0;
    padding: 0;
    z-index: 1001;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
}

.advanced-section[style*="display: block"],
.advanced-section[style*="display: flex"] {
    transform: translateY(0);
}

/* Mobile-only elements (hidden on desktop) */
.mobile-only {
    display: flex;
}

/* Tab navigation */
.advanced-tabs {
    display: flex;
    gap: 4px;
    padding: 12px 12px 0 12px;
    background: rgba(26, 29, 35, 0.9);
    border-radius: 20px 20px 0 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.advanced-tabs::-webkit-scrollbar {
    display: none;
}

.advanced-tab {
    flex: 1;
    min-width: fit-content;
    padding: 10px 12px;
    background: transparent;
    border: none;
    color: #6B7280;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.advanced-tab i {
    font-size: 16px;
}

.advanced-tab span {
    font-size: 9px;
}

.advanced-tab.active {
    background: rgba(212, 165, 116, 0.15);
    color: #D4A574;
}

.advanced-tab:active {
    transform: scale(0.95);
}

/* Close button */
.advanced-close {
    position: absolute;
    top: 68px;
    right: 16px;
    width: 36px;
    height: 36px;
    background: rgba(45, 42, 39, 0.9);
    border: 1px solid #3A3733;
    border-radius: 50%;
    color: #9CA3AF;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.2s ease;
    z-index: 10;
}

.advanced-close:hover {
    background: rgba(212, 165, 116, 0.2);
    color: #D4A574;
    transform: rotate(90deg);
}

/* Tab content container */
.advanced-tab-content {
    padding: 16px;
    overflow-y: auto;
    max-height: calc(80vh - 60px);
}

/* Tab panels */
.advanced-tab-panel {
    display: none;
}

.advanced-tab-panel.active {
    display: block;
    animation: fadeIn 0.2s ease;
}

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

.advanced-item {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(58, 55, 51, 0.3);
}

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

.advanced-label {
    color: #6B7280;
    letter-spacing: 1px;
}

.advanced-value {
    color: #D4A574;
    font-weight: 600;
}

.coil-status {
    font-size: 11px;
    color: #6B7280;
    text-align: center;
    padding: 12px;
    font-style: italic;
}

.coil-controls {
    margin-top: 12px;
}

.action-button {
    width: 100%;
    padding: 14px;
    background: rgba(212, 165, 116, 0.1);
    color: #D4A574;
    border: 1px solid #D4A574;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s;
}

.action-button:hover {
    background: rgba(212, 165, 116, 0.2);
}

.action-button:active {
    transform: scale(0.98);
}

/* ===== NAV HINT ===== */
.nav-hint {
    text-align: center;
    margin-top: 8px;
    padding: 12px;
    background: rgba(45, 42, 39, 0.3);
    border-radius: 8px;
    font-size: 10px;
    color: #6B7280;
    line-height: 1.6;
}

.install-hint {
    margin-top: 8px;
    padding: 8px;
    background: rgba(212, 165, 116, 0.1);
    border: 1px solid #D4A574;
    border-radius: 6px;
    color: #D4A574;
    cursor: pointer;
    transition: all 0.3s;
}

.install-hint:hover {
    background: rgba(212, 165, 116, 0.2);
}

/* ===== LOADING OVERLAY ===== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0F1115;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(212, 165, 116, 0.2);
    border-top-color: #D4A574;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-text {
    margin-top: 20px;
    font-size: 12px;
    color: #6B7280;
    letter-spacing: 1px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 380px) {
    .app-container {
        padding: 16px;
    }

    .frequency-value {
        font-size: 52px;
    }

    .vector-display {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .vector-item {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .vector-label,
    .vector-value {
        display: inline;
    }
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== DARK MODE SUPPORT ===== */
@media (prefers-color-scheme: dark) {
    /* Already dark by default */
}

/* ===== SETUP WIZARD ===== */
.setup-wizard {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #1A1D23 0%, #0F1115 100%);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    overflow-y: auto;
}

.setup-container {
    max-width: 420px;
    width: 100%;
}

.setup-step {
    display: none;
    animation: fadeIn 0.4s ease-in-out;
}

.setup-step.active {
    display: block;
}

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

.setup-icon {
    font-size: 64px;
    text-align: center;
    margin-bottom: 20px;
}

.setup-title {
    font-size: 24px;
    font-weight: 600;
    color: #D4A574;
    text-align: center;
    margin-bottom: 12px;
    letter-spacing: 1px;
}

.setup-description {
    font-size: 14px;
    color: #9CA3AF;
    text-align: center;
    line-height: 1.6;
    margin-bottom: 32px;
}

.setup-feature-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 32px;
}

.setup-feature {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(45, 42, 39, 0.3);
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid #3A3733;
}

.feature-icon {
    font-size: 24px;
}

.feature-text {
    font-size: 13px;
    color: #B8C5D6;
}

.setup-button {
    width: 100%;
    padding: 16px;
    background: #D4A574;
    color: #0F1115;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 8px;
}

.setup-button:hover {
    background: #E4B584;
    transform: translateY(-2px);
}

.setup-button:active {
    transform: scale(0.98);
}

.setup-button-secondary {
    width: 100%;
    padding: 14px;
    background: transparent;
    color: #6B7280;
    border: 1px solid #3A3733;
    border-radius: 10px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s;
}

.setup-button-secondary:hover {
    background: rgba(45, 42, 39, 0.3);
    color: #9CA3AF;
}

.permission-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.permission-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(45, 42, 39, 0.3);
    padding: 14px;
    border-radius: 10px;
    border: 1px solid #3A3733;
}

.permission-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.permission-info {
    flex: 1;
}

.permission-name {
    font-size: 13px;
    font-weight: 600;
    color: #B8C5D6;
    margin-bottom: 2px;
}

.permission-desc {
    font-size: 11px;
    color: #6B7280;
}

.permission-status {
    font-size: 20px;
    flex-shrink: 0;
}

.grid-selector {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.grid-option {
    padding: 16px;
    background: rgba(45, 42, 39, 0.3);
    border: 2px solid #3A3733;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: left;
}

.grid-option:hover {
    border-color: #4A4743;
    background: rgba(45, 42, 39, 0.4);
}

.grid-option.active {
    border-color: #D4A574;
    background: rgba(212, 165, 116, 0.1);
}

.grid-freq {
    font-size: 18px;
    font-weight: 600;
    color: #D4A574;
    margin-bottom: 4px;
}

.grid-region {
    font-size: 12px;
    color: #9CA3AF;
}

.setup-note {
    font-size: 12px;
    color: #6B7280;
    background: rgba(45, 42, 39, 0.3);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 24px;
    line-height: 1.5;
}

.setup-tips {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.setup-tip {
    font-size: 13px;
    color: #9CA3AF;
    padding: 12px;
    background: rgba(45, 42, 39, 0.3);
    border-radius: 8px;
    line-height: 1.5;
}

.setup-tip strong {
    color: #D4A574;
}

/* ===== TGA COMPLIANCE FOOTER ===== */
.tga-footer {
    text-align: center;
    font-size: 9px;
    color: #6B7280;
    padding: 12px 16px;
    margin: 16px 0 8px 0;
    border-top: 1px solid rgba(58, 55, 51, 0.3);
    letter-spacing: 0.5px;
    line-height: 1.4;
}


/* ===== SCIENCE EXPLANATION (Setup Wizard) ===== */
.science-section {
    margin: 20px 0;
    padding: 16px;
    background: rgba(45, 42, 39, 0.3);
    border-radius: 10px;
    border: 1px solid #3A3733;
}

.science-label {
    font-size: 10px;
    font-weight: 600;
    color: #D4A574;
    letter-spacing: 1.5px;
    margin-bottom: 12px;
    text-align: center;
}

.wave-visualization {
    margin: 16px 0;
    overflow: hidden;
}

.wave-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.wave {
    position: relative;
    height: 50px;
    width: 100%;
    max-width: 280px;
    background: rgba(26, 29, 35, 0.8);
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wave-label {
    position: relative;
    z-index: 2;
    font-size: 10px;
    font-weight: 500;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    letter-spacing: 0.5px;
}

/* Animated wave backgrounds */
.wave::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 10px,
        rgba(255, 255, 255, 0.05) 10px,
        rgba(255, 255, 255, 0.05) 20px
    );
    animation: waveScroll 2s linear infinite;
}

@keyframes waveScroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(20px); }
}

/* Different wave colors */
.wave-grid::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, 
        rgba(255, 71, 87, 0.3) 0%, 
        rgba(255, 71, 87, 0.1) 50%, 
        rgba(255, 71, 87, 0.3) 100%
    );
    animation: wavePulse 1s ease-in-out infinite;
}

.wave-attempt::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, 
        rgba(123, 104, 238, 0.3) 0%, 
        rgba(123, 104, 238, 0.1) 50%, 
        rgba(123, 104, 238, 0.3) 100%
    );
    animation: wavePulse 1.25s ease-in-out infinite;
}

.wave-interference::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, 
        rgba(255, 182, 39, 0.3) 0%, 
        rgba(255, 182, 39, 0.1) 50%, 
        rgba(255, 182, 39, 0.3) 100%
    );
    animation: wavePulse 2s ease-in-out infinite;
}

.wave-detected::after,
.wave-grid-large::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, 
        rgba(255, 71, 87, 0.3) 0%, 
        rgba(255, 71, 87, 0.1) 50%, 
        rgba(255, 71, 87, 0.3) 100%
    );
    animation: wavePulse 0.9975s ease-in-out infinite;
}

.wave-offset::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, 
        rgba(27, 255, 220, 0.3) 0%, 
        rgba(27, 255, 220, 0.1) 50%, 
        rgba(27, 255, 220, 0.3) 100%
    );
    animation: wavePulse 1.25s ease-in-out infinite;
}

.wave-output::after,
.wave-output-large::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, 
        rgba(212, 165, 116, 0.3) 0%, 
        rgba(212, 165, 116, 0.1) 50%, 
        rgba(212, 165, 116, 0.3) 100%
    );
    animation: wavePulse 0.5543s ease-in-out infinite;
}

.wave-perfect::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, 
        rgba(0, 217, 177, 0.4) 0%, 
        rgba(0, 217, 177, 0.2) 50%, 
        rgba(0, 217, 177, 0.4) 100%
    );
    animation: wavePulse 1.25s ease-in-out infinite;
    box-shadow: 0 0 20px rgba(0, 217, 177, 0.3);
}

@keyframes wavePulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

.wave-operator {
    font-size: 18px;
    font-weight: 600;
    color: #9CA3AF;
    padding: 4px 0;
}

.science-explanation {
    font-size: 12px;
    color: #9CA3AF;
    line-height: 1.6;
    margin-top: 12px;
    text-align: center;
}

.science-explanation strong {
    color: #00D9B1;
    font-weight: 600;
}

.science-note {
    margin-top: 16px;
    padding: 12px;
    background: rgba(0, 217, 177, 0.1);
    border-left: 3px solid #00D9B1;
    border-radius: 6px;
    font-size: 11px;
    color: #B8C5D6;
    line-height: 1.5;
}

.science-note strong {
    color: #00D9B1;
}

/* Frequency Benefits & Problems */
.frequency-benefit,
.frequency-problem {
    padding: 12px;
    border-radius: 8px;
    margin-top: 8px;
}

.frequency-benefit {
    background: rgba(0, 217, 177, 0.1);
    border: 1px solid rgba(0, 217, 177, 0.2);
}

.benefit-item {
    font-size: 12px;
    color: #B8C5D6;
    padding: 8px 0;
    line-height: 1.4;
}

.frequency-problem {
    background: rgba(255, 71, 87, 0.1);
    border: 1px solid rgba(255, 71, 87, 0.2);
}

.problem-item {
    font-size: 12px;
    color: #B8C5D6;
    padding: 8px;
    margin-bottom: 8px;
    line-height: 1.6;
}

.problem-explanation {
    font-size: 12px;
    color: #9CA3AF;
    padding: 8px;
    line-height: 1.5;
}

/* SVG Sine Wave Visualization */
.sine-visualization {
    background: rgba(26, 29, 35, 0.6);
    border-radius: 10px;
    padding: 16px 8px;
    margin: 12px 0;
}

.sine-visualization svg {
    display: block;
    max-width: 100%;
    height: auto;
}

/* Compensation Formula */
.compensation-formula {
    background: rgba(26, 29, 35, 0.6);
    border-radius: 10px;
    padding: 16px;
    margin: 12px 0;
}

.formula-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    font-size: 13px;
}

.formula-label {
    color: #9CA3AF;
    font-weight: 500;
}

.formula-value {
    color: #D4A574;
    font-weight: 600;
    font-size: 14px;
}

.formula-divider {
    height: 2px;
    background: linear-gradient(90deg, transparent, #D4A574, transparent);
    margin: 8px 0;
}

.formula-line.result {
    padding: 12px;
    background: rgba(0, 217, 177, 0.1);
    border-radius: 8px;
    margin-top: 8px;
}

.formula-line.result .formula-value {
    color: #00D9B1;
    font-size: 16px;
}

/* Frequency Guide */
.frequency-guide {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.freq-band {
    padding: 14px;
    border-radius: 10px;
    border: 1.5px solid;
    background: rgba(45, 42, 39, 0.3);
}

.freq-band.delta {
    border-color: rgba(102, 51, 153, 0.4);
    background: rgba(102, 51, 153, 0.1);
}

.freq-band.theta {
    border-color: rgba(75, 123, 236, 0.4);
    background: rgba(75, 123, 236, 0.1);
}

.freq-band.alpha {
    border-color: rgba(0, 217, 177, 0.4);
    background: rgba(0, 217, 177, 0.1);
}

.freq-band.beta {
    border-color: rgba(255, 182, 39, 0.4);
    background: rgba(255, 182, 39, 0.1);
}

.freq-band.gamma {
    border-color: rgba(255, 71, 87, 0.4);
    background: rgba(255, 71, 87, 0.1);
}

.freq-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.freq-name {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1px;
    color: #D4A574;
}

.freq-range {
    font-size: 10px;
    color: #9CA3AF;
    background: rgba(45, 42, 39, 0.5);
    padding: 4px 8px;
    border-radius: 4px;
}

.freq-hormones,
.freq-function {
    font-size: 11px;
    color: #B8C5D6;
    line-height: 1.5;
    margin-top: 6px;
}

.freq-hormones strong,
.freq-function strong {
    color: #9CA3AF;
}

/* Mobile optimization */
@media (max-width: 480px) {
    .wave {
        height: 45px;
        max-width: 100%;
    }

    .wave-label {
        font-size: 9px;
    }

    .science-explanation {
        font-size: 11px;
    }

    .benefit-item,
    .problem-item,
    .problem-explanation {
        font-size: 11px;
    }

    .formula-line {
        font-size: 12px;
    }

    .freq-band {
        padding: 12px;
    }

    .freq-name {
        font-size: 11px;
    }

    .freq-range {
        font-size: 9px;
    }
}

/* ===== FLOATING ACTION BUTTONS (FABs) ===== */
.fab {
    position: fixed;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: #D4A574;
    color: #0F1115;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    transition: all 0.3s;
    z-index: 1000;
}

.fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(212, 165, 116, 0.5);
}

.fab:active {
    transform: scale(0.95);
}

.fab-frequency {
    bottom: 24px;
    right: 24px;
}

.fab-settings {
    bottom: 24px;
    left: 24px;
}

/* ===== MODAL ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 14, 39, 0.95);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}

.modal-content {
    background: #1A1D23;
    border-radius: 16px;
    max-width: 420px;
    width: 100%;
    border: 2px solid #D4A574;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-content.modal-large {
    max-width: 600px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #3A3733;
    flex-shrink: 0;
}

.modal-header h3 {
    color: #D4A574;
    font-size: 18px;
    margin: 0;
}

.modal-close {
    background: transparent;
    border: none;
    color: #9CA3AF;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
}

.modal-close:hover {
    color: #FF4757;
}

.modal-tabs {
    display: flex;
    gap: 4px;
    padding: 12px 20px 0 20px;
    border-bottom: 1px solid #3A3733;
    flex-shrink: 0;
}

.tab-button {
    flex: 1;
    padding: 10px;
    background: transparent;
    border: none;
    color: #6B7280;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

.tab-button:hover {
    color: #9CA3AF;
}

.tab-button.active {
    color: #D4A574;
    border-bottom-color: #D4A574;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.tab-content {
    animation: fadeIn 0.3s ease-in-out;
}

.frequency-selector {
    margin-bottom: 20px;
}

.freq-label {
    display: block;
    color: #B8C5D6;
    font-size: 13px;
    margin-bottom: 8px;
    font-weight: 600;
}

.freq-input {
    width: 100%;
    padding: 12px;
    background: rgba(45, 42, 39, 0.5);
    border: 1px solid #3A3733;
    border-radius: 8px;
    color: #D4A574;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
}

.freq-input:focus {
    outline: none;
    border-color: #D4A574;
}

/* Microcontrol Wrapper */
.microcontrol-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.microcontrol-wrapper .freq-input {
    flex: 1;
    margin-bottom: 0;
}

.microcontrol-btn {
    width: 44px;
    height: 44px;
    padding: 0;
    background: rgba(212, 165, 116, 0.15);
    color: #D4A574;
    border: 1px solid rgba(212, 165, 116, 0.4);
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.microcontrol-btn:hover {
    background: rgba(212, 165, 116, 0.25);
    border-color: #D4A574;
    transform: translateY(-1px);
}

.microcontrol-btn:active {
    transform: translateY(0) scale(0.95);
}

.microcontrol-btn i {
    font-size: 12px;
}

/* Magnetometer Warning */
.magnetometer-warning {
    background: rgba(255, 182, 39, 0.1);
    border: 1px solid rgba(255, 182, 39, 0.3);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 12px;
    font-size: 12px;
    line-height: 1.5;
    color: #FFB627;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.magnetometer-warning i {
    font-size: 14px;
    margin-top: 2px;
    flex-shrink: 0;
}

.magnetometer-warning a {
    color: #D4A574;
    text-decoration: underline;
    font-weight: 600;
}

.magnetometer-warning a:hover {
    color: #FFB627;
}

.freq-presets {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.preset-btn {
    padding: 10px;
    background: rgba(212, 165, 116, 0.1);
    color: #D4A574;
    border: 1px solid #D4A574;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.preset-btn:hover {
    background: rgba(212, 165, 116, 0.2);
}

.preset-btn:active {
    transform: scale(0.95);
}

/* Schedule Info */
.schedule-info {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.schedule-block {
    background: rgba(45, 42, 39, 0.3);
    border-left: 4px solid #D4A574;
    padding: 14px;
    border-radius: 8px;
}

.schedule-time {
    font-size: 11px;
    color: #D4A574;
    font-weight: 600;
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.schedule-title {
    font-size: 14px;
    color: #B8C5D6;
    font-weight: 600;
    margin-bottom: 4px;
}

.schedule-freq {
    font-size: 13px;
    color: #00D9B1;
    margin-bottom: 8px;
}

.schedule-desc {
    font-size: 11px;
    color: #9CA3AF;
    line-height: 1.6;
}

/* Protocol Cards */
.protocol-selector {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.protocol-card {
    background: rgba(45, 42, 39, 0.3);
    border: 1px solid #3A3733;
    border-radius: 12px;
    padding: 16px;
}

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

.protocol-name {
    font-size: 14px;
    color: #D4A574;
    font-weight: 600;
}

.protocol-toggle {
    position: relative;
    width: 48px;
    height: 26px;
    display: inline-block;
}

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

.protocol-toggle .toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(58, 55, 51, 0.3);
    transition: 0.4s;
    border-radius: 13px;
}

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

.protocol-toggle input:checked + .toggle-slider {
    background-color: #D4A574;
}

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

.protocol-details {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.protocol-mod {
    font-size: 12px;
    color: #B8C5D6;
    line-height: 1.5;
    padding: 8px;
    background: rgba(26, 29, 35, 0.5);
    border-radius: 6px;
}

.protocol-mod em {
    color: #9CA3AF;
    font-size: 11px;
    display: block;
    margin-top: 4px;
}

@media (max-width: 480px) {
    .fab {
        width: 48px;
        height: 48px;
    }

    .fab-frequency {
        bottom: 16px;
        right: 16px;
    }

    .fab-settings {
        bottom: 16px;
        left: 16px;
    }

    .modal-content.modal-large {
        max-width: 100%;
    }

    .schedule-block,
    .protocol-card {
        padding: 12px;
    }
}

/* ===== MOOD TRACKING MODAL ===== */
.mood-selector {
    padding: 8px 0;
}

.mood-context {
    text-align: center;
    font-size: 14px;
    color: #D4A574;
    font-weight: 600;
    margin-bottom: 20px;
}

.mood-options {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin: 20px 0;
}

.mood-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: rgba(45, 42, 39, 0.3);
    border: 2px solid #3A3733;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    flex: 1;
    max-width: 80px;
}

.mood-btn:hover {
    background: rgba(45, 42, 39, 0.5);
    border-color: #D4A574;
    transform: scale(1.05);
}

.mood-btn:active {
    transform: scale(0.95);
}

.mood-btn.selected {
    background: rgba(212, 165, 116, 0.2);
    border-color: #D4A574;
    transform: scale(1.05);
}

.mood-emoji {
    font-size: 32px;
    line-height: 1;
}

.mood-label {
    font-size: 10px;
    color: #9CA3AF;
    text-align: center;
    font-weight: 500;
}

.mood-note {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #3A3733;
}

.mood-note label {
    display: block;
    font-size: 12px;
    color: #9CA3AF;
    margin-bottom: 8px;
}

.mood-note input {
    width: 100%;
    padding: 10px;
    background: rgba(45, 42, 39, 0.3);
    border: 1px solid #3A3733;
    border-radius: 8px;
    color: #E5E7EB;
    font-size: 13px;
    font-family: inherit;
}

.mood-note input:focus {
    outline: none;
    border-color: #D4A574;
    background: rgba(45, 42, 39, 0.5);
}

/* Mood stats in Advanced Settings */
.mood-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

@media (max-width: 480px) {
    .mood-options {
        gap: 8px;
    }

    .mood-btn {
        padding: 8px;
        max-width: 70px;
    }

    .mood-emoji {
        font-size: 28px;
    }

    .mood-label {
        font-size: 9px;
    }
}

/* ===== CSS ICONS ===== */
/* Using bronze color (#D4A574) for all icons */

/* Grid / Chart Icon */
.icon-grid {
    position: relative;
    width: 16px;
    height: 16px;
    display: inline-block;
    vertical-align: middle;
    margin-right: 6px;
}

.icon-grid::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background:
        linear-gradient(#D4A574 0 0) 0 0/100% 2px,
        linear-gradient(#D4A574 0 0) 0 0/2px 100%,
        linear-gradient(#D4A574 0 0) 0 6px/100% 2px,
        linear-gradient(#D4A574 0 0) 6px 0/2px 100%,
        linear-gradient(#D4A574 0 0) 0 12px/100% 2px,
        linear-gradient(#D4A574 0 0) 12px 0/2px 100%;
    background-repeat: no-repeat;
}

/* Light Bulb Icon */
.icon-lightbulb {
    position: relative;
    width: 16px;
    height: 16px;
    display: inline-block;
    vertical-align: middle;
    margin-right: 6px;
}

.icon-lightbulb::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 10px;
    border: 2px solid #D4A574;
    border-radius: 50% 50% 40% 40%;
}

.icon-lightbulb::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 4px;
    background: #D4A574;
    border-radius: 0 0 2px 2px;
}

/* Chart / Graph Icon */
.icon-chart {
    position: relative;
    width: 16px;
    height: 16px;
    display: inline-block;
    vertical-align: middle;
    margin-right: 6px;
}

.icon-chart::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: #D4A574;
}

.icon-chart::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 6px;
    width: 4px;
    height: 60%;
    background: #D4A574;
}

/* Add third bar using a wrapper element */
.button-icon-wrapper {
    position: relative;
    display: inline-block;
}

.button-icon-wrapper .icon-chart span::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 4px;
    height: 40%;
    background: #D4A574;
}

/* Mood / Face Icon */
.icon-mood {
    position: relative;
    width: 16px;
    height: 16px;
    display: inline-block;
    vertical-align: middle;
    margin-right: 6px;
    border: 2px solid #D4A574;
    border-radius: 50%;
}

.icon-mood::before {
    content: '';
    position: absolute;
    bottom: 3px;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 4px;
    border: 2px solid #D4A574;
    border-top: none;
    border-radius: 0 0 8px 8px;
}

/* Save / Download Icon */
.icon-save {
    position: relative;
    width: 16px;
    height: 16px;
    display: inline-block;
    vertical-align: middle;
    margin-right: 6px;
}

.icon-save::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 6px solid #D4A574;
}

.icon-save::after {
    content: '';
    position: absolute;
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 6px;
    background: #D4A574;
}

/* Sync / Refresh Icon */
.icon-sync {
    position: relative;
    width: 16px;
    height: 16px;
    display: inline-block;
    vertical-align: middle;
    margin-right: 6px;
    border: 2px solid #D4A574;
    border-radius: 50%;
    border-top-color: transparent;
}

.icon-sync::before {
    content: '';
    position: absolute;
    top: -2px;
    right: 0;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-bottom: 4px solid #D4A574;
}

/* Connect / Link Icon */
.icon-link {
    position: relative;
    width: 16px;
    height: 16px;
    display: inline-block;
    vertical-align: middle;
    margin-right: 6px;
}

.icon-link::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 0;
    width: 6px;
    height: 10px;
    border: 2px solid #D4A574;
    border-right: none;
    border-radius: 8px 0 0 8px;
}

.icon-link::after {
    content: '';
    position: absolute;
    top: 2px;
    right: 0;
    width: 6px;
    height: 10px;
    border: 2px solid #D4A574;
    border-left: none;
    border-radius: 0 8px 8px 0;
}

/* Disconnect / Unplug Icon */
.icon-disconnect {
    position: relative;
    width: 16px;
    height: 16px;
    display: inline-block;
    vertical-align: middle;
    margin-right: 6px;
}

.icon-disconnect::before {
    content: '';
    position: absolute;
    top: 0;
    left: 4px;
    width: 8px;
    height: 10px;
    border: 2px solid #D4A574;
    border-bottom: none;
    border-radius: 4px 4px 0 0;
}

.icon-disconnect::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 6px;
    width: 4px;
    height: 6px;
    background: #D4A574;
}

/* Magnet Icon */
.icon-magnet {
    position: relative;
    width: 20px;
    height: 20px;
    display: inline-block;
    vertical-align: middle;
}

.icon-magnet::before {
    content: '';
    position: absolute;
    top: 0;
    left: 2px;
    width: 6px;
    height: 14px;
    border: 2px solid #D4A574;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
}

.icon-magnet::after {
    content: '';
    position: absolute;
    top: 0;
    right: 2px;
    width: 6px;
    height: 14px;
    border: 2px solid #D4A574;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
}

/* ===== DESKTOP DASHBOARD LAYOUT ===== */
@media (min-width: 1024px) {
    body {
        overflow-x: hidden;
    }

    .app-container {
        max-width: 100vw;
        padding: 40px;
        display: grid;
        grid-template-columns: 2fr 2fr 1fr;
        grid-template-rows: auto auto auto auto auto auto;
        gap: 24px;
        grid-template-areas:
            "header header header"
            "dashboard dashboard grid-detect"
            "dashboard dashboard flashlight"
            "controls controls controls"
            "charts charts charts"
            "advanced advanced advanced";
    }

    .app-header {
        grid-area: header;
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 20px;
        border-bottom: 2px solid #2D2A27;
    }

    .app-title {
        font-size: 32px;
        letter-spacing: 8px;
    }

    .connection-status {
        margin-top: 0;
    }

    /* Dashboard grid takes the dashboard area */
    .dashboard-grid {
        grid-area: dashboard;
    }

    /* Main frequency display (now inside dashboard-left) */
    .frequency-card {
        min-height: 250px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        position: relative;
    }

    /* Lunar card (now inside dashboard-left) */
    .lunar-card {
        display: flex;
        flex-direction: column;
        padding: 24px;
        min-height: 250px;
    }

    /* Make moon emoji much larger on desktop */
    .moon-emoji {
        font-size: 120px !important;
        line-height: 1;
        margin-bottom: 16px;
    }

    .lunar-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .lunar-info {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 8px;
        margin-top: 16px;
    }

    .lunar-phase {
        font-size: 16px !important;
        font-weight: bold;
    }

    .lunar-illumination,
    .lunar-distance {
        font-size: 13px;
        color: #9CA3AF;
    }

    /* Show lunar times on desktop */
    .lunar-times,
    .sun-times {
        display: flex !important;
        flex-direction: column;
        gap: 8px;
        margin-top: 16px;
        padding-top: 16px;
        border-top: 1px solid rgba(58, 55, 51, 0.3);
    }

    .lunar-time-item,
    .sun-time-item {
        display: flex;
        align-items: center;
        gap: 8px;
        font-size: 12px;
        color: #D4A574;
    }

    .lunar-time-item i,
    .sun-time-item i {
        width: 16px;
        color: #9CA3AF;
    }

    .location-status {
        display: block !important;
        margin-top: 12px;
        font-size: 10px;
        opacity: 0.7;
    }

    /* Quick stats - now part of dashboard-grid */

    /* Play button - position inside frequency card on desktop */
    .play-button {
        position: absolute;
        bottom: 10px;
        left: 50%;
        transform: translateX(-50%);
        width: 80px;
        height: 80px;
        margin: 0;
        grid-area: auto;
    }

    /* Ensure frequency card has enough height for button */
    .frequency-card {
        min-height: 280px;
    }

    /* Grid detection card */
    .grid-detection-card {
        grid-area: grid-detect !important;
        display: flex !important;
        flex-direction: column;
        justify-content: center;
        padding: 20px;
        max-height: 250px;
        min-height: 200px;
        align-self: start;
    }

    /* Flashlight card - stacked below grid-detect in third column */
    .flashlight-card {
        grid-area: flashlight !important;
        display: flex !important;
        flex-direction: column;
        justify-content: space-between;
        padding: 20px;
        max-height: 250px;
        min-height: 200px;
        align-self: start;
    }

    /* Charts area - placeholder for future charts */
    .app-container::after {
        content: '';
        grid-area: charts;
        background: rgba(45, 42, 39, 0.3);
        border: 1px dashed #3A3733;
        border-radius: 12px;
        min-height: 400px;
        position: relative;
    }

    /* Advanced section - always visible */
    .advanced-section {
        grid-area: advanced !important;
        display: grid !important;
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 20px;
        padding: 24px;
        background: rgba(15, 17, 21, 0.5);
        border-radius: 12px;
        border: 1px solid #2D2A27;
        position: static !important;
        transform: none !important;
        max-height: none !important;
        box-shadow: none !important;
    }

    /* Hide mobile-only elements on desktop */
    .mobile-only {
        display: none !important;
    }

    /* Desktop: Show all tab panels (no tabs) */
    .advanced-tab-content {
        padding: 0;
        overflow-y: visible;
        max-height: none;
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 20px;
    }

    .advanced-tab-panel {
        display: block !important;
    }

    /* Diagnostics toggle - hide on desktop since always visible */
    .diagnostics-toggle {
        display: none;
    }

    /* TGA footer - move to bottom */
    .tga-footer {
        grid-column: 1 / -1;
        position: static;
    }

    /* FAB buttons - hide on desktop */
    .fab {
        display: none;
    }

    /* Desktop-specific charts - horizontal layout */
    .desktop-charts {
        grid-area: charts !important;
        display: grid !important;
        grid-template-columns: 1fr 1fr 1fr;
        gap: 24px;
        padding: 0;
    }

    .desktop-charts .card {
        background: rgba(26, 29, 35, 0.8);
        border: 1px solid #2D2A27;
        border-radius: 12px;
        padding: 20px;
    }

    .chart-empty {
        text-align: center;
        color: #6B7280;
        padding: 40px 20px;
    }

    .chart-empty i {
        font-size: 48px;
        margin-bottom: 16px;
        opacity: 0.3;
    }

    .chart-empty p {
        font-size: 14px;
        margin-top: 8px;
    }

    /* Mood Chart Styles */
    .mood-chart {
        display: flex;
        align-items: flex-end;
        justify-content: space-around;
        height: 200px;
        padding: 20px 10px;
        border-bottom: 2px solid #3A3733;
        position: relative;
    }

    .mood-bar {
        flex: 1;
        max-width: 20px;
        background: linear-gradient(180deg, #D4A574 0%, #A67C52 100%);
        border-radius: 4px 4px 0 0;
        margin: 0 2px;
        position: relative;
        cursor: pointer;
        transition: all 0.2s;
    }

    .mood-bar:hover {
        background: linear-gradient(180deg, #FFB627 0%, #D4A574 100%);
        transform: scaleY(1.05);
    }

    .mood-bar-label {
        position: absolute;
        bottom: -20px;
        left: 50%;
        transform: translateX(-50%);
        font-size: 9px;
        color: #6B7280;
        white-space: nowrap;
    }

    .mood-bar-value {
        position: absolute;
        top: -20px;
        left: 50%;
        transform: translateX(-50%);
        font-size: 10px;
        color: #D4A574;
        font-weight: 600;
    }

    /* Frequency Usage Chart */
    .frequency-usage-chart {
        padding: 20px;
        position: relative;
        min-height: 200px;
    }

    .freq-usage-item {
        display: flex;
        align-items: center;
        margin-bottom: 12px;
    }

    .freq-usage-label {
        min-width: 100px;
        font-size: 12px;
        color: #9CA3AF;
    }

    .freq-usage-bar-container {
        flex: 1;
        height: 24px;
        background: rgba(45, 42, 39, 0.5);
        border-radius: 4px;
        overflow: hidden;
        position: relative;
    }

    .freq-usage-bar {
        height: 100%;
        background: linear-gradient(90deg, #D4A574 0%, #FFB627 100%);
        border-radius: 4px;
        transition: width 0.3s ease;
    }

    .freq-usage-value {
        position: absolute;
        right: 8px;
        top: 50%;
        transform: translateY(-50%);
        font-size: 11px;
        color: #0F1115;
        font-weight: 600;
    }

    /* Session Chart */
    .session-chart {
        display: flex;
        flex-direction: column;
        gap: 12px;
        padding: 20px;
        position: relative;
        min-height: 200px;
    }

    .session-item {
        display: flex;
        align-items: center;
        gap: 12px;
    }

    .session-date {
        min-width: 80px;
        font-size: 11px;
        color: #6B7280;
    }

    .session-duration-bar {
        flex: 1;
        height: 20px;
        background: linear-gradient(90deg, rgba(212, 165, 116, 0.3) 0%, rgba(212, 165, 116, 0.6) 100%);
        border-radius: 4px;
        position: relative;
    }

    .session-duration-text {
        position: absolute;
        left: 8px;
        top: 50%;
        transform: translateY(-50%);
        font-size: 10px;
        color: #D4A574;
        font-weight: 600;
    }

    /* Chart overlay for empty states */
    .chart-overlay {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        z-index: 10;
        pointer-events: none;
    }
}

/* Font Awesome icon styling */
.action-button i {
    margin-right: 8px;
    color: #D4A574;
}

.card-icon i {
    color: #D4A574;
    font-size: 20px;
}

.badge-icon i {
    color: #D4A574;
    font-size: 32px;
}

/* Device compatibility icons */
.device-compatibility i {
    color: #D4A574;
    font-size: 24px;
}

/* Stat icons */
.stat-icon-small {
    color: #D4A574;
    font-size: 16px;
}

/* Button icon alignment */
.action-button .icon-grid,
.action-button .icon-lightbulb,
.action-button .icon-chart,
.action-button .icon-mood,
.action-button .icon-save,
.action-button .icon-sync,
.action-button .icon-link,
.action-button .icon-disconnect {
    margin-right: 8px;
}


/* Remote Magnetometer Connection Card */
.remote-magnetometer-card {
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.05) 0%, rgba(212, 165, 116, 0.05) 100%);
    border: 2px solid rgba(255, 107, 107, 0.3);
}

.remote-magnetometer-content {
    padding: 1.5rem;
    text-align: center;
}

.remote-icon-group {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    color: var(--primary);
}

.remote-icon-group i:nth-child(2) {
    font-size: 1.5rem;
    color: var(--accent);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.1); }
}

.remote-description {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.remote-benefits {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    text-align: left;
}

.benefit-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.benefit-item i {
    color: var(--accent);
    font-size: 1rem;
}

.btn-premium {
    width: 100%;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    border: none;
    border-radius: 8px;
    color: var(--bg-primary);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.btn-premium:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(212, 165, 116, 0.3);
}

.btn-premium i {
    font-size: 1.1rem;
}

.premium-badge-feature {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.1) 0%, rgba(212, 165, 116, 0.1) 100%);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #FFD700;
    margin-top: 1rem;
}

.premium-badge-feature i {
    color: #FFD700;
}

@media (max-width: 768px) {
    .remote-icon-group {
        font-size: 2rem;
    }
}

/* ===== PROFILE MENU (DASHBOARD) ===== */
.profile-menu-dashboard {
    position: absolute;
    top: 12px;
    right: 20px;
}

.profile-btn-dashboard {
    background: transparent;
    border: 2px solid #D4A574;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: #D4A574;
    font-size: 1.3rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    padding: 0;
}

.profile-btn-dashboard:hover {
    background: rgba(212, 165, 116, 0.1);
    transform: scale(1.05);
}

.profile-dropdown-dashboard {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #1A1D23;
    border: 1px solid #2D2A27;
    border-radius: 8px;
    min-width: 180px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1001;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.profile-menu-dashboard.active .profile-dropdown-dashboard {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item-dashboard {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: #9CA3AF;
    text-decoration: none;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

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

.dropdown-item-dashboard:hover {
    background: rgba(212, 165, 116, 0.1);
    color: #D4A574;
}

.dropdown-item-dashboard i {
    font-size: 1rem;
    width: 16px;
    text-align: center;
}

/* ===== MINI MODE (Height < 600px) ===== */
@media (max-height: 600px) {
    /* Show only icon in header */
    .app-logo {
        display: block !important;
    }

    .app-title-text {
        display: none !important;
    }

    .app-title-wrapper {
        justify-content: center;
    }

    /* Compact header */
    .app-header {
        padding-bottom: 8px;
        margin-bottom: 6px;
    }

    .connection-status {
        margin-top: 4px;
        font-size: 8px;
    }

    /* Hide advanced settings toggle */
    #diagnosticsToggle {
        display: none !important;
    }

    /* Hide advanced section if visible */
    #advancedSection {
        display: none !important;
    }

    /* Hide FAB buttons */
    .fab {
        display: none !important;
    }

    /* Compact app container */
    .app-container {
        gap: 8px;
        padding: 8px;
    }

    /* Compact cards */
    .card {
        padding: 12px;
        margin-bottom: 8px;
    }

    .card-title {
        font-size: 11px;
        margin-bottom: 8px;
    }

    /* Compact frequency card */
    .frequency-card {
        padding: 16px;
        min-height: auto;
    }

    .frequency-value {
        font-size: 32px;
        margin-bottom: 8px;
    }

    .frequency-type {
        gap: 6px;
    }

    .brainwave-label {
        font-size: 11px;
    }

    .status-dot {
        width: 6px;
        height: 6px;
    }

    .frequency-correction {
        font-size: 9px;
        margin-top: 6px;
    }

    /* Compact play button */
    .play-button {
        padding: 12px;
    }

    .play-button svg {
        width: 32px;
        height: 32px;
    }

    /* Compact dashboard grid */
    .dashboard-grid {
        gap: 8px;
        grid-template-columns: 1fr;
    }

    .dashboard-left,
    .dashboard-right {
        gap: 8px;
    }

    /* Compact moon card */
    .moon-phase-card {
        padding: 12px;
    }

    .moon-emoji {
        font-size: 40px;
    }

    .moon-phase-name {
        font-size: 12px;
    }

    .moon-illumination {
        font-size: 10px;
    }

    /* Keep microcontrols visible in frequency modal */
    .microcontrol-wrapper {
        margin-bottom: 8px;
    }

    .microcontrol-btn {
        width: 40px;
        height: 40px;
    }

    /* Compact modals */
    .modal-content {
        padding: 16px;
        max-height: 90vh;
        overflow-y: auto;
    }

    .modal-header h2,
    .modal-header h3 {
        font-size: 16px;
    }

    /* Reduce spacing in frequency usage chart area */
    .frequency-usage-chart {
        height: 120px;
    }

    /* Compact session stats */
    .session-stats {
        gap: 8px;
    }

    .stat-card {
        padding: 10px;
    }

    .stat-value {
        font-size: 20px;
    }

    .stat-label {
        font-size: 10px;
    }
}
