/**
 * Stroomprijs Klok Styles
 */

/* CSS Variables for Theming */
:root {
    /* Dark theme (default) */
    --bg-gradient-start: #1e1e1e;
    --bg-gradient-end: #2d2d2d;
    --text-primary: #ffffff;
    --text-secondary: #999999;
    --text-tertiary: #666666;

    --surface-primary: #1a1a1a;
    --surface-secondary: #2a2a2a;
    --surface-tertiary: #333333;

    --border-primary: #444444;
    --border-secondary: #333333;

    --shadow: rgba(0, 0, 0, 0.5);

    /* Price colors remain the same */
    --color-low: #22c55e;
    --color-medium-low: #84cc16;
    --color-medium: #eab308;
    --color-medium-high: #f97316;
    --color-high: #ef4444;

    /* UI accent colors (neutral, not price-related) */
    --accent-primary: #3b82f6;
    --accent-hover: #2563eb;
}

/* Light theme */
[data-theme="light"] {
    --bg-gradient-start: #f0f0f0;
    --bg-gradient-end: #e0e0e0;
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --text-tertiary: #999999;

    --surface-primary: #ffffff;
    --surface-secondary: #f5f5f5;
    --surface-tertiary: #e0e0e0;

    --border-primary: #cccccc;
    --border-secondary: #e0e0e0;

    --shadow: rgba(0, 0, 0, 0.1);

    /* UI accent colors for light theme */
    --accent-primary: #3b82f6;
    --accent-hover: #2563eb;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    transition: background 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 800px;
    width: 100%;
}

/* Header */
header {
    margin-bottom: 30px;
    margin-top: 24px;
    text-align: center;
    position: relative;
}

h1 {
    font-size: 2.5em;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.subtitle {
    font-size: 1.1em;
    color: var(--text-secondary);
}

/* Theme Toggle */
.theme-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 1.2em;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
    z-index: 9999;
}

.theme-toggle:hover {
    opacity: 1;
    background: var(--surface-secondary);
    transform: scale(1.05);
}

.theme-toggle:active {
    transform: scale(0.95);
}

.theme-icon {
    display: block;
    transition: transform 0.3s ease;
}

/* Sentiment Message */
.sentiment-message {
    text-align: center;
    padding: 15px 25px;
    margin: 20px auto;
    max-width: 500px;
    border-radius: 12px;
    font-size: 1.1em;
    font-weight: 500;
    background: var(--surface-secondary);
    border: 2px solid var(--border-primary);
    transition: all 0.3s ease;
}

.sentiment-message.hidden {
    display: none;
}

.sentiment-message strong {
    font-weight: 700;
}

.sentiment-low {
    border-color: var(--color-low);
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.1) 0%, rgba(34, 197, 94, 0.05) 100%);
}

.sentiment-low strong {
    color: var(--color-low);
}

.sentiment-average {
    border-color: var(--color-medium);
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.1) 0%, rgba(234, 179, 8, 0.05) 100%);
}

.sentiment-average strong {
    color: var(--color-medium);
}

.sentiment-high {
    border-color: var(--color-high);
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(239, 68, 68, 0.05) 100%);
}

.sentiment-high strong {
    color: var(--color-high);
}

.sentiment-message .future-change {
    display: block;
    margin-top: 8px;
    font-size: 0.9em;
    color: var(--text-secondary);
}

/* Controls Bottom (below visualization) */
.controls-bottom {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 30px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 20px;
}

.date-navigation {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-button {
    background: var(--surface-secondary);
    border: 2px solid var(--border-primary);
    color: var(--text-primary);
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 1.2em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.nav-button:hover {
    background: var(--surface-tertiary);
    border-color: var(--text-secondary);
    transform: scale(1.05);
}

.nav-button:active {
    transform: scale(0.95);
}

.nav-button:disabled {
    background: var(--surface-primary);
    border-color: var(--border-secondary);
    color: var(--text-tertiary);
    cursor: not-allowed;
    opacity: 0.5;
}

.nav-button:disabled:hover {
    background: var(--surface-primary);
    border-color: var(--border-secondary);
    transform: none;
}

.today-button {
    background: var(--accent-primary);
    border: none;
    color: #fff;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.today-button:hover {
    background: var(--accent-hover);
}

.today-button:disabled {
    background: var(--border-primary);
    cursor: not-allowed;
    opacity: 0.5;
}

.current-date {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1.1em;
    white-space: nowrap;
}

/* View Toggle */
.view-toggle,
.view-type-toggle {
    display: flex;
    gap: 10px;
    background: var(--surface-secondary);
    padding: 5px;
    border-radius: 8px;
    border: 2px solid var(--border-primary);
}

.toggle-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.toggle-label input[type="radio"] {
    display: none;
}

.toggle-label span {
    color: var(--text-secondary);
    font-weight: 500;
    transition: color 0.3s ease;
}

.toggle-label:has(input:checked) {
    background: var(--accent-primary);
}

.toggle-label:has(input:checked) span {
    color: #fff;
}

/* Legend */
.legend {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 20px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
}

.legend-color {
    width: 30px;
    height: 20px;
    border-radius: 4px;
    border: 1px solid #444;
}

.legend-color.low {
    background: linear-gradient(90deg, #22c55e 0%, #84cc16 100%);
}

.legend-color.medium {
    background: linear-gradient(90deg, #84cc16 0%, #eab308 50%, #f97316 100%);
}

.legend-color.high {
    background: linear-gradient(90deg, #f97316 0%, #ef4444 100%);
}

/* Visualization Container */
.visualization-container {
    position: relative;
    width: 100%;
}

/* Clock Container */
.clock-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto;
    max-width: 600px;
}

#clock {
    width: 100%;
    height: auto;
    filter: drop-shadow(0 20px 60px var(--shadow)) drop-shadow(0 10px 20px var(--shadow));
    transition: filter 0.3s ease;
}

#clock:hover {
    filter: drop-shadow(0 25px 70px var(--shadow)) drop-shadow(0 15px 30px var(--shadow));
}

.price-segment {
    cursor: pointer;
    transition: all 0.3s ease;
}

.price-segment:hover {
    opacity: 0.85;
    transform: scale(1.02);
    transform-origin: center;
}

.price-segment.past {
    opacity: 0.3 !important;
}

.price-segment.past:hover {
    opacity: 0.4 !important;
    transform: none;
}

/* Chart Container */
.chart-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto;
    max-width: 1000px;
    width: 100%;
}

#chart {
    width: 100%;
    height: auto;
    filter: drop-shadow(0 10px 30px var(--shadow));
}

.price-bar {
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.price-bar:hover {
    opacity: 0.8 !important;
}

.price-bar.past {
    opacity: 0.3 !important;
}

.price-bar.past:hover {
    opacity: 0.4 !important;
}

/* Hidden class */
.hidden {
    display: none !important;
}

/* Tooltip */
.tooltip {
    position: absolute;
    background: var(--surface-primary);
    color: var(--text-primary);
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.9em;
    pointer-events: none;
    z-index: 1000;
    border: 1px solid var(--border-primary);
    backdrop-filter: blur(10px);
    line-height: 1.6;
    min-width: 150px;
    box-shadow: 0 4px 12px var(--shadow);
}

.tooltip strong {
    color: var(--color-low);
    font-size: 1.1em;
}

.tooltip em {
    color: var(--color-medium);
    font-style: normal;
}

.tooltip small {
    color: var(--text-secondary);
}

/* Status */
.status {
    text-align: center;
    margin-top: 20px;
    padding: 10px;
    border-radius: 8px;
    font-size: 0.9em;
    min-height: 20px;
}

.status.loading {
    color: var(--color-medium);
}

.status.success {
    color: var(--color-low);
}

.status.error {
    color: var(--color-high);
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--color-high);
}

/* Responsive Design */
@media (max-width: 768px) {
    h1 {
        font-size: 2em;
    }

    .controls-bottom {
        flex-direction: column;
        align-items: stretch;
        gap: 20px;
    }

    .date-navigation {
        flex-direction: column;
        width: 100%;
    }

    .nav-button,
    .today-button {
        width: 100%;
    }

    .current-date {
        text-align: center;
        white-space: normal;
    }

    .view-toggle,
    .view-type-toggle {
        width: 100%;
        justify-content: center;
    }

    .legend {
        gap: 15px;
    }

    .legend-item {
        font-size: 0.8em;
    }

    .chart-container {
        max-width: 100%;
        overflow-x: auto;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.5em;
    }

    .subtitle {
        font-size: 0.9em;
    }

    .clock-container {
        max-width: 100%;
    }

    .tooltip {
        font-size: 0.8em;
        padding: 8px 12px;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.container {
    animation: fadeIn 0.6s ease-out;
}

/* Print styles */
@media print {
    body {
        background: white;
        color: black;
    }

    .controls,
    .status,
    .powered-by {
        display: none;
    }
}

/* Powered by section */
.powered-by {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

.powered-by-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--surface-secondary);
    border: 1px solid var(--border-secondary);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 8px var(--shadow);
}

.powered-by-link:hover {
    background: var(--surface-tertiary);
    color: var(--text-primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--shadow);
}

.powered-by-text {
    user-select: none;
}

.powered-by-logo {
    height: 16px;
    width: auto;
    transition: opacity 0.2s ease;
}

/* Theme-based logo visibility */
[data-theme="light"] .dark-theme-logo,
:root:not([data-theme="light"]) .light-theme-logo {
    display: none;
}

[data-theme="light"] .light-theme-logo,
:root:not([data-theme="light"]) .dark-theme-logo {
    display: block;
}

/* PWA Specific Styles */
@media (display-mode: standalone) {
    /* Hide the powered-by when in standalone mode to give more space */
    .powered-by {
        display: none;
    }
    
    /* Adjust container padding for standalone mode */
    .container {
        padding-bottom: 20px;
    }
    
    /* Add safe area insets for devices with notches */
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
}

/* Install button styles */
.install-button {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.install-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.2) !important;
}

.install-button:active {
    transform: translateY(0);
}

/* Mobile responsive */
@media (max-width: 768px) {
    .powered-by {
        bottom: 10px;
        right: 10px;
    }
    
    .powered-by-link {
        padding: 6px 10px;
        font-size: 11px;
    }
    
    .powered-by-logo {
        height: 14px;
    }
    
    /* PWA install button on mobile */
    .install-button {
        bottom: 80px !important;
        right: 15px !important;
        padding: 10px 14px !important;
        font-size: 13px !important;
    }
}
