/* EarthOrbit.css - Simple & WebView Compatible */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background: #1e3c72;
    color: #fff;
    min-height: 100vh;
    padding: 10px;
    text-align: center;
}

h1 {
    color: #ffd700;
    margin-bottom: 15px;
    font-size: 1.5rem;
}

h2 {
    font-size: 1rem;
    margin-bottom: 20px;
    color: #fff;
}

#main-container {
    max-width: 800px;
    margin: 0 auto;
}

/* Canvas */
#canvas-container {
    background: #000;
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 15px;
}

canvas {
    width: 100%;
    height: auto;
    border-radius: 5px;
    background: radial-gradient(circle, #0a1551 0%, #000 100%);
}

/* Controls */
.control-section {
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
    text-align: left;
}

    .control-section h3 {
        color: #ffd700;
        margin-bottom: 10px;
        font-size: 1.1rem;
    }

.datetime-location-group {
    margin-bottom: 15px;
}

.control-group {
    margin-bottom: 10px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.9rem;
}

input[type="datetime-local"] {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 16px; /* Prevent zoom on iOS */
    background: #fff;
    color: #333;
}

/* Buttons */
button {
    background: #ffd700;
    color: #333;
    border: none;
    border-radius: 5px;
    padding: 10px 8px;
    margin: 3px;
    font-size: 0.85rem;
    font-weight: bold;
    cursor: pointer;
    min-height: 44px; /* Touch target */
    min-width: 60px;
    flex: 1; /* Allow buttons to grow equally */
}

    button:hover {
        background: #ffed4e;
    }

    button:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }

.button-group {
    display: flex;
    flex-wrap: nowrap; /* Keep buttons in one row */
    justify-content: center;
    align-items: center;
    gap: 3px;
    margin-bottom: 10px;
}

/* Speed Controls - Always in one row */
.speed-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin-top: 10px;
}

.speed-btn {
    background: rgba(255,255,255,0.2);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 8px 4px;
    font-size: 0.75rem;
    flex: 1;
    min-width: 50px;
    max-width: 80px;
}

    .speed-btn.active {
        background: #ffd700;
        color: #333;
        border-color: #ffd700;
    }

    .speed-btn:hover {
        background: rgba(255,255,255,0.3);
    }

    .speed-btn.active:hover {
        background: #ffed4e;
    }

/* Location Info */
#location-info {
    font-size: 0.9rem;
    color: #90caf9;
    margin-top: 10px;
}

/* Info Panel */
#info-panel {
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
    padding: 15px;
    text-align: left;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.info-card {
    background: rgba(255,255,255,0.05);
    padding: 10px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.1);
}

    .info-card h4 {
        color: #ffd700;
        margin-bottom: 8px;
        font-size: 1rem;
    }

    .info-card p {
        margin: 3px 0;
        font-size: 0.85rem;
        line-height: 1.3;
    }

.value {
    color: #90caf9;
    font-weight: bold;
}

/* Legend */
#legend {
    margin-top: 15px;
    padding: 10px;
    background: rgba(0,0,0,0.3);
    border-radius: 8px;
    font-size: 0.8rem;
    line-height: 1.4;
}

.legend-item {
    display: inline-block;
    margin-right: 15px;
    margin-bottom: 5px;
}

.color-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 5px;
    vertical-align: middle;
}

/* Error & Eclipse */
.error-message {
    background: rgba(255, 0, 0, 0.2);
    border: 1px solid #ff6b6b;
    color: #ff6b6b;
    padding: 10px;
    border-radius: 5px;
    text-align: center;
    margin-top: 10px;
}

.eclipse-warning {
    background: rgba(255, 100, 0, 0.2);
    border: 2px solid #ff6b6b;
    color: #fff;
    padding: 10px;
    border-radius: 8px;
    margin-top: 10px;
    text-align: center;
    font-weight: bold;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 50% {
        opacity: 0.8;
    }

    100% {
        opacity: 1;
    }
}

.loading {
    text-align: center;
    padding: 20px;
    color: #ffd700;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    body {
        padding: 5px;
    }

    h1 {
        font-size: 1.3rem;
    }

    .control-section {
        padding: 10px;
    }

    /* Keep speed controls in two rows on mobile */
    .speed-controls {
        display: flex;
        flex-wrap: wrap;
        gap: 3px;
    }

    .speed-btn {
        flex: 1 1 calc(50% - 3px); /* Two buttons per row */
        min-width: 0;
        font-size: 0.7rem;
        padding: 8px 2px;
    }

    .info-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    /* Main control buttons stay in one row */
    .button-group {
        flex-wrap: nowrap;
    }

    button {
        padding: 10px 6px;
        margin: 2px;
        font-size: 0.8rem;
        min-width: 50px;
    }
}

@media (max-width: 480px) {
    /* Speed controls: 2 per row, then 1 for last button */
    .speed-controls {
        gap: 2px;
    }

    .speed-btn {
        flex: 1 1 calc(50% - 2px);
        font-size: 0.65rem;
        padding: 8px 1px;
    }

        /* For 5 buttons: first 4 in pairs, last one full width */
        .speed-btn:nth-child(5) {
            flex: 1 1 100%;
            margin-top: 2px;
        }

    /* Main buttons even smaller but still readable */
    button {
        padding: 10px 4px;
        font-size: 0.75rem;
        min-width: 45px;
    }

    .button-group {
        gap: 2px;
    }
}

/* WebView Specific */
canvas {
    touch-action: pan-x pan-y; /* Allow scrolling when touching canvas */
}

input, button, .speed-btn {
    -webkit-appearance: none;
    -webkit-border-radius: 5px;
}

    button:focus, input:focus {
        outline: 2px solid #ffd700;
        outline-offset: 1px;
    }

/* Disable text selection on UI elements */
h1, h2, h3, h4, button, .legend-item, label {
    user-select: none;
    -webkit-user-select: none;
}

/* Enable text selection on data */
.info-card p, .value {
    user-select: text;
    -webkit-user-select: text;
}
