/**
 * RadioSky Dashboard Styles
 * Following NF-Lab aesthetic
 */

:root {
    --primary: #D4A574;
    --primary-dark: #C9A571;
    --primary-light: #E4B584;
    --secondary: #8B7355;

    --bg-dark: #0F1115;
    --bg-card: rgba(26, 29, 35, 0.8);
    --bg-hover: rgba(45, 42, 39, 0.3);

    --text-primary: #FFFFFF;
    --text-secondary: #9CA3AF;
    --text-tertiary: #6B7280;

    --border: #3A3733;
    --border-hover: #4A4743;

    --success: #10B981;
    --warning: #F59E0B;
    --error: #EF4444;

    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);

    --transition: all 0.3s ease;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
}

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

body {
    font-family: 'SF Mono', 'Monaco', 'Consolas', 'Courier New', monospace;
    background: linear-gradient(180deg, #1A1D23 0%, #0F1115 100%);
    color: var(--text-secondary);
    min-height: 100vh;
    line-height: 1.6;
}

.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 1.5rem;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.app-title-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.app-logo {
    font-size: 1.75rem;
    color: var(--primary);
}

.app-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 4px;
}

.app-subtitle {
    font-size: 0.7rem;
    color: var(--text-secondary);
    letter-spacing: 2px;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    letter-spacing: 1px;
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.profile-menu-dashboard {
    position: relative;
}

.profile-btn-dashboard {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    color: var(--primary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
}

.profile-btn-dashboard:hover {
    border-color: var(--primary);
    background: var(--bg-hover);
}

.profile-dropdown-dashboard {
    position: absolute;
    top: 50px;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    min-width: 200px;
    display: none;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
}

.profile-menu-dashboard.active .profile-dropdown-dashboard {
    display: block;
}

.dropdown-item-dashboard {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
    font-size: 0.9rem;
}

.dropdown-item-dashboard:hover {
    background: var(--bg-hover);
    color: var(--primary);
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    transition: var(--transition);
}

.card:hover {
    border-color: var(--border-hover);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 2px;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.card-icon {
    color: var(--primary);
    font-size: 1rem;
}

/* Stat Cards */
.stat-card {
    text-align: center;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.stat-subtitle {
    font-size: 0.85rem;
    color: var(--text-tertiary);
}

/* Station Map */
.map-card {
    grid-column: 1 / -1;
}

.station-map {
    min-height: 400px;
    background: var(--bg-dark);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

/* When Leaflet mounts, it adds .leaflet-container to the element; switch
   layout from flex-centred loading state to a block-level map canvas. */
.station-map.leaflet-container {
    display: block;
    background: #0f1319;
}

.map-loading, .loading-placeholder {
    text-align: center;
    color: var(--text-tertiary);
}

.map-loading i, .loading-placeholder i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--primary);
}

/* Custom Leaflet marker pin */
.station-pin {
    position: relative;
    width: 18px;
    height: 18px;
    pointer-events: auto;
}

.station-pin .station-pin__dot {
    position: absolute;
    inset: 4px;
    border-radius: 50%;
    background: var(--primary, #D4A574);
    box-shadow: 0 0 0 2px rgba(15, 19, 25, 0.9), 0 0 10px rgba(212, 165, 116, 0.6);
}

.station-pin .station-pin__pulse {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid var(--primary, #D4A574);
    opacity: 0.55;
    animation: station-pin-pulse 2.4s ease-out infinite;
}

.station-pin--anchor .station-pin__dot {
    background: #70f3b2;
    box-shadow: 0 0 0 2px rgba(15, 19, 25, 0.9), 0 0 14px rgba(112, 243, 178, 0.85);
}

.station-pin--anchor .station-pin__pulse {
    border-color: #70f3b2;
}

@keyframes station-pin-pulse {
    0%   { transform: scale(0.6); opacity: 0.8; }
    70%  { transform: scale(2.1); opacity: 0; }
    100% { transform: scale(2.1); opacity: 0; }
}

/* Popup styling to match dashboard theme */
.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
    background: rgba(20, 24, 31, 0.95);
    color: var(--text-primary, #fff);
    border: 1px solid var(--border, #3A3733);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.55);
}

.leaflet-popup-content {
    margin: 10px 14px;
    font-family: var(--font-mono, 'SF Mono', 'Monaco', monospace);
    font-size: 12px;
}

.station-popup__name {
    color: var(--primary, #D4A574);
    font-weight: 600;
    letter-spacing: 0.6px;
    margin-bottom: 3px;
    text-transform: uppercase;
    font-size: 11px;
}

.station-popup__note {
    color: var(--text-secondary, #9CA3AF);
    margin-bottom: 4px;
}

.station-popup__coords {
    color: var(--text-tertiary, #6B7280);
    font-size: 10.5px;
}

.leaflet-container a.leaflet-popup-close-button {
    color: var(--text-tertiary, #6B7280);
}

.leaflet-control-attribution {
    background: rgba(15, 19, 25, 0.75) !important;
    color: var(--text-tertiary, #6B7280) !important;
    font-size: 10px;
}

.leaflet-control-attribution a {
    color: var(--primary, #D4A574) !important;
}

/* SKA Card */
.ska-card {
    grid-column: 1 / -1;
}

.ska-description {
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.ska-comparison {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.comparison-item {
    padding: 1rem;
    background: rgba(212, 165, 116, 0.1);
    border: 1px solid var(--primary);
    border-radius: var(--radius-md);
    min-width: 180px;
    text-align: center;
}

.comparison-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.comparison-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
}

.comparison-arrow {
    font-size: 1.5rem;
    color: var(--primary);
}

.progress-bar {
    width: 100%;
    height: 16px;
    background: rgba(45, 42, 39, 0.5);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-dark), var(--primary-light));
    transition: width 1s ease-out;
    min-width: 0.5%;
}

.progress-text {
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Observations List */
.observations-card, .events-card {
    grid-column: 1 / -1;
}

.observations-list, .events-timeline {
    max-height: 400px;
    overflow-y: auto;
}

.observation-item, .event-item {
    padding: 1rem;
    background: var(--bg-hover);
    border-radius: var(--radius-md);
    margin-bottom: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.observation-item:hover, .event-item:hover {
    background: rgba(212, 165, 116, 0.1);
}

.observation-info, .event-info {
    flex: 1;
}

.observation-station, .event-type {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.observation-details, .event-details {
    font-size: 0.85rem;
    color: var(--text-tertiary);
}

.observation-time, .event-time {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Footer */
.dashboard-footer {
    text-align: center;
    padding: 1.5rem;
    margin-top: 2rem;
    border-top: 1px solid var(--border);
    font-size: 0.85rem;
    color: var(--text-tertiary);
}

/* Responsive */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

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

    .ska-comparison {
        flex-direction: column;
        gap: 1rem;
    }

    .comparison-arrow {
        transform: rotate(90deg);
    }
}
