/* ============================================
   GOLDEN RATIO TYPOGRAPHY & SPACING SCALE
   φ = 1.618  |  step = √φ ≈ 1.272  |  base = 16 px
   Fibonacci spacing: 5 – 8 – 13 – 21 – 34 – 55
   ============================================ */
:root {
    --fs-xs:   10px;   /* base ÷ φ          */
    --fs-sm:   13px;   /* base ÷ √φ         */
    --fs-base: 16px;   /* body / table text  */
    --fs-md:   20px;   /* section headings   */
    --fs-lg:   26px;   /* page headings      */
    --fs-xl:   33px;   /* hero / login h1    */
    --fs-2xl:  42px;   /* display / icons    */
    --fs-3xl:  52px;   /* jumbo display      */
}

/* Search result highlight in tables */

.search-highlight, .search-highlight-flash {
    background: linear-gradient(90deg, #90ee90 0%, #b8f7b8 100%) !important;
    box-shadow: 0 0 16px 4px #90ee90cc, 0 0 0 4px #FFCC6699 inset;
    border: 3px solid #90ee90;
    outline: 2px solid #FFCC66;
    transition: background 0.3s, box-shadow 0.3s, border 0.3s, outline 0.3s;
}
/* Primes Table Responsive Fix */
.primes-table-container {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    margin-bottom: 40px;
}
.primes-table-title {
    color: #ff9900;
    font-size: var(--fs-md);
    margin-bottom: 8px;
}
.table-container {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
}
.data-table th, .data-table td {
    white-space: nowrap;
    padding: 8px 13px;
    border: 1px solid #232b3d;
    background: rgba(30,37,53,0.95);
    color: #FF9933;
    font-size: var(--fs-base);
}
.data-table th {
    background: #232b3d;
    color: #FFCC66;
    font-weight: bold;
}
@media (max-width: 1024px) {
    .primes-table-container, .table-container, .data-table {
        max-width: 100vw;
        overflow-x: auto;
    }
}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100%;
    overflow-x: hidden;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f1419 100%);
    background-attachment: fixed;
    color: #FF9933;
    min-height: 100vh;
    padding: 21px;
    overflow-x: hidden;
    font-size: var(--fs-base);
    line-height: 1.618;
}

/* LCARS Frame */
.lcars-frame {
    width: 100%;
    max-width: 1800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-height: auto;
}

/* Top and Bottom Bars */
.lcars-bar {
    display: flex;
    align-items: center;
    height: 60px;
    gap: 10px;
    flex-shrink: 0;
}

.lcars-corner {
    width: 150px;
    height: 60px;
    background: linear-gradient(135deg, #CC6699 0%, #AA4488 100%);
    position: relative;
    box-shadow: 0 4px 15px rgba(204, 102, 153, 0.3);
}

.top-left {
    border-radius: 0 0 60px 0;
}

.bottom-left {
    border-radius: 0 60px 0 0;
}

.lcars-text {
    background: linear-gradient(135deg, #6699FF 0%, #4477DD 100%);
    padding: 13px 34px;
    font-size: var(--fs-lg);
    font-weight: bold;
    letter-spacing: 3px;
    color: #1a1a2e;
    flex-grow: 1;
    text-align: center;
    box-shadow: 0 4px 15px rgba(102, 153, 255, 0.3);
}

.lcars-bracket {
    width: 150px;
    height: 60px;
    background: linear-gradient(135deg, #FF9933 0%, #FFCC66 100%);
    box-shadow: 0 4px 15px rgba(255, 153, 51, 0.3);
}

.lcars-bracket.right {
    border-radius: 60px 0 0 60px;
}

/* Main Container */
.main-container {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 20px;
    width: 100%;
    min-width: 0;
}

/* Sidebars */
.sidebar {
    flex: 0 0 150px;
    width: 150px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sidebar.right {
    order: 2;
}

.lcars-button {
    background: linear-gradient(135deg, #FF9933 0%, #FFCC66 100%);
    padding: 13px;
    border-radius: 21px;
    text-align: center;
    font-weight: bold;
    font-size: var(--fs-base);
    color: #1a1a2e;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: block;
    box-shadow: 0 4px 10px rgba(255, 153, 51, 0.2);
}

.lcars-button:hover {
    background: linear-gradient(135deg, #FFCC66 0%, #FF9933 100%);
    box-shadow: 0 6px 20px rgba(255, 153, 51, 0.4);
    transform: translateY(-2px);
}

.lcars-button.inactive {
    background: linear-gradient(135deg, #4a5568 0%, #5a6478 100%);
    cursor: not-allowed;
    opacity: 0.6;
}

.lcars-button.inactive:hover {
    background: linear-gradient(135deg, #4a5568 0%, #5a6478 100%);
    box-shadow: none;
    transform: none;
}

.lcars-button.active {
    background: linear-gradient(135deg, #99ff99 0%, #66ff66 100%);
    box-shadow: 0 0 20px rgba(153, 255, 153, 0.8), inset 0 2px 10px rgba(255, 255, 255, 0.3);
    animation: pulse-glow 2s ease-in-out infinite;
}

.lcars-button.active:hover {
    transform: translateY(-2px);
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(153, 255, 153, 0.8), inset 0 2px 10px rgba(255, 255, 255, 0.3);
    }
    50% {
        box-shadow: 0 0 35px rgba(153, 255, 153, 1), inset 0 2px 15px rgba(255, 255, 255, 0.4);
    }
}

.lcars-divider {
    height: 20px;
    background: linear-gradient(135deg, #CC6699 0%, #AA4488 100%);
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(204, 102, 153, 0.2);
}

/* Content Area */
.content-area {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 21px;
    background: linear-gradient(135deg, #1e2535 0%, #232b3d 100%);
    padding: 34px;
    border: 3px solid rgba(102, 153, 255, 0.5);
    border-radius: 34px;
    box-shadow: inset 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* Login Panel */
.login-panel {
    background: linear-gradient(135deg, rgba(102, 153, 255, 0.1) 0%, rgba(204, 102, 153, 0.1) 100%);
    padding: 34px;
    border-radius: 21px;
    border: 2px solid rgba(102, 153, 255, 0.5);
    box-shadow: 0 8px 30px rgba(102, 153, 255, 0.2);
}

.login-panel h1 {
    font-size: var(--fs-xl);
    color: #FF9933;
    letter-spacing: 5px;
    margin-bottom: 13px;
    text-align: center;
    text-shadow: 0 2px 10px rgba(255, 153, 51, 0.3);
}

.status-line {
    text-align: center;
    color: #6699FF;
    font-size: var(--fs-base);
    letter-spacing: 2px;
    margin-bottom: 34px;
    padding-bottom: 21px;
    border-bottom: 2px solid rgba(102, 153, 255, 0.3);
}

/* Form Styles */
.input-group {
    margin-bottom: 25px;
}

.input-group label {
    display: block;
    color: #FF9933;
    font-size: var(--fs-base);
    font-weight: bold;
    letter-spacing: 2px;
    margin-bottom: 8px;
}

.input-group input {
    width: 100%;
    padding: 13px 21px;
    background: rgba(26, 26, 46, 0.8);
    border: 2px solid rgba(102, 153, 255, 0.4);
    border-radius: 26px;
    color: #FFCC66;
    font-size: var(--fs-base);
    font-family: 'Courier New', monospace;
    outline: none;
    transition: all 0.3s;
}

.input-group input:focus {
    border-color: #FF9933;
    box-shadow: 0 0 20px rgba(255, 153, 51, 0.4);
    background: rgba(26, 26, 46, 0.95);
}

.input-group input::placeholder {
    color: rgba(102, 153, 255, 0.4);
}

/* Buttons */
.button-group {
    display: flex;
    gap: 20px;
    margin-top: 30px;
}

.lcars-submit,
.lcars-reset {
    flex: 1;
    padding: 13px 34px;
    border: none;
    border-radius: 34px;
    font-size: var(--fs-base);
    font-weight: bold;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.3s;
}

.lcars-submit {
    background: linear-gradient(135deg, #FF9933 0%, #FFCC66 100%);
    color: #1a1a2e;
    box-shadow: 0 4px 15px rgba(255, 153, 51, 0.3);
}

.lcars-submit:hover {
    background: linear-gradient(135deg, #FFCC66 0%, #FF9933 100%);
    box-shadow: 0 6px 25px rgba(255, 153, 51, 0.5);
    transform: translateY(-2px);
}

.lcars-reset {
    background: linear-gradient(135deg, #CC6699 0%, #AA4488 100%);
    color: #1a1a2e;
    box-shadow: 0 4px 15px rgba(204, 102, 153, 0.3);
}

.lcars-reset:hover {
    background: linear-gradient(135deg, #AA4488 0%, #CC6699 100%);
    box-shadow: 0 6px 25px rgba(204, 102, 153, 0.5);
    transform: translateY(-2px);
}

/* Message */
.message {
    margin-top: 20px;
    padding: 15px;
    border-radius: 15px;
    text-align: center;
    font-weight: bold;
    letter-spacing: 1px;
    display: none;
}

.message.show {
    display: block;
}

.message.success {
    background: rgba(0, 255, 0, 0.2);
    border: 2px solid #0f0;
    color: #0f0;
}

.message.error {
    background: rgba(255, 0, 0, 0.2);
    border: 2px solid #f00;
    color: #f00;
}

/* Info Panel */
.info-panel {
    background: linear-gradient(135deg, rgba(204, 102, 153, 0.15) 0%, rgba(102, 153, 255, 0.15) 100%);
    padding: 20px;
    border-radius: 20px;
    border: 2px solid rgba(204, 102, 153, 0.4);
    display: flex;
    justify-content: space-around;
    box-shadow: 0 4px 20px rgba(204, 102, 153, 0.2);
}

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

.info-item .label {
    color: #6699FF;
    font-size: var(--fs-sm);
    letter-spacing: 1px;
}

.info-item .value {
    color: #FF9933;
    font-size: var(--fs-md);
    font-weight: bold;
    font-family: 'Courier New', monospace;
    text-shadow: 0 2px 8px rgba(255, 153, 51, 0.3);
}

.status-active {
    color: #90ee90 !important;
    text-shadow: 0 0 10px rgba(144, 238, 144, 0.5);
}

.status-alert {
    color: #ff6b6b !important;
    text-shadow: 0 0 10px rgba(255, 107, 107, 0.5);
}

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

.status-alert {
    animation: blink 1.5s infinite;
}

/* Navigation Grid */
.navigation-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.nav-card {
    background: linear-gradient(135deg, rgba(102, 153, 255, 0.12) 0%, rgba(204, 102, 153, 0.12) 100%);
    border: 2px solid rgba(102, 153, 255, 0.4);
    border-radius: 15px;
    padding: 30px 20px;
    text-align: center;
    text-decoration: none;
    color: #FF9933;
    transition: all 0.3s;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(102, 153, 255, 0.15);
}

.nav-card:hover {
    background: linear-gradient(135deg, rgba(102, 153, 255, 0.2) 0%, rgba(204, 102, 153, 0.2) 100%);
    border-color: #FF9933;
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(255, 153, 51, 0.3);
}

.nav-card.inactive {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.nav-card-icon {
    font-size: var(--fs-2xl);
}

.nav-card-title {
    font-size: var(--fs-md);
    font-weight: bold;
    letter-spacing: 2px;
}

.nav-card-desc {
    font-size: var(--fs-sm);
    color: #6699FF;
}

/* Breadcrumb Navigation */
.breadcrumb {
    padding: 8px 0;
    font-size: var(--fs-sm);
    color: #999;
    letter-spacing: 1px;
}

.breadcrumb-link {
    color: #6699FF;
    text-decoration: none;
    transition: color 0.3s;
}

.breadcrumb-link:hover {
    color: #FF9933;
}

.breadcrumb-separator {
    color: #666;
    margin: 0 5px;
}

.breadcrumb-current {
    color: #FF9933;
}

/* Stardate Display */
.stardate-display {
    background: linear-gradient(135deg, rgba(255, 153, 51, 0.2) 0%, rgba(255, 204, 102, 0.2) 100%);
    border: 2px solid rgba(255, 153, 51, 0.4);
    border-radius: 13px;
    padding: 13px;
    text-align: center;
    font-family: 'Courier New', monospace;
    font-size: var(--fs-base);
    font-weight: bold;
    color: #FF9933;
    letter-spacing: 1px;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

/* Hamburger Menu Button (hidden on desktop) */
.hamburger-menu {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 10000;
    background: linear-gradient(135deg, #FF9933 0%, #FFCC66 100%);
    border: none;
    border-radius: 8px;
    padding: 10px 12px;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(255, 153, 51, 0.4);
}

.hamburger-menu span {
    display: block;
    width: 22px;
    height: 3px;
    background: #1a1a2e;
    margin: 4px 0;
    border-radius: 2px;
    transition: all 0.3s;
}

.hamburger-menu.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}
.hamburger-menu.active span:nth-child(2) {
    opacity: 0;
}
.hamburger-menu.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Mobile menu overlay */
.mobile-nav-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9998;
}

.mobile-nav-overlay.active {
    display: block;
}

/* ── Tablet: 1024px ── */
@media (max-width: 1024px) {
    .sidebar {
        flex: 0 0 110px;
        width: 110px;
    }

    .lcars-button {
        font-size: var(--fs-sm);
        padding: 13px;
    }

    .lcars-text {
        font-size: var(--fs-md);
        padding: 13px 13px;
    }

    .lcars-corner {
        width: 100px;
    }

    .lcars-bracket {
        width: 100px;
    }

    .content-area {
        padding: 21px;
    }

    .login-panel {
        padding: 26px;
    }
}

/* ── Mobile: 768px ── */
@media (max-width: 768px) {
    body {
        padding: 8px;
    }

    .hamburger-menu {
        display: block;
    }

    /* LCARS Frame */
    .lcars-frame {
        gap: 8px;
    }

    /* Top / Bottom bars */
    .lcars-bar {
        height: 44px;
        gap: 4px;
    }

    .lcars-corner {
        width: 50px;
        height: 44px;
    }

    .lcars-text {
        font-size: var(--fs-base);
        padding: 8px 8px;
        letter-spacing: 1px;
    }

    .lcars-bracket {
        width: 70px;
        height: 44px;
        font-size: var(--fs-sm) !important;
        letter-spacing: 1px !important;
    }

    /* Main layout → column */
    .main-container {
        flex-direction: column;
        gap: 8px;
    }

    /* Sidebars hidden by default on mobile, shown via hamburger */
    .sidebar {
        display: none;
        width: 100%;
        flex: 0 0 auto;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 6px;
        padding: 8px 0;
    }

    .sidebar.mobile-visible {
        display: flex;
    }

    .sidebar.left {
        order: -1;
    }

    .sidebar.right {
        order: 3;
    }

    .lcars-button {
        font-size: var(--fs-sm);
        padding: 8px 13px;
        border-radius: 13px;
        flex: 0 0 auto;
        white-space: nowrap;
    }

    .lcars-divider {
        display: none;
    }

    /* Content area full width */
    .content-area {
        order: 1;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 13px;
        border-radius: 13px;
        gap: 13px;
    }

    /* Login Panel */
    .login-panel {
        padding: 21px 13px;
    }

    .login-panel h1 {
        font-size: var(--fs-lg);
        letter-spacing: 2px;
    }

    .status-line {
        font-size: var(--fs-sm);
        margin-bottom: 13px;
        padding-bottom: 8px;
    }

    /* Forms */
    .input-group input {
        padding: 13px 13px;
        font-size: var(--fs-base);
    }

    .button-group {
        flex-direction: column;
        gap: 8px;
    }

    .lcars-submit, .lcars-reset {
        padding: 13px 21px;
        font-size: var(--fs-base);
    }

    /* Info Panel */
    .info-panel {
        flex-direction: column;
        gap: 13px;
        padding: 13px;
    }

    .info-item .value {
        font-size: var(--fs-base);
    }

    /* Navigation Grid */
    .navigation-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 10px;
    }

    .nav-card {
        padding: 18px 12px;
    }

    .nav-card-icon {
        font-size: var(--fs-xl);
    }

    .nav-card-title {
        font-size: var(--fs-base);
    }

    /* Tables */
    .data-table th, .data-table td {
        padding: 5px 8px;
        font-size: var(--fs-sm);
    }

    /* Stardate */
    .stardate-display {
        font-size: var(--fs-sm);
        padding: 8px;
    }
}

/* ── Small phones: 480px ── */
@media (max-width: 480px) {
    body {
        padding: 4px;
    }

    .lcars-bar {
        height: 36px;
    }

    .lcars-corner {
        width: 36px;
        height: 36px;
    }

    .lcars-text {
        font-size: var(--fs-sm);
        padding: 8px 5px;
        letter-spacing: 0.5px;
    }

    .lcars-bracket {
        width: 50px;
        height: 36px;
        font-size: var(--fs-xs) !important;
    }

    .content-area {
        padding: 10px;
        border-radius: 10px;
        border-width: 2px;
    }

    .login-panel h1 {
        font-size: var(--fs-md);
    }

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

    .nav-card {
        padding: 13px 8px;
    }

    .nav-card-icon {
        font-size: var(--fs-lg);
    }

    .nav-card-title {
        font-size: var(--fs-sm);
        letter-spacing: 1px;
    }

    .nav-card-desc {
        font-size: var(--fs-xs);
    }
}
