/* Global Theme CSS - Light & Dark Mode */

:root {
    /* Light mode variables (default) */
    --bg-primary: #ffffff;
    --bg-secondary: #f8f8f8;
    --bg-tertiary: #eeeeee;
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-muted: #999999;
    --border-color: #dddddd;
    --accent-color: #4CAF50;
    --accent-hover: #45a049;
    --header-bg: rgba(255, 255, 255, 0.8);
    --box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --switch-bg-off: #cccccc;
    --switch-bg-on: #4CAF50;
    --slider-bg: #cccccc;
    --range-thumb: #4CAF50;
}

/* Dark mode variables */
[data-theme="dark"] {
    --bg-primary: #1e1e1e;
    --bg-secondary: #2d2d2d;
    --bg-tertiary: #3d3d3d;
    --text-primary: #f0f0f0;
    --text-secondary: #cccccc;
    --text-muted: #999999;
    --border-color: #555555;
    --accent-color: #5cbb5e;
    --accent-hover: #6ecc70;
    --header-bg: rgba(30, 30, 30, 0.9);
    --box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    --switch-bg-off: #555555;
    --switch-bg-on: #5cbb5e;
    --slider-bg: #555555;
    --range-thumb: #5cbb5e;
}

/* Apply theme variables to elements */
body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.w3-content, .w3-container, .w3-panel, .w3-card-4 {
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

.w3-panel.w3-opacity {
    background-color: var(--header-bg);
}

.w3-bar, .w3-border {
    border-color: var(--border-color) !important;
}

.w3-bar-item, .w3-button {
    color: var(--text-primary) !important;
}

.w3-bar-item:hover, .w3-button:hover {
    background-color: var(--bg-secondary) !important;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
}

p, span {
    color: var(--text-secondary);
}

/* Important parameter form styling */
.parameter-form {
    background-color: var(--bg-secondary) !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: var(--box-shadow) !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] .parameter-form {
    background-color: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
}

.form-group input, .form-group select, textarea {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

/* Input range styling for theme compatibility */
input[type="range"] {
    -webkit-appearance: none;
    background-color: var(--slider-bg);
    height: 8px;
    border-radius: 5px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background-color: var(--range-thumb);
    border-radius: 50%;
    cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background-color: var(--range-thumb);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.form-group label {
    color: var(--text-primary);
}

.submit-btn {
    background-color: var(--accent-color);
    color: white;
}

.submit-btn:hover {
    background-color: var(--accent-hover);
}

/* Regular switch styling */
.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--switch-bg-off);
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--switch-bg-on);
}

input:focus + .slider {
    box-shadow: 0 0 1px var(--switch-bg-on);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

/* Image border for dark mode visibility */
[data-theme="dark"] img {
    border: 1px solid var(--border-color);
}

/* Toggle switch styling for theme switcher */
.theme-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
    margin: 10px;
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.theme-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--switch-bg-off);
    transition: .4s;
    border-radius: 34px;
}

.theme-slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .theme-slider {
    background-color: var(--switch-bg-on);
}

input:focus + .theme-slider {
    box-shadow: 0 0 1px var(--switch-bg-on);
}

input:checked + .theme-slider:before {
    transform: translateX(26px);
}

/* Theme switch icon indicators */
.theme-slider:after {
    content: '☀️';
    position: absolute;
    right: 8px;
    top: 7px;
    font-size: 12px;
}

input:checked + .theme-slider:after {
    content: '🌙';
    left: 8px;
    right: unset;
}

/* Theme toggle container styling */
.theme-toggle-container {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    align-items: center;
    z-index: 1000;
    background-color: var(--bg-secondary);
    padding: 5px 10px;
    border-radius: 20px;
    box-shadow: var(--box-shadow);
}

.theme-toggle-label {
    margin-right: 10px;
    font-weight: bold;
    color: var(--text-primary);
}

@media (prefers-color-scheme: dark) {
    :root {
        /* If user's system prefers dark mode, use dark theme by default */
        --bg-primary: #1e1e1e;
        --bg-secondary: #2d2d2d;
        --bg-tertiary: #3d3d3d;
        --text-primary: #f0f0f0;
        --text-secondary: #cccccc;
        --text-muted: #999999;
        --border-color: #555555;
        --accent-color: #5cbb5e;
        --accent-hover: #6ecc70;
        --header-bg: rgba(30, 30, 30, 0.9);
        --box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
        --switch-bg-off: #555555;
        --switch-bg-on: #5cbb5e;
        --slider-bg: #555555;
        --range-thumb: #5cbb5e;
    }
} 