
* {
    box-sizing: border-box;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', system-ui, sans-serif;
    margin: 0;
    padding: 20px;
    background: #f5f5f7;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    padding: 32px;
    border-radius: 18px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.04);
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}
.header-left h1 {
    margin: 0;
    color: #1d1d1f;
    font-size: 32px;
    font-weight: 600;
    letter-spacing: -0.5px;
}
.header-left .subtitle {
    color: #6e6e73;
    font-size: 15px;
    margin-top: 6px;
    font-weight: 400;
}
.header-right {
    display: flex;
    gap: 12px;
    align-items: center;
}
.btn {
    padding: 9px 20px;
    border-radius: 980px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    cursor: pointer;
    letter-spacing: -0.01em;
}
.btn-primary {
    background: #2f7d4e;
    color: white;
}
.btn-primary:hover {
    background: #34885a;
    transform: scale(1.02);
}
.btn-secondary {
    background: rgba(0,0,0,0.04);
    color: #1d1d1f;
    border: none;
}
.btn-secondary:hover {
    background: rgba(0,0,0,0.08);
}
.btn-refresh {
    display: flex;
    align-items: center;
    gap: 6px;
}
.btn-refresh.loading .refresh-icon {
    animation: spin 1s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Status bar */
.status-bar {
    background: #f5f5f7;
    padding: 14px 20px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 12px;
    border: none;
}
.status-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #86868b;
}
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #2f7d4e;
}
.status-dot.warning { background: #ff9f0a; }
.status-dot.error { background: #ff3b30; }

/* Info Icon & Tooltip */
.info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background: rgba(0,0,0,0.06);
    border-radius: 50%;
    font-size: 10px;
    cursor: help;
    margin-left: 4px;
    position: relative;
    vertical-align: middle;
    color: #86868b;
}
.info-icon.dark {
    background: rgba(0,0,0,0.06);
    color: #86868b;
}
.info-tooltip {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(29,29,31,0.95);
    backdrop-filter: blur(20px);
    color: white;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    text-align: left;
    font-weight: normal;
}
.info-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(29,29,31,0.95);
}
.info-icon:hover .info-tooltip {
    display: block;
}
.info-tooltip-row {
    display: flex;
    gap: 8px;
    margin-bottom: 4px;
}
.info-tooltip-row:last-child {
    margin-bottom: 0;
}
.info-tooltip-label {
    color: #95a5a6;
    min-width: 60px;
}
.info-tooltip-value {
    color: #fff;
    font-weight: 500;
}

/* Current Conditions - Weather App Style */
.current-section {
    margin-bottom: 30px;
}
.section-title {
    font-size: 22px;
    font-weight: 600;
    color: #2f7d4e;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -0.3px;
}

/* Data freshness label */
.data-label {
    font-size: 12px;
    font-weight: 500;
    padding: 3px 10px;
    border-radius: 12px;
    margin-left: 8px;
}
.data-label.today {
    background: #d4edda;
    color: #155724;
}
.data-label.yesterday {
    background: #fff3cd;
    color: #856404;
}
.data-label.stale {
    background: #f8d7da;
    color: #721c24;
}
.data-label:empty {
    display: none;
}

/* Main weather display */
.weather-hero {
    background: #ffffff;
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 16px;
    padding: 32px;
    color: #1d1d1f;
    margin-bottom: 24px;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 32px;
}
.hero-main {
    text-align: center;
    border-right: 1px solid rgba(0,0,0,0.08);
    padding-right: 25px;
}
.hero-temp {
    font-size: 72px;
    font-weight: 300;
    line-height: 1;
    letter-spacing: -1px;
    color: #1d1d1f;
}
.hero-temp .unit {
    font-size: 32px;
    vertical-align: top;
}
.hero-label {
    font-size: 15px;
    color: #86868b;
    margin-top: 10px;
    font-weight: 400;
}
.hero-location {
    font-size: 13px;
    color: #86868b;
    margin-top: 5px;
    font-weight: 400;
}
.hero-stats {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 12px;
    border-right: 1px solid rgba(0,0,0,0.08);
    padding-right: 25px;
}
.hero-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.hero-stat-label {
    font-size: 14px;
    color: #86868b;
    display: flex;
    align-items: center;
    font-weight: 400;
}
.hero-stat-value {
    font-size: 20px;
    font-weight: 500;
    letter-spacing: -0.2px;
    color: #1d1d1f;
}
.hero-radiation {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 12px;
}
.hero-minmax {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 12px;
    border-right: 1px solid rgba(0,0,0,0.08);
    padding-right: 25px;
}

/* Forest Info Panel */
.forest-info {
    background: #ffffff;
    border-radius: 14px;
    padding: 24px;
    margin-bottom: 28px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 24px;
    border: 1px solid rgba(0,0,0,0.08);
}
.forest-stat {
    text-align: center;
}
.forest-stat-icon {
    font-size: 24px;
    margin-bottom: 8px;
}
.forest-stat-value {
    font-size: 28px;
    font-weight: 600;
    color: #1d1d1f;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    letter-spacing: -0.3px;
}
.forest-stat-label {
    font-size: 12px;
    color: #86868b;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-top: 6px;
    font-weight: 600;
}
.forest-stat-sub {
    font-size: 11px;
    color: #86868b;
    font-weight: 400;
}

/* Charts Section */
.charts-section {
    margin-top: 30px;
}
.charts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}
.chart-timeframe {
    display: flex;
    gap: 5px;
}
.timeframe-btn {
    padding: 6px 14px;
    border: none;
    background: rgba(0,0,0,0.04);
    border-radius: 980px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
}
.timeframe-btn:hover {
    background: rgba(0,0,0,0.08);
}
.timeframe-btn.active {
    background: #2f7d4e;
    color: white;
}
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
}
.chart-card {
    background: #ffffff;
    border-radius: 14px;
    padding: 20px;
    border: 1px solid rgba(0,0,0,0.08);
}
.chart-card h3 {
    margin: 0 0 16px 0;
    font-size: 16px;
    font-weight: 600;
    color: #1d1d1f;
    display: flex;
    align-items: center;
    gap: 6px;
    letter-spacing: -0.2px;
}
.chart-container {
    height: 200px;
    position: relative;
}
.chart-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #95a5a6;
    font-size: 13px;
}

/* Responsive */
@media (max-width: 900px) {
    .weather-hero {
        grid-template-columns: 1fr;
    }
    .hero-main, .hero-stats, .hero-minmax {
        border-right: none;
        border-bottom: 1px solid rgba(0,0,0,0.08);
        padding-right: 0;
        padding-bottom: 20px;
    }
    .hero-radiation {
        border-bottom: none;
    }
    .charts-grid {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 600px) {
    .header {
        flex-direction: column;
    }
}

/* Loading state */
.loading-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}
@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* PhenoCam Section */
.phenocam-section {
    margin-top: 30px;
}
.phenocam-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
}
.phenocam-card {
    background: #ffffff;
    border-radius: 14px;
    padding: 16px;
    border: 1px solid rgba(0,0,0,0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.phenocam-card:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,0.06);
    transform: translateY(-2px);
}
.phenocam-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.phenocam-label {
    font-size: 15px;
    font-weight: 600;
    color: #1d1d1f;
    letter-spacing: -0.1px;
}
.phenocam-status {
    font-size: 12px;
    color: #86868b;
    font-weight: 500;
}
.phenocam-status.loaded {
    color: #2f7d4e;
}
.phenocam-status.error {
    color: #ff3b30;
}
.phenocam-image-container {
    position: relative;
    width: 100%;
    padding-top: 75%; /* 4:3 aspect ratio */
    background: #f5f5f7;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
}
.phenocam-image-container img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.3s;
}
.phenocam-image-container img.loaded {
    opacity: 1;
}
.phenocam-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #95a5a6;
    font-size: 13px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.phenocam-loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #ecf0f1;
    border-top-color: #1a472a;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
.phenocam-error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #e74c3c;
    font-size: 13px;
    text-align: center;
    padding: 10px;
}
.phenocam-timestamp {
    font-size: 11px;
    color: #95a5a6;
    margin-top: 8px;
    text-align: center;
}

/* Image Modal */
.phenocam-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    cursor: pointer;
}
.phenocam-modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
}
.phenocam-modal img {
    max-width: 95%;
    max-height: 95vh;
    object-fit: contain;
}
.phenocam-modal-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
}

@media (max-width: 768px) {
    .phenocam-grid {
        grid-template-columns: 1fr;
    }
}

/* Met Office Gnosall Station */
.metoffice-section {
    margin-top: 30px;
    margin-bottom: 30px;
}
.metoffice-card {
    background: #ffffff;
    border-radius: 14px;
    padding: 24px;
    border: 1px solid rgba(0,0,0,0.08);
    margin-top: 12px;
}
.metoffice-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 30px;
    gap: 12px;
    color: #7f8c8d;
}
.metoffice-error {
    text-align: center;
    padding: 20px;
    color: #e74c3c;
}
.metoffice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 15px;
}
.metoffice-item {
    background: #f5f5f7;
    border-radius: 10px;
    padding: 16px;
    text-align: center;
    border: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.metoffice-item:hover {
    background: #ebebed;
    transform: translateY(-1px);
}
.metoffice-value {
    font-size: 24px;
    font-weight: 600;
    color: #1d1d1f;
    margin-bottom: 6px;
    word-wrap: break-word;
    line-height: 1.3;
    letter-spacing: -0.3px;
}
.metoffice-label {
    font-size: 12px;
    color: #86868b;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 600;
}
.metoffice-footer {
    text-align: center;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e8ecf0;
}
@media (max-width: 768px) {
    .metoffice-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
