/* Elite Dangerous Galaxy Map - Dark Theme Styling */

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a25;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --text-muted: #606070;
    --accent-blue: #00a8ff;
    --accent-orange: #ff8c00;
    --accent-green: #00ff88;
    --accent-red: #ff4444;
    --border-color: #2a2a35;
    --shadow: rgba(0, 0, 0, 0.5);
}

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

body {
    font-family: 'Segoe UI', 'Roboto', 'Helvetica Neue', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
#header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    z-index: 100;
}

#header h1 {
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--accent-orange);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Search */
#search-container {
    position: relative;
    width: 300px;
}

#search-input {
    width: 100%;
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 0.9rem;
}

#search-input:focus {
    outline: none;
    border-color: var(--accent-blue);
}

#search-input::placeholder {
    color: var(--text-muted);
}

#search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 400px;
    overflow-y: auto;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 4px 4px;
    z-index: 200;
}

#search-results.hidden {
    display: none;
}

.search-result-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
}

.search-result-item:hover {
    background: var(--bg-tertiary);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item .name {
    font-weight: 500;
    color: var(--text-primary);
}

.search-result-item .details {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Main container */
#main-container {
    flex: 1;
    display: flex;
    position: relative;
    overflow: hidden;
}

/* Galaxy container */
#galaxy-container {
    flex: 1;
    position: relative;
    background: var(--bg-primary);
}

#galaxy-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* Zoom controls */
#zoom-controls {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

#zoom-controls button,
#view-controls button {
    width: 40px;
    height: 40px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 1.25rem;
    cursor: pointer;
    transition: all 0.2s;
}

#zoom-controls button:hover,
#view-controls button:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-blue);
}

#view-controls {
    position: absolute;
    bottom: 20px;
    right: 70px;
    display: flex;
    gap: 5px;
}

#view-controls button {
    width: auto;
    padding: 0 12px;
    font-size: 0.8rem;
}

#view-controls button.active {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
}

/* Coordinates display */
#coords-display {
    position: absolute;
    bottom: 20px;
    left: 20px;
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: 'Consolas', monospace;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Loading indicator */
#loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    color: var(--text-secondary);
}

#loading.hidden {
    display: none;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Info panel */
#info-panel {
    width: 350px;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    padding: 1.5rem;
    overflow-y: auto;
    position: relative;
}

#info-panel.hidden {
    display: none;
}

#close-panel {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
}

#close-panel:hover {
    color: var(--text-primary);
}

#system-name {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--accent-orange);
    margin-bottom: 1rem;
    padding-right: 30px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.info-row .label {
    color: var(--text-secondary);
}

.info-row .value {
    color: var(--text-primary);
    font-weight: 500;
}

#info-panel h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    font-size: 1rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

#bodies-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.body-item {
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: 4px;
    border-left: 3px solid var(--accent-blue);
}

.body-item.star {
    border-left-color: var(--accent-orange);
}

.body-item.landable {
    border-left-color: var(--accent-green);
}

.body-item .body-name {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.body-item .body-type {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.body-item .body-distance {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Advanced search panel */
#advanced-search-panel {
    position: fixed;
    top: 60px;
    left: 20px;
    width: 320px;
    max-height: calc(100vh - 100px);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    z-index: 150;
    display: flex;
    flex-direction: column;
}

#advanced-search-panel.hidden {
    display: none;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.panel-header h2 {
    font-size: 1rem;
    font-weight: 500;
}

.panel-header button {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
}

.panel-header button:hover {
    color: var(--text-primary);
}

.panel-content {
    padding: 1rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.form-group input[type="checkbox"] {
    margin-right: 0.5rem;
}

.form-group select,
.form-group input[type="number"] {
    width: 100%;
    padding: 0.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.form-group select:focus,
.form-group input[type="number"]:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.btn-primary {
    width: 100%;
    padding: 0.75rem;
    background: var(--accent-blue);
    border: none;
    border-radius: 4px;
    color: white;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: #0090dd;
}

#advanced-results {
    flex: 1;
    overflow-y: auto;
    border-top: 1px solid var(--border-color);
    padding: 1rem;
}

#advanced-results h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

#advanced-results-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.result-item {
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.result-item:hover {
    background: var(--bg-primary);
}

.result-item .system-name {
    font-weight: 500;
    color: var(--accent-orange);
}

.result-item .resource-info {
    font-size: 0.85rem;
    color: var(--accent-green);
    margin-top: 0.25rem;
}

.result-item .body-info {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Toggle buttons */
#toggle-advanced-search,
#toggle-stats {
    position: fixed;
    width: 44px;
    height: 44px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    color: var(--text-primary);
    font-size: 1.25rem;
    cursor: pointer;
    z-index: 100;
    transition: all 0.2s;
}

#toggle-advanced-search {
    top: 70px;
    left: 20px;
}

#toggle-stats {
    top: 120px;
    left: 20px;
}

#toggle-advanced-search:hover,
#toggle-stats:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-blue);
}

/* Stats panel */
#stats-panel {
    position: fixed;
    top: 60px;
    left: 80px;
    width: 300px;
    max-height: calc(100vh - 100px);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    z-index: 140;
}

#stats-panel.hidden {
    display: none;
}

#stats-content {
    padding: 1rem;
    overflow-y: auto;
    max-height: calc(100vh - 160px);
}

.stat-section {
    margin-bottom: 1.5rem;
}

.stat-section h4 {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 0.25rem 0;
    font-size: 0.9rem;
}

.stat-row .stat-label {
    color: var(--text-secondary);
}

.stat-row .stat-value {
    color: var(--text-primary);
    font-weight: 500;
}

.stat-row.total {
    border-top: 1px solid var(--border-color);
    padding-top: 0.5rem;
    margin-top: 0.5rem;
}

.stat-row.total .stat-label,
.stat-row.total .stat-value {
    color: var(--accent-blue);
}

/* Allegiance colors */
.allegiance-federation { color: #4a90d9; }
.allegiance-empire { color: #9b59b6; }
.allegiance-alliance { color: #27ae60; }
.allegiance-independent { color: #f39c12; }

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
}

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

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

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

/* Responsive */
@media (max-width: 768px) {
    #header h1 {
        display: none;
    }

    #search-container {
        width: 100%;
    }

    #info-panel {
        position: fixed;
        top: 60px;
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: 350px;
        z-index: 200;
    }

    #advanced-search-panel,
    #stats-panel {
        width: calc(100% - 40px);
        left: 20px;
        right: 20px;
    }
}
