/* ========================================
   COGNITIVE OS - Styles
   Glassmorphism + Dark Cyberpunk Aesthetic
   ======================================== */

/* CSS Custom Properties */
:root {
    /* Backgrounds */
    --bg-deep: #0a0a0f;
    --bg-surface: #12121a;
    --bg-elevated: #1a1a25;

    /* Glass effects */
    --glass-bg: rgba(20, 20, 35, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-highlight: rgba(255, 255, 255, 0.04);

    /* Accents (muted neons) */
    --accent-teal: #00d4aa;
    --accent-magenta: #d946ef;
    --accent-amber: #f59e0b;

    /* Text */
    --text-primary: #e4e4e7;
    --text-secondary: #a1a1aa;
    --text-muted: #52525b;

    /* Energy states */
    --energy-low: #ef4444;
    --energy-medium: #f59e0b;
    --energy-high: #22c55e;

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;

    /* Border radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;

    /* Fonts */
    --font-display: 'Space Grotesk', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-display);
    background-color: var(--bg-deep);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
}

/* App Container */
.app {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--space-md);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ========================================
   HEADER
   ======================================== */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) 0;
    margin-bottom: var(--space-lg);
    border-bottom: 1px solid var(--glass-border);
}

.logo {
    font-family: var(--font-mono);
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    color: var(--accent-teal);
}

.version {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
    margin-left: var(--space-sm);
}

.view-toggle {
    display: flex;
    gap: var(--space-xs);
    background: var(--glass-bg);
    padding: var(--space-xs);
    border-radius: var(--radius-md);
    border: 1px solid var(--glass-border);
}

.toggle-btn {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    padding: var(--space-sm) var(--space-md);
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.toggle-btn:hover {
    color: var(--text-primary);
}

.toggle-btn.active {
    background: var(--bg-elevated);
    color: var(--accent-teal);
}

.current-date {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
}

/* ========================================
   MAIN CONTENT
   ======================================== */
.main-content {
    flex: 1;
}

.view {
    display: none;
}

.view.active {
    display: block;
}

/* ========================================
   PANELS (Glass Effect)
   ======================================== */
.panel {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-lg);
    overflow: hidden;
    position: relative;
}

/* Top highlight for depth */
.panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent,
        var(--glass-highlight),
        rgba(255, 255, 255, 0.1),
        var(--glass-highlight),
        transparent
    );
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--glass-border);
}

.panel-label {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
}

.panel-content {
    padding: var(--space-lg);
}

.panel-hint {
    font-size: 0.8125rem;
    color: var(--text-muted);
    font-style: italic;
    margin-top: var(--space-md);
}

/* ========================================
   WIN DECLARATION PANEL (Featured)
   ======================================== */
.panel-win {
    border-color: var(--accent-teal);
    border-width: 1px;
    box-shadow: 0 0 30px rgba(0, 212, 170, 0.1);
}

.panel-win::before {
    background: linear-gradient(
        90deg,
        transparent,
        rgba(0, 212, 170, 0.2),
        rgba(0, 212, 170, 0.4),
        rgba(0, 212, 170, 0.2),
        transparent
    );
}

.panel-win .panel-label {
    color: var(--accent-teal);
}

.win-input {
    width: 100%;
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 500;
    padding: var(--space-md);
    background: var(--bg-elevated);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    transition: border-color var(--transition-fast);
}

.win-input::placeholder {
    color: var(--text-muted);
}

.win-input:focus {
    outline: none;
    border-color: var(--accent-teal);
}

.energy-selector {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-top: var(--space-lg);
}

.energy-label {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
}

.energy-buttons {
    display: flex;
    gap: var(--space-xs);
}

.energy-btn {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-elevated);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.energy-btn:hover {
    border-color: var(--text-muted);
}

.energy-btn[data-energy="low"].active {
    background: rgba(239, 68, 68, 0.15);
    border-color: var(--energy-low);
    color: var(--energy-low);
}

.energy-btn[data-energy="medium"].active {
    background: rgba(245, 158, 11, 0.15);
    border-color: var(--energy-medium);
    color: var(--energy-medium);
}

.energy-btn[data-energy="high"].active {
    background: rgba(34, 197, 94, 0.15);
    border-color: var(--energy-high);
    color: var(--energy-high);
}

.energy-hint {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: var(--space-md);
    min-height: 1.5em;
}

.energy-hint.low { color: var(--energy-low); }
.energy-hint.medium { color: var(--energy-medium); }
.energy-hint.high { color: var(--energy-high); }

/* ========================================
   PANELS GRID (2-column layout)
   ======================================== */
.panels-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-lg);
}

@media (max-width: 768px) {
    .panels-grid {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   WORKSTREAMS
   ======================================== */
.counter {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.workstream-list {
    list-style: none;
    margin-bottom: var(--space-md);
}

.workstream-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-elevated);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-sm);
    cursor: grab;
    transition: all var(--transition-fast);
}

.workstream-item:hover {
    border-color: var(--text-muted);
}

.workstream-item.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.workstream-item.drag-over {
    border-color: var(--accent-teal);
    background: rgba(0, 212, 170, 0.05);
}

.drag-handle {
    color: var(--text-muted);
    font-size: 0.875rem;
    cursor: grab;
}

.workstream-text {
    flex: 1;
    font-size: 0.9375rem;
    color: var(--text-primary);
}

.delete-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: var(--space-xs);
    font-size: 1rem;
    line-height: 1;
    opacity: 0;
    transition: all var(--transition-fast);
}

.workstream-item:hover .delete-btn {
    opacity: 1;
}

.delete-btn:hover {
    color: var(--energy-low);
}

.add-input-wrapper {
    margin-top: var(--space-sm);
}

.add-input {
    width: 100%;
    font-family: var(--font-display);
    font-size: 0.9375rem;
    padding: var(--space-sm) var(--space-md);
    background: transparent;
    border: 1px dashed var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.add-input::placeholder {
    color: var(--text-muted);
}

.add-input:focus {
    outline: none;
    border-style: solid;
    border-color: var(--accent-teal);
    background: var(--bg-elevated);
}

.add-input.hidden {
    display: none;
}

/* ========================================
   PRESSURE FIELDS
   ======================================== */
.pressure-field {
    margin-bottom: var(--space-md);
}

.pressure-field:last-of-type {
    margin-bottom: 0;
}

.field-label {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: var(--space-xs);
}

.pressure-textarea {
    width: 100%;
    font-family: var(--font-display);
    font-size: 0.9375rem;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-elevated);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    resize: vertical;
    min-height: 60px;
    transition: border-color var(--transition-fast);
}

.pressure-textarea::placeholder {
    color: var(--text-muted);
}

.pressure-textarea:focus {
    outline: none;
    border-color: var(--accent-teal);
}

/* ========================================
   DECISIONS
   ======================================== */
.decisions-list {
    margin-bottom: var(--space-md);
}

.decision-item {
    background: var(--bg-elevated);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
    position: relative;
}

.decision-item:last-child {
    margin-bottom: 0;
}

.decision-delete {
    position: absolute;
    top: var(--space-sm);
    right: var(--space-sm);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: var(--space-xs);
    font-size: 1rem;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.decision-item:hover .decision-delete {
    opacity: 1;
}

.decision-delete:hover {
    color: var(--energy-low);
}

.decision-field {
    margin-bottom: var(--space-sm);
}

.decision-field:last-child {
    margin-bottom: 0;
}

.decision-input {
    width: 100%;
    font-family: var(--font-display);
    font-size: 0.9375rem;
    padding: var(--space-sm);
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    transition: border-color var(--transition-fast);
}

.decision-input::placeholder {
    color: var(--text-muted);
}

.decision-input:focus {
    outline: none;
    border-color: var(--accent-teal);
}

.decision-input.main {
    font-weight: 500;
}

.add-btn {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    padding: var(--space-sm) var(--space-md);
    background: transparent;
    border: 1px dashed var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    width: 100%;
}

.add-btn:hover {
    border-color: var(--accent-teal);
    color: var(--accent-teal);
}

/* ========================================
   END OF DAY (Collapsible)
   ======================================== */
.collapsible .panel-header.clickable {
    cursor: pointer;
    user-select: none;
}

.collapsible .panel-header.clickable:hover {
    background: rgba(255, 255, 255, 0.02);
}

.collapse-indicator {
    font-size: 0.75rem;
    color: var(--text-muted);
    transition: transform var(--transition-normal);
}

.collapsible.collapsed .collapse-indicator {
    transform: rotate(-90deg);
}

.collapsible-content {
    max-height: 500px;
    overflow: hidden;
    transition: max-height var(--transition-normal), padding var(--transition-normal);
}

.collapsible.collapsed .collapsible-content {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
}

.eod-field {
    margin-bottom: var(--space-md);
}

.eod-field:last-of-type {
    margin-bottom: 0;
}

.eod-input {
    width: 100%;
    font-family: var(--font-display);
    font-size: 0.9375rem;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-elevated);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    transition: border-color var(--transition-fast);
}

.eod-input::placeholder {
    color: var(--text-muted);
}

.eod-input:focus {
    outline: none;
    border-color: var(--accent-teal);
}

/* ========================================
   WEEKLY VIEW
   ======================================== */
.week-header {
    margin-bottom: var(--space-lg);
}

.week-range {
    font-family: var(--font-mono);
    font-size: 1.125rem;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
}

.weekly-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-lg);
}

@media (max-width: 768px) {
    .weekly-grid {
        grid-template-columns: 1fr;
    }
}

.weekly-list {
    list-style: none;
}

.weekly-list-item {
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--glass-border);
    font-size: 0.9375rem;
}

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

.weekly-day {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-right: var(--space-sm);
}

.weekly-empty {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.875rem;
}

/* ========================================
   ENERGY CHART
   ======================================== */
.energy-chart {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    height: 120px;
    padding: var(--space-md) 0;
}

.chart-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    height: 100%;
}

.bar-fill {
    width: 24px;
    background: var(--glass-border);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    margin-top: auto;
    transition: all var(--transition-normal);
    min-height: 4px;
}

.bar-fill.low {
    background: var(--energy-low);
    height: 33%;
}

.bar-fill.medium {
    background: var(--energy-medium);
    height: 66%;
}

.bar-fill.high {
    background: var(--energy-high);
    height: 100%;
}

.bar-label {
    font-family: var(--font-mono);
    font-size: 0.625rem;
    color: var(--text-muted);
    margin-top: var(--space-sm);
    letter-spacing: 0.05em;
}

/* ========================================
   PRESSURE SUMMARY
   ======================================== */
.pressure-summary {
    font-size: 0.9375rem;
    line-height: 1.6;
}

.pressure-category {
    margin-bottom: var(--space-md);
}

.pressure-category:last-child {
    margin-bottom: 0;
}

.pressure-category-label {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.1em;
    margin-bottom: var(--space-xs);
}

.pressure-category-content {
    color: var(--text-secondary);
}

/* ========================================
   EXPORT
   ======================================== */
.export-section {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.export-btn {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    padding: var(--space-md) var(--space-xl);
    background: linear-gradient(135deg, var(--accent-magenta), var(--accent-teal));
    border: none;
    border-radius: var(--radius-md);
    color: var(--bg-deep);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.export-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(217, 70, 239, 0.3);
}

.export-btn:active {
    transform: translateY(0);
}

.export-status {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--accent-teal);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.export-status.visible {
    opacity: 1;
}

/* ========================================
   ARCHIVE
   ======================================== */
.archive-list {
    max-height: 400px;
    overflow-y: auto;
}

.archive-entry {
    padding: var(--space-md);
    background: var(--bg-elevated);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
}

.archive-entry:last-child {
    margin-bottom: 0;
}

.archive-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-sm);
}

.archive-date {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
}

.archive-energy {
    font-family: var(--font-mono);
    font-size: 0.625rem;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 100px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.archive-energy.low {
    background: rgba(239, 68, 68, 0.15);
    color: var(--energy-low);
}

.archive-energy.medium {
    background: rgba(245, 158, 11, 0.15);
    color: var(--energy-medium);
}

.archive-energy.high {
    background: rgba(34, 197, 94, 0.15);
    color: var(--energy-high);
}

.archive-win {
    font-size: 0.9375rem;
    color: var(--text-primary);
}

/* ========================================
   STATUS BAR
   ======================================== */
.status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) 0;
    margin-top: var(--space-lg);
    border-top: 1px solid var(--glass-border);
}

.save-status {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-teal);
    transition: background var(--transition-fast);
}

.status-dot.saving {
    background: var(--accent-amber);
    animation: pulse 1s ease-in-out infinite;
}

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

.status-text {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

.grounding-text {
    font-size: 0.8125rem;
    color: var(--text-muted);
    font-style: italic;
}

/* ========================================
   RESPONSIVE (Mobile: 375px)
   ======================================== */
@media (max-width: 640px) {
    .app {
        padding: var(--space-sm);
    }

    .header {
        flex-direction: column;
        gap: var(--space-md);
        align-items: flex-start;
    }

    .header-center {
        order: 3;
        width: 100%;
    }

    .view-toggle {
        width: 100%;
    }

    .toggle-btn {
        flex: 1;
        text-align: center;
    }

    .header-right {
        order: 2;
    }

    .panel-content {
        padding: var(--space-md);
    }

    .win-input {
        font-size: 1rem;
    }

    .energy-selector {
        flex-direction: column;
        align-items: flex-start;
    }

    .energy-buttons {
        width: 100%;
    }

    .energy-btn {
        flex: 1;
        text-align: center;
    }

    .status-bar {
        flex-direction: column;
        gap: var(--space-sm);
        align-items: flex-start;
    }

    .grounding-text {
        font-size: 0.75rem;
    }

    .export-section {
        flex-direction: column;
        align-items: stretch;
    }

    .export-btn {
        width: 100%;
    }

    .energy-chart {
        height: 100px;
    }

    .bar-fill {
        width: 20px;
    }
}

/* ========================================
   SCROLLBAR STYLING
   ======================================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-surface);
}

::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ========================================
   SELECTION STYLING
   ======================================== */
::selection {
    background: rgba(0, 212, 170, 0.3);
    color: var(--text-primary);
}
