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

:root {
    --bg: #ffffff;
    --fg: #000000;
    --accent: #000000;
    --border: #000000;
    --muted: #333333;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #000000;
        --fg: #ffffff;
        --accent: #ffffff;
        --border: #ffffff;
        --muted: #cccccc;
    }
}

body {
    font-family: Georgia, "Times New Roman", serif;
    background: var(--bg);
    color: var(--fg);
    min-height: 100vh;
    padding: 16px;
    line-height: 1.5;
}

.dashboard {
    max-width: 1200px;
    margin: 0 auto;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border);
}

.location-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1rem;
    font-weight: bold;
}

.location-icon {
    width: 20px;
    height: 20px;
    stroke: var(--fg);
}

/* Grid */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

/* Cards - Now clickable */
.card {
    background: var(--bg);
    border: 2px solid var(--border);
    padding: 16px;
    cursor: pointer;
    position: relative;
    transition: transform 0.1s, box-shadow 0.1s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 4px 4px 0 0 var(--fg);
}

.card:active {
    transform: translateY(0);
    box-shadow: 2px 2px 0 0 var(--fg);
}

.card-hint {
    font-size: 0.7rem;
    color: var(--muted);
    text-align: center;
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    opacity: 0.6;
}

h2 {
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 4px;
}

/* Time */
.time-card {
    text-align: left;
}

.clock {
    font-size: 3rem;
    font-weight: normal;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
    line-height: 1;
    margin-bottom: 4px;
}

.date {
    font-size: 1rem;
    color: var(--muted);
}

/* Weather */
.weather-card {
    min-height: auto;
}

.weather-main {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.weather-icon {
    width: 48px;
    height: 48px;
}

.weather-icon svg {
    width: 100%;
    height: 100%;
    stroke: var(--fg);
}

.weather-info {
    flex: 1;
}

.temperature {
    font-size: 2.5rem;
    font-weight: normal;
    line-height: 1;
}

.temperature::after {
    content: "F";
    font-size: 1rem;
    vertical-align: super;
}

.weather-desc {
    font-size: 0.9rem;
    color: var(--muted);
}

.weather-details {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.detail {
    display: flex;
    flex-direction: column;
}

.detail-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
}

.detail-value {
    font-size: 1rem;
    font-weight: bold;
}

/* Sun */
.sun-times {
    display: flex;
    gap: 24px;
}

.sun-item {
    display: flex;
    flex-direction: column;
}

.sun-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    color: var(--muted);
}

.sun-time {
    font-size: 1.5rem;
    font-weight: normal;
}

/* Tides */
.tide-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

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

.tide-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--muted);
}

.tide-value {
    font-size: 1.25rem;
    font-weight: bold;
}

/* Allergies */
.allergy-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.allergy-row:last-child {
    border-bottom: none;
}

.allergy-name {
    font-size: 0.9rem;
}

.allergy-val {
    font-weight: bold;
    font-size: 0.85rem;
}

.allergy-val[data-level="low"] {
    color: var(--fg);
}

.allergy-val[data-level="moderate"] {
    font-weight: bold;
    text-decoration: underline;
}

.allergy-val[data-level="high"] {
    font-weight: bold;
    border: 1px solid var(--border);
    padding: 2px 6px;
}

.allergy-val[data-level="very-high"] {
    font-weight: bold;
    background: var(--fg);
    color: var(--bg);
    padding: 2px 6px;
}

/* Mortgage Rates */
.rate-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.rate-row:last-child {
    border-bottom: none;
}

.rate-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--muted);
}

.rate-value {
    font-size: 1.25rem;
    font-weight: bold;
    font-variant-numeric: tabular-nums;
}

.rate-value::after {
    content: "%";
    font-size: 0.75rem;
}

.rate-source {
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    font-size: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.rate-source a {
    color: var(--fg);
    text-decoration: underline;
}

.rate-source a:hover {
    text-decoration: none;
}

.rate-date {
    color: var(--muted);
}

/* Stock Market */
.stock-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.stock-row:last-child {
    border-bottom: none;
}

.stock-label {
    font-size: 0.9rem;
    font-weight: bold;
}

.stock-value {
    font-size: 1.1rem;
    font-weight: bold;
    font-variant-numeric: tabular-nums;
    display: flex;
    align-items: center;
    gap: 8px;
}

.stock-change {
    font-size: 0.75rem;
    padding: 2px 6px;
    border: 1px solid var(--border);
}

.stock-change.up {
    background: var(--fg);
    color: var(--bg);
}

.extended-badge {
    font-size: 0.6rem;
    background: var(--fg);
    color: var(--bg);
    padding: 1px 4px;
    margin-left: 4px;
}

/* Forecast */
.forecast-card {
    grid-column: span 1;
}

.forecast {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.forecast-day {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.forecast-day:last-child {
    border-bottom: none;
}

.forecast-day-name {
    font-weight: normal;
    min-width: 70px;
    font-size: 0.9rem;
}

.forecast-icon {
    width: 20px;
    height: 20px;
}

.forecast-icon svg {
    width: 100%;
    height: 100%;
    stroke: var(--fg);
}

.forecast-temps {
    display: flex;
    gap: 16px;
    font-variant-numeric: tabular-nums;
}

.forecast-high {
    font-weight: bold;
}

.forecast-high::after {
    content: "F";
    font-size: 0.6rem;
    vertical-align: super;
}

.forecast-low {
    color: var(--muted);
}

.forecast-low::after {
    content: "F";
    font-size: 0.6rem;
    vertical-align: super;
}

.forecast-rain {
    font-size: 0.75rem;
    color: var(--muted);
    margin-left: 8px;
}

.forecast-desc {
    font-size: 0.8rem;
    color: var(--muted);
    min-width: 60px;
    text-align: center;
}

/* Radar */
.radar-card {
    grid-column: span 2;
}

.radar-map {
    width: 100%;
    height: 300px;
    background: #f0f0f0;
    border: 1px solid var(--border);
}

.radar-map iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* News */
.news-card {
    grid-column: span 2;
}

.news-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.news-item {
    display: flex;
    flex-direction: column;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

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

.news-headline {
    font-size: 1rem;
    font-weight: bold;
    margin-bottom: 4px;
    line-height: 1.3;
}

.news-headline a {
    color: var(--fg);
    text-decoration: none;
}

.news-headline a:hover {
    text-decoration: underline;
}

.news-description {
    font-size: 0.9rem;
    color: var(--muted);
    margin: 4px 0;
    line-height: 1.4;
}

.news-source {
    font-size: 0.75rem;
    color: var(--muted);
    text-transform: uppercase;
}

.news-loading {
    color: var(--muted);
    font-style: italic;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg);
    border: 2px solid var(--border);
    width: 100%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 2px solid var(--border);
}

.modal-header h2 {
    border: none;
    margin: 0;
    padding: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--fg);
    padding: 0 4px;
}

.modal-close:hover {
    background: var(--fg);
    color: var(--bg);
}

.modal-body {
    padding: 16px;
}

/* Detail sections inside modal */
.detail-section {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.detail-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.detail-section h3 {
    font-size: 1rem;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.detail-grid > div {
    padding: 8px;
    border: 1px solid var(--border);
}

.detail-note {
    font-size: 0.85rem;
    color: var(--muted);
    margin-top: 12px;
}

.detail-links {
    margin-top: 16px;
    display: flex;
    gap: 16px;
}

.detail-links a {
    color: var(--fg);
    text-decoration: underline;
}

/* Buttons */
button {
    font-family: inherit;
    cursor: pointer;
}

.install-btn {
    padding: 8px 16px;
    background: var(--bg);
    color: var(--fg);
    border: 2px solid var(--border);
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.install-btn:hover {
    background: var(--fg);
    color: var(--bg);
}

.install-btn.hidden {
    display: none;
}

.refresh-btn {
    padding: 12px 24px;
    background: var(--bg);
    color: var(--fg);
    border: 2px solid var(--border);
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.1em;
}

.refresh-btn:hover {
    background: var(--fg);
    color: var(--bg);
}

/* Footer */
footer {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 2px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.last-updated {
    font-size: 0.75rem;
    color: var(--muted);
    text-transform: uppercase;
}

/* Responsive */
@media (max-width: 768px) {
    body {
        padding: 12px;
    }

    .clock {
        font-size: 2.5rem;
    }

    .temperature {
        font-size: 2rem;
    }

    .weather-details {
        grid-template-columns: repeat(2, 1fr);
    }

    .radar-card,
    .news-card {
        grid-column: span 1;
    }

    .radar-map {
        height: 250px;
    }

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

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

    .modal-content {
        max-height: 90vh;
    }
}

@media print {
    body {
        background: white;
        color: black;
    }

    .card {
        border: 1px solid black;
        break-inside: avoid;
    }

    .radar-map,
    .install-btn,
    .refresh-btn,
    .card-hint,
    .modal {
        display: none !important;
    }
}
