/* Minimal CSS Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Root variables for consistent theming */
:root {
    --bg-color: #111111;
    --text-color: #ffffff;
    --secondary-text: #cccccc;
    --accent-color: #4a9eff;
    --card-bg: #222222;
    --border-color: #333333;
    --error-color: #ff6b6b;
    --success-color: #4ecdc4;
    --border-radius: 8px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Base styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Container for centered layout */
.container {
    max-width: 400px;
    margin: 0 auto;
    padding: 20px 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #4a9eff, #ffffff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--secondary-text);
    font-size: 1rem;
}

/* Main content */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Input section */
.input-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.search-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

#location-search {
    flex: 1;
    min-width: 200px;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    background-color: var(--card-bg);
    color: var(--text-color);
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

#location-search:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.2);
}

#location-search::placeholder {
    color: var(--secondary-text);
}

button {
    padding: 12px 20px;
    border: none;
    border-radius: var(--border-radius);
    background-color: var(--accent-color);
    color: white;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

button:hover {
    background-color: #3a8ee6;
    transform: translateY(-1px);
}

button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.4);
}

button:active {
    transform: translateY(0);
}

button:disabled {
    background-color: var(--border-color);
    cursor: not-allowed;
    transform: none;
}

#location-btn {
    background-color: var(--success-color);
}

#location-btn:hover {
    background-color: #45b7b8;
}

/* Date section */
.date-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.date-section label {
    font-weight: 500;
    min-width: 60px;
}

#date-picker {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    background-color: var(--card-bg);
    color: var(--text-color);
    font-size: 1rem;
    cursor: pointer;
}

#date-picker:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.2);
}

/* Error section */
.error-section {
    display: none;
    padding: 1rem;
    border-radius: var(--border-radius);
    background-color: rgba(255, 107, 107, 0.1);
    border: 1px solid var(--error-color);
    color: var(--error-color);
    text-align: center;
}

.error-section.show {
    display: block;
}

/* Results section */
.results-card {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    text-align: center;
    border: 1px solid var(--border-color);
}

/* Moon display */
.moon-display {
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: center;
}

#moon-svg-container {
    width: 120px;
    height: 120px;
}

.moon-svg {
    width: 100%;
    height: 100%;
    drop-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

/* Phase info */
.phase-info h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--accent-color);
}

.phase-info p {
    margin-bottom: 0.5rem;
    color: var(--secondary-text);
}

.illumination {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-color) !important;
}

.local-time {
    font-size: 1rem;
    font-weight: 500;
}

/* Moon times styling */
.moon-times {
    margin: 0.75rem 0;
    padding: 0.75rem;
    background-color: rgba(74, 158, 255, 0.1);
    border-radius: calc(var(--border-radius) / 2);
    border: 1px solid rgba(74, 158, 255, 0.2);
}

.moon-rise, .moon-set {
    margin: 0.25rem 0;
    font-size: 0.9rem;
    color: var(--text-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.moon-rise::before {
    content: "🌅";
    margin-right: 0.5rem;
    font-size: 1rem;
}

.moon-set::before {
    content: "🌇";
    margin-right: 0.5rem;
    font-size: 1rem;
}

.coordinates {
    font-size: 0.9rem;
    font-family: monospace;
}

.location-name {
    font-size: 1rem;
    color: var(--accent-color) !important;
    font-weight: 500;
}

/* Footer */
footer {
    margin-top: 2rem;
    text-align: center;
}

.credit {
    font-size: 0.8rem;
    color: var(--secondary-text);
    opacity: 0.7;
    margin-bottom: 1rem;
}

.legal-links {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.legal-links a {
    color: var(--secondary-text);
    text-decoration: none;
    font-size: 0.75rem;
    margin: 0 0.75rem;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.legal-links a:hover {
    opacity: 1;
    text-decoration: underline;
}

/* Legal pages styling */
.legal-content {
    max-width: 100%;
    line-height: 1.7;
    text-align: left;
}

.legal-content h2 {
    color: var(--accent-color);
    margin: 2rem 0 1rem 0;
    font-size: 1.25rem;
}

.legal-content p {
    margin-bottom: 1rem;
    color: var(--secondary-text);
}

.legal-content ul {
    margin: 1rem 0 1rem 1.5rem;
    color: var(--secondary-text);
}

.legal-content li {
    margin-bottom: 0.5rem;
}

.legal-content strong {
    color: var(--text-color);
}

.legal-content a {
    color: var(--accent-color);
    text-decoration: none;
}

.legal-content a:hover {
    text-decoration: underline;
}

.back-link {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.back-link a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
}

.back-link a:hover {
    text-decoration: underline;
}

/* Loading state */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading button {
    background-color: var(--border-color);
    cursor: wait;
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .container {
        padding: 16px 12px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .search-row {
        flex-direction: column;
    }
    
    #location-search {
        min-width: auto;
    }
    
    button {
        width: 100%;
    }
    
    .results-card {
        padding: 1.5rem;
    }
    
    #moon-svg-container {
        width: 100px;
        height: 100px;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --bg-color: #000000;
        --text-color: #ffffff;
        --card-bg: #000000;
        --border-color: #ffffff;
        --accent-color: #00ffff;
    }
    
    button, #location-search, #date-picker {
        border-width: 3px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Print styles */
@media print {
    body {
        background: white;
        color: black;
    }
    
    .input-section {
        display: none;
    }
    
    .results-card {
        background: white;
        border: 2px solid black;
        box-shadow: none;
    }
}
