/* Reset och grundlaggande styling */
html {
    height: 100%;
    background-color: #0f172a;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    background-color: #0f172a;
    min-height: 100vh;
    padding: 20px;
    color: #e2e8f0;
}

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

/* Header */
header {
    text-align: center;
    margin-bottom: 20px;
    padding: 40px 20px;
}

h1 {
    font-size: 3rem;
    font-weight: 800;
    color: #3b82f6;
    margin-bottom: 12px;
    letter-spacing: -0.02em;
}

.subtitle {
    color: #94a3b8;
    font-size: 1.1rem;
    font-weight: 400;
}

/* Info banner */
.info-banner {
    background-color: #1e293b;
    border-radius: 16px;
    padding: 28px 32px;
    margin-bottom: 24px;
    border: 1px solid #334155;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.info-banner__intro h2 {
    color: #f1f5f9;
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 2px solid #3b82f6;
    display: inline-block;
}

.info-banner__intro p {
    color: #cbd5e1;
    font-size: 0.95rem;
    line-height: 1.6;
}

.info-banner__facts {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px 20px;
    background-color: #0f172a;
    border-radius: 12px;
    border: 1px solid #334155;
}

.info-banner__facts p {
    color: #94a3b8;
    font-size: 0.9rem;
    line-height: 1.6;
    margin: 0;
}

.info-banner__facts p strong {
    color: #93c5fd;
    font-weight: 600;
}

.info-banner__support {
    padding-top: 20px;
    border-top: 1px solid #334155;
    text-align: center;
}

.info-banner__support h3 {
    color: #f1f5f9;
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.info-banner__support p {
    color: #cbd5e1;
    font-size: 0.95rem;
    line-height: 1.6;
    max-width: 580px;
    margin: 0 auto 20px;
}

.info-banner__buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* Support button */
.support-btn {
    display: inline-block;
    padding: 14px 32px;
    background: linear-gradient(135deg, #FFDD00 0%, #FDB913 100%);
    color: #0f172a;
    font-weight: 700;
    font-size: 1.05rem;
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(255, 221, 0, 0.3);
    margin: 6px;
}

.support-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 221, 0, 0.4);
    background: linear-gradient(135deg, #FDB913 0%, #FFDD00 100%);
}

.linkedin-btn {
    background: linear-gradient(135deg, #0A66C2 0%, #004182 100%);
    color: #ffffff;
    box-shadow: 0 4px 16px rgba(10, 102, 194, 0.3);
}

.linkedin-btn:hover {
    box-shadow: 0 6px 20px rgba(10, 102, 194, 0.4);
    background: linear-gradient(135deg, #004182 0%, #0A66C2 100%);
}

/* Area selector */
.area-selector {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 32px;
    border: 1px solid #475569;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.4);
}

.area-selector h3 {
    color: #f1f5f9;
    margin-bottom: 16px;
    font-size: 1.1rem;
    font-weight: 600;
}

.area-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.area-btn {
    padding: 14px 20px;
    border: 2px solid #475569;
    background-color: #0f172a;
    color: #cbd5e1;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.area-price {
    font-size: 0.85rem;
    font-weight: 500;
    color: #10b981;
    margin-top: 2px;
}

.area-btn:hover {
    border-color: #64748b;
    background-color: #1e293b;
    color: #f1f5f9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.area-btn.active {
    background: linear-gradient(135deg, #475569 0%, #334155 100%);
    color: white;
    border-color: #64748b;
    box-shadow: 0 4px 16px rgba(71, 85, 105, 0.4);
    cursor: not-allowed;
    opacity: 0.9;
}

.area-btn.active:hover {
    transform: none;
    box-shadow: 0 4px 16px rgba(71, 85, 105, 0.4);
}

.area-btn.active .area-price {
    color: #6ee7b7;
}

/* Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background-color: #1e293b;
    border-radius: 16px;
    padding: 24px;
    border: 1px solid #334155;
    transition: transform 0.2s ease;
    position: relative;
}

.stat-card:hover {
    transform: translateY(-4px);
}

/* Special styling för aktuellt pris */
.stat-card:first-child {
    background: linear-gradient(145deg, #ecfdf5 0%, #a7f3d0 40%, #6ee7b7 70%, #34d399 100%);
    border: 1px solid #6ee7b7;
    box-shadow: 0 4px 20px rgba(52, 211, 153, 0.3), inset 0 1px 0 rgba(255,255,255,0.4);
}

.stat-card:first-child .stat-label {
    color: #065f46;
}

.stat-card:first-child .stat-value {
    color: #047857;
}

.stat-card:first-child .stat-unit {
    color: #059669;
}

/* Trend-pil till höger */
.price-trend {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 3.5rem;
    font-weight: 900;
    cursor: help;
}

.stat-label {
    color: #94a3b8;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 800;
    color: #3b82f6;
    line-height: 1.2;
    margin-bottom: 4px;
}

.exact-price {
    font-size: 0.45em;
    opacity: 0.6;
    font-weight: 500;
    margin-left: 6px;
}

.stat-unit {
    color: #64748b;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Chart section */
.chart-section {
    background-color: #1e293b;
    border-radius: 16px;
    padding: 28px;
    margin-bottom: 32px;
    border: 1px solid #334155;
}

/* Week overview */
.week-overview {
    background-color: #1e293b;
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 32px;
    border: 1px solid #334155;
}

.week-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.week-header h3 {
    color: #f1f5f9;
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0;
}

.week-number {
    color: #94a3b8;
    font-size: 0.95rem;
    font-weight: 600;
}

.week-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 12px;
}

.week-day {
    background-color: #0f172a;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    border: 1px solid #334155;
    transition: transform 0.2s ease;
}

.week-day:hover {
    transform: translateY(-2px);
    border-color: #475569;
}

.week-day.today {
    background: linear-gradient(145deg, #ecfdf5 0%, #a7f3d0 40%, #6ee7b7 70%, #34d399 100%);
    border-color: #6ee7b7;
    box-shadow: 0 4px 20px rgba(52, 211, 153, 0.3), inset 0 1px 0 rgba(255,255,255,0.4);
}

.week-day.today .day-name,
.week-day.today .day-date {
    color: #065f46;
}

.week-day.today .day-price {
    color: #047857;
}

.week-day.today .day-unit {
    color: #059669;
}

.week-day.future {
    opacity: 0.5;
}

.day-name {
    font-size: 0.85rem;
    color: #94a3b8;
    font-weight: 600;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.day-date {
    font-size: 0.8rem;
    color: #64748b;
    margin-bottom: 12px;
}

.day-price {
    font-size: 1.5rem;
    font-weight: 800;
    color: #3b82f6;
    line-height: 1;
}

.day-unit {
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 4px;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.chart-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #f1f5f9;
}

.chart-date {
    color: #94a3b8;
    font-size: 0.95rem;
    white-space: pre-line;
    text-align: right;
}

.chart-container {
    position: relative;
    height: 400px;
    /* Förhindrar textmarkering vid långtryckning på mobil */
    user-select: none;
    -webkit-user-select: none;
}

/* Loading state */
.loading {
    text-align: center;
    padding: 60px 20px;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #334155;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

.loading-text {
    color: #94a3b8;
    font-size: 1.1rem;
}

/* Error state */
.error {
    background-color: #dc2626;
    color: white;
    padding: 24px;
    border-radius: 16px;
    margin-bottom: 24px;
    text-align: center;
}

.error strong {
    display: block;
    margin-bottom: 8px;
    font-size: 1.1rem;
}

/* Växelkurs */
.exchange-rate {
    text-align: center;
    color: #64748b;
    font-size: 0.85rem;
    margin-top: 20px;
}

/* Footer */
.timestamp {
    text-align: center;
    color: #64748b;
    font-size: 0.9rem;
    margin-top: 24px;
}

.credit {
    text-align: center;
    margin-top: 32px;
    padding: 20px;
}

.credit a {
    color: #3b82f6;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.credit a:hover {
    color: #60a5fa;
    text-decoration: underline;
}

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

/* Responsive design */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }

    header {
        padding: 24px 12px;
    }

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

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

    .stat-card {
        padding: 20px;
    }

    .stat-value {
        font-size: 2rem;
    }

    .chart-section {
        padding: 20px;
    }
    
    .week-days {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .week-overview {
        padding: 16px;
    }
}

/* Landscape mode på mobil/tablet - lägg till space på sidorna */
@media (max-width: 1024px) and (orientation: landscape) {
    .container {
        max-width: 100%;
        margin: 0 auto;
    }
    
    body {
        padding: 20px 0;
    }
}

/* Logo styling */
.logo {
    display: block;
    margin: 0 auto 5px;
    width: 100%;
    height: auto;
}

/* Desktop - 1091px bredd */
@media (min-width: 700px) {
    .logo {
        max-width: 700px;
    }
}

/* Tablet */
@media (max-width: 768px) and (min-width: 481px) {
    .logo {
        max-width: 350px;
    }
}

/* Mobil - större storlek för iPhone */
@media (max-width: 480px) {
    .logo {
        max-width: 280px;
    }
}

/* Wake Lock toggle */
.wakelock-container {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 12px;
}

.wakelock-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    padding: 6px 12px;
    border-radius: 8px;
    transition: background-color 0.2s;
}

.wakelock-label:hover {
    background-color: rgba(59, 130, 246, 0.1);
}

.wakelock-icon {
    font-size: 1rem;
}

.wakelock-text {
    color: #94a3b8;
    font-size: 0.85rem;
    font-weight: 500;
}

/* Toggle switch */
.wakelock-toggle {
    position: relative;
    width: 40px;
    height: 22px;
    flex-shrink: 0;
}

.wakelock-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.wakelock-slider {
    position: absolute;
    inset: 0;
    background-color: #334155;
    border-radius: 22px;
    transition: background-color 0.3s;
}

.wakelock-slider::before {
    content: '';
    position: absolute;
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: #94a3b8;
    border-radius: 50%;
    transition: transform 0.3s, background-color 0.3s;
}

.wakelock-toggle input:checked + .wakelock-slider {
    background-color: #1e40af;
}

.wakelock-toggle input:checked + .wakelock-slider::before {
    transform: translateX(18px);
    background-color: #3b82f6;
}