/* bada.systems - Deep Ocean Research Control Panel */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --abyssal-dark: #0f1114;
    --deep-black: #050810;
    --panel-bg: #1b1f23;
    --teal: #0d7377;
    --amber: #f5a623;
    --crt-green: #39d353;
    --alert-red: #d14040;
    --parchment: #e8e0d4;
    --metal-light: #a0a5ad;
    --metal-mid: #8b8e94;
}

body {
    background-color: var(--abyssal-dark);
    font-family: 'Josefin Sans', sans-serif;
    color: var(--parchment);
    min-height: 100vh;
    overflow-x: hidden;
}

.control-panel {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-template-rows: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    padding: 16px;
    min-height: 100vh;
    background:
        radial-gradient(ellipse at 30% 40%, rgba(13, 115, 119, 0.03) 0%, transparent 50%),
        var(--abyssal-dark);
}

/* Panel Base Styles */
.panel {
    position: relative;
}

.panel-bezel {
    position: relative;
    height: 100%;
    background: var(--panel-bg);
    border: 2px solid #2a2f35;
    border-radius: 4px;
    padding: 32px 16px 16px;
    box-shadow:
        inset 0 1px 0 rgba(160, 165, 173, 0.1),
        0 4px 12px rgba(0, 0, 0, 0.5),
        0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Screws */
.screw {
    position: absolute;
    width: 10px;
    height: 10px;
    background: radial-gradient(circle at 3px 3px, #666, #333);
    border-radius: 50%;
    border: 1px solid #222;
    z-index: 2;
}
.screw::after {
    content: '';
    position: absolute;
    top: 4px;
    left: 2px;
    width: 6px;
    height: 1.5px;
    background: #222;
    transform: rotate(35deg);
}
.screw-tl { top: 6px; left: 6px; }
.screw-tr { top: 6px; right: 6px; }
.screw-bl { bottom: 6px; left: 6px; }
.screw-br { bottom: 6px; right: 6px; }

/* Label Plate */
.label-plate {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Jockey One', sans-serif;
    font-size: 0.7rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--metal-light);
    background: linear-gradient(180deg, #2a2f35, #1b1f23);
    padding: 2px 12px;
    border: 1px solid #3a3f45;
    border-radius: 2px;
    white-space: nowrap;
}

/* Panel Grid Placement */
.panel-station { grid-column: 1 / 5; grid-row: 1 / 2; }
.panel-sonar { grid-column: 5 / 13; grid-row: 1 / 3; }
.panel-pressure { grid-column: 1 / 4; grid-row: 2 / 4; }
.panel-controls { grid-column: 4 / 7; grid-row: 3 / 4; }
.panel-datafeed { grid-column: 7 / 13; grid-row: 3 / 5; }
.panel-temp { grid-column: 1 / 4; grid-row: 4 / 5; }
.panel-nav { grid-column: 4 / 7; grid-row: 4 / 5; }
.panel-status { grid-column: 1 / 7; grid-row: 5 / 6; }

/* Station Panel */
.station-name {
    font-family: 'Jockey One', sans-serif;
    font-size: clamp(1.5rem, 4vw, 3.5rem);
    letter-spacing: 0.2em;
    color: var(--teal);
    text-transform: uppercase;
    line-height: 1.0;
    text-shadow: 0 0 20px rgba(13, 115, 119, 0.5);
}

.station-subtitle {
    font-family: 'Josefin Sans', sans-serif;
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    color: var(--metal-mid);
    margin-top: 8px;
}

.indicator-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
}

.indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #333;
    border: 1px solid #555;
}
.indicator.green { background: var(--crt-green); box-shadow: 0 0 8px var(--crt-green); }
.indicator.amber { background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.indicator.red { background: var(--alert-red); box-shadow: 0 0 8px var(--alert-red); animation: blink 1.5s infinite; }
.indicator.active { animation: pulse-glow 2s infinite; }

.indicator-label {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.6rem;
    color: var(--metal-mid);
    margin-right: 8px;
}

/* Sonar Display */
.sonar-display {
    position: relative;
    background: var(--deep-black);
    border: 2px solid #1a2a2a;
    border-radius: 2px;
    overflow: hidden;
    height: 180px;
}

.sonar-display svg {
    width: 100%;
    height: 100%;
}

.sonar-trace {
    fill: none;
    stroke: var(--crt-green);
    stroke-width: 1.5;
    filter: drop-shadow(0 0 4px var(--crt-green));
}
.sonar-trace.ghost {
    opacity: 0.3;
    stroke-width: 1;
}

.sonar-grid {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        linear-gradient(rgba(13, 115, 119, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(13, 115, 119, 0.1) 1px, transparent 1px);
    background-size: 40px 30px;
    pointer-events: none;
}

.readout-row {
    display: flex;
    gap: 16px;
    margin-top: 12px;
}

.readout {
    display: flex;
    flex-direction: column;
}

.readout-label {
    font-family: 'Josefin Sans', sans-serif;
    font-size: 0.6rem;
    letter-spacing: 0.15em;
    color: var(--metal-mid);
}

.readout-value {
    font-family: 'Share Tech Mono', monospace;
    font-size: 1.1rem;
    color: var(--crt-green);
    text-shadow: 0 0 6px rgba(57, 211, 83, 0.5);
}

/* Pressure Gauge */
.gauge {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.gauge-svg {
    width: 140px;
    height: 140px;
}

.gauge-bg {
    fill: none;
    stroke: #2a2f35;
    stroke-width: 8;
    stroke-dasharray: 377;
    stroke-dashoffset: 94;
    transform: rotate(135deg);
    transform-origin: center;
}

.gauge-track {
    fill: none;
    stroke: var(--teal);
    stroke-width: 8;
    stroke-dasharray: 377;
    stroke-dashoffset: 200;
    transform: rotate(135deg);
    transform-origin: center;
    filter: drop-shadow(0 0 4px var(--teal));
    transition: stroke-dashoffset 1s ease;
}

.gauge-needle {
    stroke: var(--alert-red);
    stroke-width: 2;
    stroke-linecap: round;
    transform-origin: 100px 100px;
    transition: transform 1s ease;
}

.gauge-center {
    fill: #555;
    stroke: #333;
    stroke-width: 2;
}

.gauge-value {
    font-family: 'Share Tech Mono', monospace;
    font-size: 1rem;
    color: var(--amber);
    margin-top: 8px;
    text-shadow: 0 0 6px rgba(245, 166, 35, 0.4);
}

/* Toggle Switches */
.toggle-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.toggle-switch {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.toggle-label {
    font-family: 'Josefin Sans', sans-serif;
    font-size: 0.6rem;
    letter-spacing: 0.15em;
    color: var(--metal-mid);
}

.toggle {
    width: 36px;
    height: 20px;
    background: #2a2f35;
    border-radius: 10px;
    border: 1px solid #3a3f45;
    position: relative;
    transition: background 0.3s;
}

.toggle.active {
    background: rgba(13, 115, 119, 0.4);
    border-color: var(--teal);
}

.toggle-handle {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    background: linear-gradient(135deg, #aaa, #666);
    border-radius: 50%;
    transition: transform 0.3s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.toggle.active .toggle-handle {
    transform: translateX(16px);
}

/* Terminal / Data Feed */
.terminal-screen {
    background: var(--deep-black);
    border: 2px solid #1a2a2a;
    border-radius: 2px;
    padding: 12px;
    height: 200px;
    overflow: hidden;
    position: relative;
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.75rem;
    color: var(--crt-green);
    line-height: 1.6;
}

.terminal-screen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.1) 2px,
        rgba(0, 0, 0, 0.1) 4px
    );
    pointer-events: none;
    z-index: 1;
}

.terminal-cursor {
    display: inline-block;
    width: 7px;
    height: 12px;
    background: var(--crt-green);
    animation: blink 1s steps(1) infinite;
}

/* Temperature Bars */
.temp-bars {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    height: 100px;
    padding: 0 8px;
}

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

.bar-fill {
    width: 16px;
    background: var(--teal);
    border-radius: 2px 2px 0 0;
    position: absolute;
    bottom: 20px;
    transition: height 1s ease;
    box-shadow: 0 0 6px rgba(13, 115, 119, 0.4);
}

.bar-fill.warm { background: var(--amber); box-shadow: 0 0 6px rgba(245, 166, 35, 0.4); }
.bar-fill.hot { background: var(--alert-red); box-shadow: 0 0 6px rgba(209, 64, 64, 0.4); }

.bar-label {
    position: absolute;
    bottom: 0;
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.6rem;
    color: var(--metal-mid);
}

.temp-readout {
    text-align: center;
    margin-top: 8px;
}

/* Compass */
.compass {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.compass-svg {
    width: 130px;
    height: 130px;
}

.compass-ring {
    fill: none;
    stroke: #2a2f35;
    stroke-width: 3;
}

.compass-inner {
    fill: var(--deep-black);
    stroke: #1a2a2a;
    stroke-width: 1;
}

.compass-text {
    font-family: 'Josefin Sans', sans-serif;
    font-size: 14px;
    fill: var(--metal-mid);
    text-anchor: middle;
    dominant-baseline: middle;
}

.compass-needle {
    stroke: var(--alert-red);
    stroke-width: 2;
    stroke-linecap: round;
    transform-origin: 100px 100px;
    transition: transform 2s ease;
}

.compass-center {
    fill: var(--metal-light);
}

.heading-value {
    font-family: 'Share Tech Mono', monospace;
    font-size: 1rem;
    color: var(--amber);
    margin-top: 8px;
    text-shadow: 0 0 6px rgba(245, 166, 35, 0.4);
}

/* Status Items */
.status-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.8rem;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #333;
}
.status-indicator.green { background: var(--crt-green); box-shadow: 0 0 6px var(--crt-green); }
.status-indicator.amber { background: var(--amber); box-shadow: 0 0 6px var(--amber); }
.status-indicator.red { background: var(--alert-red); box-shadow: 0 0 6px var(--alert-red); animation: blink 1.5s infinite; }

.status-text {
    font-family: 'Josefin Sans', sans-serif;
    color: var(--metal-light);
    flex: 1;
}

.status-val {
    font-family: 'Share Tech Mono', monospace;
    color: var(--crt-green);
    font-size: 0.75rem;
}

/* Animations */
@keyframes blink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0.3; }
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 6px var(--crt-green); }
    50% { box-shadow: 0 0 14px var(--crt-green), 0 0 20px rgba(57, 211, 83, 0.3); }
}

/* Power-on animation */
.panel {
    opacity: 0;
    transform: scale(0.98);
    animation: power-on 0.6s ease forwards;
}

.panel:nth-child(1) { animation-delay: 0.1s; }
.panel:nth-child(2) { animation-delay: 0.25s; }
.panel:nth-child(3) { animation-delay: 0.4s; }
.panel:nth-child(4) { animation-delay: 0.55s; }
.panel:nth-child(5) { animation-delay: 0.7s; }
.panel:nth-child(6) { animation-delay: 0.85s; }
.panel:nth-child(7) { animation-delay: 1.0s; }
.panel:nth-child(8) { animation-delay: 1.15s; }

@keyframes power-on {
    0% { opacity: 0; transform: scale(0.98); }
    60% { opacity: 1; }
    100% { opacity: 1; transform: scale(1); }
}

/* Responsive */
@media (max-width: 900px) {
    .control-panel {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto;
    }
    .panel-station { grid-column: 1 / -1; grid-row: auto; }
    .panel-sonar { grid-column: 1 / -1; grid-row: auto; }
    .panel-pressure { grid-column: 1 / 2; grid-row: auto; }
    .panel-controls { grid-column: 2 / 3; grid-row: auto; }
    .panel-datafeed { grid-column: 1 / -1; grid-row: auto; }
    .panel-temp { grid-column: 1 / 2; grid-row: auto; }
    .panel-nav { grid-column: 2 / 3; grid-row: auto; }
    .panel-status { grid-column: 1 / -1; grid-row: auto; }
}
