/* The Earth Module - Rich UI Styles */

:root {
    --grid-columns: 4;
    --tile-gap: 15px;
    --border-radius: 12px;
    --transition-speed: 0.3s;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #e0e0e0;
    background: #000;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Solar Gradient Backgrounds (15% brightness) */
body.time-midnight { background: linear-gradient(135deg, #000003 0%, #020306 100%); }
body.time-dawn { background: linear-gradient(135deg, #02050A 0%, #040708 100%); }
body.time-sunrise { background: linear-gradient(135deg, #25100E 0%, #261712 100%); }
body.time-morning { background: linear-gradient(135deg, #261F05 0%, #261F0A 100%); }
body.time-noon { background: linear-gradient(135deg, #141F24 0%, #1C2426 100%); }
body.time-afternoon { background: linear-gradient(135deg, #261F05 0%, #25190A 100%); }
body.time-sunset { background: linear-gradient(135deg, #25100E 0%, #1C090D 100%); }
body.time-night { background: linear-gradient(135deg, #04040A 0%, #020303 100%); }

/* Header */
.header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.header h1 {
    font-size: 24px;
    font-weight: 300;
    letter-spacing: 2px;
    color: #00ff88;
    text-transform: uppercase;
}

.device-id {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
    font-family: monospace;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Grid Layout */
.grid {
    display: grid;
    grid-template-columns: repeat(var(--grid-columns), 1fr);
    gap: var(--tile-gap);
    margin-bottom: 30px;
}

@media (max-width: 1024px) {
    .grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
    .grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
    .grid { grid-template-columns: 1fr; }
}

/* Tiles */
.tile {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
    padding: 20px;
    transition: all var(--transition-speed);
}

.tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0, 255, 136, 0.1);
    border-color: rgba(0, 255, 136, 0.3);
}

.tile-title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #888;
    margin-bottom: 10px;
}

.tile-value {
    font-size: 32px;
    font-weight: 200;
    color: #00ff88;
    margin-bottom: 5px;
}

.tile-unit {
    font-size: 14px;
    color: #666;
}

/* CV Output Tiles */
.cv-tile {
    grid-column: span 1;
}

.cv-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    margin-top: 15px;
    overflow: hidden;
}

.cv-fill {
    height: 100%;
    background: linear-gradient(90deg, #00ff88, #00ffff);
    border-radius: 3px;
    transition: width var(--transition-speed);
}

/* Location Tile */
.location-tile {
    grid-column: span 2;
}

.map-container {
    height: 200px;
    background: #111;
    border-radius: 8px;
    margin-top: 10px;
    position: relative;
    overflow: hidden;
}

/* Settings Tile */
.settings-tile {
    grid-column: span 2;
}

.input-group {
    margin-bottom: 15px;
}

.input-group label {
    display: block;
    font-size: 12px;
    color: #888;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.input-group input {
    width: 100%;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: #fff;
    font-size: 14px;
    transition: all var(--transition-speed);
}

.input-group input:focus {
    outline: none;
    border-color: #00ff88;
    background: rgba(0, 255, 136, 0.05);
}

/* Buttons */
.btn {
    padding: 10px 20px;
    background: linear-gradient(135deg, #00ff88, #00ffff);
    color: #000;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-speed);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0, 255, 136, 0.3);
}

.btn:active {
    transform: translateY(0);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Status Indicators */
.status {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 5px;
}

.status.online { 
    background: #00ff88;
    color: #00ff88;
}
.status.offline { 
    background: #ff4444;
    color: #ff4444;
}
.status.updating { 
    background: #ffaa00;
    animation: pulse 1s infinite;
}

/* API Status Indicator */
.api-status-indicator {
    margin-left: 15px;
    font-size: 14px;
    color: #888;
}

.api-status-indicator .status {
    width: auto;
    height: auto;
    background: none;
    font-size: 16px;
    vertical-align: middle;
}

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

/* Loading State */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    font-size: 18px;
    color: #888;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-left: 10px;
    border: 2px solid rgba(0, 255, 136, 0.3);
    border-top-color: #00ff88;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Button styles */
.btn-primary {
    background: #007bff;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: #0056b3;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #6c757d;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: #545b62;
    transform: translateY(-1px);
}

.btn-danger {
    background: #dc3545;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
}

.btn-danger:hover {
    background: #c82333;
    transform: translateY(-1px);
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .header h1 { font-size: 20px; }
    .tile-value { font-size: 24px; }
    .location-tile, .settings-tile { grid-column: span 1; }
}