/* ============================================
   infra.day - Engineering Blueprint Interface
   ============================================ */

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

html {
    scroll-behavior: smooth;
}

body {
    background: #0C1117;
    color: #CFD8DC;
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 400;
    font-size: 0.9rem;
    line-height: 1.7;
    overflow-x: hidden;
}

/* ============================================
   Hero Section - Blueprint Header
   ============================================ */
#hero {
    position: relative;
    width: 100%;
    height: 100vh;
    background: #0C1117;
    overflow: hidden;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
}

/* Background Schematic SVG */
#schematic-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 600ms ease;
}

#schematic-bg.visible {
    opacity: 1;
}

.schematic-line {
    stroke: #00BCD4;
    stroke-width: 1;
    opacity: 0.3;
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    fill: none;
    transition: stroke-dashoffset 1200ms ease-out;
}

.schematic-line.drawn {
    stroke-dashoffset: 0;
}

.junction {
    fill: none;
    stroke: #00BCD4;
    stroke-width: 1;
    opacity: 0.3;
}

.valve {
    fill: #00BCD4;
    opacity: 0.2;
}

.switch-sym {
    fill: none;
    stroke: #00BCD4;
    stroke-width: 1;
    opacity: 0.25;
}

/* Frame Lines - drawing animation */
.frame-line {
    position: absolute;
    background: #00BCD4;
    opacity: 0;
}

.frame-line.animate {
    opacity: 0.6;
}

#frame-top {
    top: 30px;
    left: 30px;
    height: 1px;
    width: 0;
}

#frame-top.animate {
    width: calc(100% - 60px);
    transition: width 600ms ease-out;
}

#frame-right {
    top: 30px;
    right: 30px;
    width: 1px;
    height: 0;
}

#frame-right.animate {
    height: calc(100% - 60px);
    transition: height 600ms ease-out 100ms;
}

#frame-bottom {
    bottom: 30px;
    right: 30px;
    height: 1px;
    width: 0;
}

#frame-bottom.animate {
    width: calc(100% - 60px);
    transition: width 600ms ease-out 200ms;
}

#frame-left {
    bottom: 30px;
    left: 30px;
    width: 1px;
    height: 0;
}

#frame-left.animate {
    height: calc(100% - 60px);
    transition: height 600ms ease-out 300ms;
}

/* Title Block - lower right corner */
#title-block {
    position: absolute;
    bottom: 60px;
    right: 60px;
    z-index: 10;
    opacity: 0;
    transition: opacity 400ms ease;
}

#title-block.visible {
    opacity: 1;
}

.title-block-outer {
    border: 1px solid rgba(0, 188, 212, 0.6);
}

.title-block-row {
    display: flex;
}

.title-block-header {
    border-bottom: 1px solid rgba(0, 188, 212, 0.4);
}

.title-block-cell {
    padding: 8px 16px;
    border-right: 1px solid rgba(0, 188, 212, 0.4);
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 100px;
}

.title-block-cell:last-child {
    border-right: none;
}

.title-cell-main {
    min-width: 300px;
    padding: 12px 20px;
}

.title-label {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.6rem;
    color: #546E7A;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.title-value {
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(1rem, 1.5vw, 1.2rem);
    color: #00BCD4;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.title-cell-main .title-value {
    font-size: clamp(1.8rem, 3vw, 2.5rem);
}

/* ============================================
   System Panel - Fixed Left Sidebar
   ============================================ */
#system-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    background: #0A0E13;
    border-right: 1px solid rgba(0, 188, 212, 0.4);
    z-index: 100;
    display: flex;
    flex-direction: column;
    padding: 30px 0;
    opacity: 0;
    transform: translateX(-20px);
    transition: opacity 400ms ease, transform 400ms ease;
}

#system-panel.visible {
    opacity: 1;
    transform: translateX(0);
}

.panel-header {
    padding: 0 20px 20px;
    border-bottom: 1px solid rgba(0, 188, 212, 0.2);
    margin-bottom: 20px;
}

.panel-title {
    display: block;
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(1rem, 1.5vw, 1.2rem);
    color: #00BCD4;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 4px;
}

.panel-subtitle {
    display: block;
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.7rem;
    color: #546E7A;
    letter-spacing: 0.05em;
}

/* Navigation */
.panel-nav {
    flex: 1;
    padding: 0 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    text-decoration: none;
    border-left: 2px solid transparent;
    transition: border-color 200ms ease, color 200ms ease;
}

.nav-link .nav-text {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.75rem;
    color: #546E7A;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: color 200ms ease;
}

.nav-link.active {
    border-left-color: #00BCD4;
}

.nav-link.active .nav-text {
    color: #00BCD4;
}

.nav-link:hover .nav-text {
    color: #CFD8DC;
}

/* Status Indicators */
.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-green {
    background: #4CAF50;
}

.status-amber {
    background: #FFB300;
}

.status-red {
    background: #E53935;
}

.nav-link.active .status-indicator {
    animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* Panel Schematic */
.panel-schematic {
    padding: 16px 20px;
    border-top: 1px solid rgba(0, 188, 212, 0.15);
    border-bottom: 1px solid rgba(0, 188, 212, 0.15);
    margin: 10px 0;
}

.mini-schematic {
    width: 100%;
    height: auto;
}

/* Panel Footer */
.panel-footer {
    padding: 16px 20px 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.panel-status-text {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.7rem;
    color: #4CAF50;
    letter-spacing: 0.05em;
}

.panel-uptime {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.65rem;
    color: #546E7A;
}

/* ============================================
   Main Content Area
   ============================================ */
#content {
    margin-left: 280px;
    padding: 40px 40px 40px 80px;
    max-width: calc(280px + 720px + 120px);
    position: relative;
}

/* Background grid - engineering graph paper */
#content::before {
    content: '';
    position: fixed;
    top: 0;
    left: 280px;
    right: 0;
    bottom: 0;
    background-image:
        linear-gradient(rgba(0, 188, 212, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 188, 212, 0.05) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
    z-index: 0;
}

/* ============================================
   Content Sections
   ============================================ */
.content-section {
    position: relative;
    z-index: 1;
    margin-bottom: 60px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 300ms ease, transform 300ms ease;
}

.content-section.visible {
    opacity: 1;
    transform: translateY(0);
}

.section-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.section-number {
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(1.8rem, 3vw, 2.5rem);
    color: rgba(0, 188, 212, 0.2);
    letter-spacing: 0.08em;
    font-weight: 400;
    line-height: 1;
}

.section-header h2 {
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(1rem, 1.5vw, 1.2rem);
    font-weight: 400;
    color: #00BCD4;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    white-space: nowrap;
}

.section-line {
    flex: 1;
    height: 1px;
    background: rgba(0, 188, 212, 0.2);
}

.section-body {
    max-width: 720px;
}

.section-body p {
    margin-bottom: 20px;
    color: #CFD8DC;
    line-height: 1.7;
}

/* ============================================
   Spec Blocks
   ============================================ */
.spec-block {
    border: 1px solid rgba(0, 188, 212, 0.2);
    margin: 20px 0;
}

.spec-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid rgba(0, 188, 212, 0.1);
}

.spec-row:last-child {
    border-bottom: none;
}

.spec-row:nth-child(odd) {
    background: #0A0E13;
}

.spec-row:nth-child(even) {
    background: #0C1117;
}

.spec-label {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.75rem;
    color: #546E7A;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.spec-value {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.8rem;
    color: #00BCD4;
}

/* ============================================
   Specification Tables
   ============================================ */
.table-container {
    margin: 20px 0;
    overflow-x: auto;
}

.spec-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.8rem;
}

.spec-table th,
.spec-table td {
    border: 1px solid rgba(0, 188, 212, 0.3);
    padding: 10px 14px;
    text-align: left;
}

.spec-table thead tr {
    background: #0A0E13;
}

.spec-table th {
    color: #00BCD4;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.75rem;
}

.spec-table tbody tr:nth-child(odd) {
    background: #0C1117;
}

.spec-table tbody tr:nth-child(even) {
    background: #0A0E13;
}

.spec-table tbody tr {
    transition: background 150ms ease;
}

.spec-table tbody tr:hover {
    background: rgba(0, 188, 212, 0.05);
}

.spec-table td {
    color: #CFD8DC;
}

.status-cell {
    font-weight: 400;
}

.status-cell.status-online {
    color: #4CAF50;
}

.status-cell.status-warning {
    color: #FFB300;
}

.status-cell.status-offline {
    color: #E53935;
}

/* ============================================
   Network Diagram
   ============================================ */
.network-diagram {
    margin: 24px 0;
    border: 1px solid rgba(0, 188, 212, 0.15);
    background: rgba(10, 14, 19, 0.5);
    padding: 20px;
}

.topology-svg {
    width: 100%;
    height: auto;
    max-height: 200px;
}

/* ============================================
   Pipeline Visual
   ============================================ */
.pipeline-visual {
    margin: 24px 0;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.pipeline-stage {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    border: 1px solid rgba(0, 188, 212, 0.15);
    border-bottom: none;
    background: #0A0E13;
}

.pipeline-stage:last-child {
    border-bottom: 1px solid rgba(0, 188, 212, 0.15);
}

.pipeline-connector {
    width: 2px;
    height: 16px;
    background: #4CAF50;
    margin-left: 22px;
}

.pipeline-connector-pending {
    background: #546E7A;
    border-left: 2px dashed #546E7A;
    width: 0;
}

.stage-indicator {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
}

.stage-complete {
    background: #4CAF50;
}

.stage-active {
    background: #FFB300;
    animation: statusPulse 2s ease-in-out infinite;
}

.stage-pending {
    background: transparent;
    border: 1px solid #546E7A;
}

.stage-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stage-name {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.8rem;
    color: #00BCD4;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stage-detail {
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 0.8rem;
    color: #546E7A;
}

/* ============================================
   Metrics Grid
   ============================================ */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    margin: 24px 0;
}

.metric-card {
    border: 1px solid rgba(0, 188, 212, 0.2);
    padding: 20px 16px;
    background: #0A0E13;
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: center;
}

.metric-value {
    font-family: 'Share Tech Mono', monospace;
    font-size: 1.6rem;
    color: #00BCD4;
    letter-spacing: 0.02em;
}

.metric-label {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.65rem;
    color: #546E7A;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.metric-status {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.metric-status-green {
    color: #4CAF50;
}

.metric-status-amber {
    color: #FFB300;
}

/* ============================================
   Footer Seal
   ============================================ */
#footer-seal {
    position: relative;
    z-index: 1;
    margin-top: 80px;
    padding: 60px 0;
    border-top: 1px solid rgba(0, 188, 212, 0.15);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

.approval-stamp {
    display: flex;
    justify-content: center;
}

.stamp-circle {
    width: 140px;
    height: 140px;
    border: 2px solid rgba(0, 188, 212, 0.4);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    position: relative;
}

.stamp-circle::before {
    content: '';
    position: absolute;
    width: 130px;
    height: 130px;
    border: 1px solid rgba(0, 188, 212, 0.2);
    border-radius: 50%;
}

.stamp-text-top {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.55rem;
    color: #546E7A;
    text-transform: uppercase;
    letter-spacing: 0.15em;
}

.stamp-text-main {
    font-family: 'Share Tech Mono', monospace;
    font-size: 1.1rem;
    color: #00BCD4;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.stamp-text-date {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.7rem;
    color: #546E7A;
}

.stamp-text-bottom {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.55rem;
    color: #546E7A;
    text-transform: uppercase;
    letter-spacing: 0.15em;
}

.footer-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.footer-text {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.65rem;
    color: #546E7A;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* ============================================
   Table Border Drawing Animation
   ============================================ */
.spec-table.draw-borders th,
.spec-table.draw-borders td {
    border-color: transparent;
    transition: border-color 200ms ease;
}

.spec-table.borders-visible th,
.spec-table.borders-visible td {
    border-color: rgba(0, 188, 212, 0.3);
}

/* ============================================
   Scrollbar Styling
   ============================================ */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #0A0E13;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 188, 212, 0.2);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 188, 212, 0.4);
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 900px) {
    #system-panel {
        width: 220px;
    }

    #content {
        margin-left: 220px;
        padding: 30px 20px 30px 40px;
    }

    #content::before {
        left: 220px;
    }

    .title-cell-main {
        min-width: 200px;
    }

    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    #system-panel {
        display: none;
    }

    #content {
        margin-left: 0;
        padding: 20px;
    }

    #content::before {
        left: 0;
    }

    .title-cell-main {
        min-width: 160px;
    }

    #title-block {
        right: 20px;
        bottom: 30px;
    }

    .title-block-row {
        flex-wrap: wrap;
    }

    .metrics-grid {
        grid-template-columns: 1fr 1fr;
    }
}