/**
 * StarGrid Web - Main Theme & Base Styles
 * Cyberpunk Deep Space Aesthetic
 */

:root {
    /* Brand Colors */
    --star-red-primary: #d32f2f;
    --star-red-dark: #9a0007;
    --star-red-light: #ff6659;
    --star-red-container: #3e0a0a;

    --star-steel-secondary: #546e7a;
    --star-steel-light: #cfd8dc;

    --star-cyan-primary: #00e5ff;
    --star-cyan-dark: #003e4b;
    --star-cyan-light: #9ef8ff;

    --star-emerald: #00e676;
    --star-amber: #ff9d00;
    --star-purple: #8b5cf6;
    --star-pink: #ec4899;

    /* Backgrounds & Surfaces */
    --bg-dark-void: #090d13;
    --bg-dark-base: #0d1117;
    --bg-dark-surface: #161b22;
    --bg-dark-elevated: #21262d;

    /* Borders */
    --border-subtle: #30363d;
    --border-accent: #444c56;
    --border-glow-cyan: rgba(0, 229, 255, 0.4);
    --border-glow-red: rgba(211, 47, 47, 0.4);

    /* Text */
    --text-primary: #f0f6fc;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;

    /* Fonts */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
}

html, body {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background-color: var(--bg-dark-base);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 14px;
}

/* App Shell Layout */
#app {
    display: flex;
    flex-direction: column;
    width: 100vw;
    height: 100vh;
    background-color: var(--bg-dark-base);
}

/* Top App Header */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    padding: 0 20px;
    background-color: var(--bg-dark-surface);
    border-bottom: 1px solid var(--border-subtle);
    z-index: 50;
}

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

.ship-info-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ship-title {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: var(--star-cyan-primary);
    text-transform: uppercase;
}

.hold-stats-badge {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stat-pill {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    font-family: var(--font-mono);
    border: 1px solid var(--border-subtle);
    background-color: var(--bg-dark-elevated);
}

.stat-pill.occupied {
    color: var(--star-emerald);
    border-color: rgba(0, 230, 118, 0.3);
}

.stat-pill.available {
    color: var(--star-steel-light);
    border-color: rgba(207, 216, 220, 0.3);
}

.stat-pill.capacity {
    color: var(--star-cyan-primary);
    border-color: rgba(0, 229, 255, 0.3);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* StarGrid Logo Branding */
.brand-logo {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    text-decoration: none;
}

.brand-text {
    font-family: var(--font-mono);
    font-weight: 900;
    font-size: 18px;
    letter-spacing: 2px;
}

.brand-star {
    color: var(--star-steel-light);
}

.brand-grid {
    color: var(--star-red-primary);
    text-shadow: 0 0 10px var(--border-glow-red);
}

.brand-sub {
    font-family: var(--font-mono);
    font-size: 8px;
    font-weight: 800;
    letter-spacing: 1.5px;
    color: var(--star-cyan-primary);
}

/* App Main Body */
.app-body {
    display: flex;
    flex: 1;
    height: calc(100vh - 60px);
    overflow: hidden;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 700;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
}

.btn-primary {
    background-color: var(--star-cyan-primary);
    color: #000;
}

.btn-primary:hover {
    background-color: #33ebff;
    box-shadow: 0 0 12px var(--border-glow-cyan);
}

.btn-secondary {
    background-color: var(--bg-dark-surface);
    color: var(--text-primary);
    border-color: var(--border-subtle);
}

.btn-secondary:hover {
    background-color: var(--bg-dark-elevated);
    border-color: var(--border-accent);
}

.btn-accent {
    background-color: var(--star-red-primary);
    color: #fff;
}

.btn-accent:hover {
    background-color: var(--star-red-light);
    box-shadow: 0 0 12px var(--border-glow-red);
}

.btn-success {
    background-color: var(--star-emerald);
    color: #000;
}

.btn-success:hover {
    background-color: #33eb91;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 11px;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
}

.icon-btn:hover {
    background: var(--bg-dark-elevated);
    color: var(--text-primary);
    border-color: var(--border-subtle);
}

.icon-btn-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    background: transparent;
    border: none;
    cursor: pointer;
}

.icon-btn-sm:hover {
    background: rgba(255, 69, 58, 0.2);
}

.text-btn {
    background: none;
    border: none;
    color: var(--star-cyan-primary);
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: underline;
}

.text-btn:hover {
    color: var(--star-cyan-light);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    z-index: 101;
    background-color: var(--bg-dark-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.8), 0 0 20px rgba(0, 229, 255, 0.1);
    display: flex;
    flex-direction: column;
    max-height: 85vh;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-subtle);
}

.modal-title {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: var(--star-cyan-primary);
}

.modal-subtitle {
    font-size: 11px;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

.hidden {
    display: none !important;
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--border-accent);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--star-steel-secondary);
}

/* Ship Selector Modal */
.ship-selector-card {
    width: 800px;
    max-width: 90vw;
    height: 75vh;
}

.ship-search-bar {
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-subtle);
}

.ship-search-input {
    width: 100%;
    height: 38px;
    padding: 0 12px;
    background-color: var(--bg-dark-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    color: #ffffff;
    font-size: 13px;
    outline: none;
}

.ship-search-input:focus {
    border-color: var(--star-cyan-primary);
    box-shadow: 0 0 8px var(--border-glow-cyan);
}

.ships-grid-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.ship-card {
    background-color: var(--bg-dark-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 14px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: all 0.15s ease;
}

.ship-card:hover {
    border-color: var(--star-cyan-primary);
    background-color: #262c36;
    transform: translateY(-2px);
}

.ship-card.active {
    border: 2px solid var(--star-cyan-primary);
    background-color: #1a2c3a;
    box-shadow: 0 0 12px var(--border-glow-cyan);
}

.ship-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ship-name {
    font-size: 14px;
    font-weight: 800;
    color: #ffffff;
}

.active-ship-badge {
    padding: 2px 6px;
    border-radius: 4px;
    background-color: var(--star-cyan-primary);
    color: #000000;
    font-size: 9px;
    font-weight: 900;
    font-family: var(--font-mono);
}

.ship-card-specs {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.spec-row {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    font-family: var(--font-mono);
}

.spec-label { color: var(--text-secondary); }
.spec-val { color: #ffffff; font-weight: 700; }
.spec-val-scu { color: var(--star-emerald); font-weight: 800; }

