/**
 * Application Styles
 * Main stylesheet for Three.js scene optimizer
 */

/* ===== BASE STYLES ===== */
body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #1a1a1a;
    color: #e0e0e0;
}

/* ===== BUTTON STYLES ===== */
button {
    font-family: inherit;
    font-size: 13px;
    padding: 8px 16px;
    margin: 4px 0;
    border: 1px solid #444;
    border-radius: 4px;
    background: #2a2a2a;
    color: #e0e0e0;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    min-width: 100px;
}

button:hover {
    background: #3a3a3a;
    border-color: #555;
}

button:active {
    background: #1a1a1a;
    transform: translateY(1px);
}

button:focus {
    box-shadow: 0 0 0 2px rgba(100, 149, 237, 0.3);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #252525;
}

/* ===== STATEFUL BUTTON STATES ===== */
.stateful-button {
    position: relative;
    font-weight: 500;
}

.stateful-button.idle {
    background: #2a5aa8;
    border-color: #3a6ab8;
}

.stateful-button.idle:hover {
    background: #3a6ab8;
    border-color: #4a7ac8;
    box-shadow: 0 2px 8px rgba(42, 90, 168, 0.3);
}

.stateful-button.idle:active {
    background: #1a4a98;
}

.stateful-button.processing {
    background: #5a5a2a;
    border-color: #6a6a3a;
    cursor: wait;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.stateful-button.success {
    background: #2a5a2a;
    border-color: #3a6a3a;
    animation: success-flash 0.5s ease;
}

@keyframes success-flash {
    0% { background: #3a7a3a; }
    50% { background: #4a8a4a; }
    100% { background: #2a5a2a; }
}

.stateful-button.error {
    background: #5a2a2a;
    border-color: #6a3a3a;
    animation: error-shake 0.3s ease;
}

@keyframes error-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

/* ===== OPTIONS PANEL STYLES ===== */
.options-panel {
    position: fixed;
    top: 10px;
    right: 10px;
    background: rgba(20, 20, 20, 0.95);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #333;
    max-height: 90vh;
    overflow-y: auto;
    min-width: 280px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.options-panel h3 {
    margin: 0 0 10px 0;
    font-size: 16px;
    font-weight: 600;
    color: #6495ed;
    border-bottom: 1px solid #333;
    padding-bottom: 8px;
}

/* ===== SLIDER ROW STYLES ===== */
.slider-row {
    margin: 12px 0;
}

.slider-row label {
    display: block;
    font-size: 12px;
    margin-bottom: 4px;
    color: #b0b0b0;
}

.slider-row input[type="range"] {
    width: 100%;
    margin: 4px 0;
    cursor: pointer;
}

.slider-row .value-display {
    display: inline-block;
    min-width: 50px;
    text-align: right;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: #6495ed;
}

/* ===== CHECKBOX ROW STYLES ===== */
.checkbox-row {
    margin: 10px 0;
    display: flex;
    align-items: center;
}

.checkbox-row label {
    flex: 1;
    font-size: 13px;
    color: #b0b0b0;
    cursor: pointer;
    user-select: none;
}

.checkbox-row input[type="checkbox"] {
    margin-right: 8px;
    cursor: pointer;
    width: 16px;
    height: 16px;
}

/* ===== SELECT ROW STYLES ===== */
.select-row {
    margin: 12px 0;
}

.select-row label {
    display: block;
    font-size: 12px;
    margin-bottom: 4px;
    color: #b0b0b0;
}

.select-row select {
    width: 100%;
    padding: 6px 8px;
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 13px;
    cursor: pointer;
}

.select-row select:hover {
    border-color: #555;
}

/* ===== STATS OVERLAY STYLES ===== */
.stats-overlay {
    position: fixed;
    top: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.8);
    padding: 10px 15px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    border-radius: 4px;
    border: 1px solid #333;
    line-height: 1.6;
}

.stats-overlay .stat-line {
    margin: 2px 0;
}

.stats-overlay .stat-label {
    color: #888;
}

.stats-overlay .stat-value {
    color: #6495ed;
    font-weight: bold;
}

/* ===== SCROLLBAR STYLES ===== */
.options-panel::-webkit-scrollbar {
    width: 8px;
}

.options-panel::-webkit-scrollbar-track {
    background: #1a1a1a;
    border-radius: 4px;
}

.options-panel::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 4px;
}

.options-panel::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ===== LOADING SCREEN ===== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #1a1a1a; /* Dark background */
    display: flex;
    flex-direction: row; /* Side by side */
    justify-content: flex-start; /* Left */
    align-items: flex-end; /* Bottom */
    padding: 60px; /* Proper margins */
    box-sizing: border-box;
    z-index: 10000;
    transition: opacity 0.5s ease;
}

/* Asymmetric Bar Loader */
.loading-spinner {
    width: 4px;
    height: 24px;
    background: #ffffff;
    margin-right: 15px; /* Space between loader and text */
    margin-bottom: 0; /* Reset margin */
    position: relative;
    animation: bar-wave 1s ease-in-out infinite;
    animation-delay: 0.1s;
    /* Remove old spinner styles */
    border: none;
    border-radius: 0;
}

.loading-spinner::before,
.loading-spinner::after {
    content: '';
    position: absolute;
    width: 4px;
    height: 24px;
    background: #ffffff;
    bottom: 0;
}

.loading-spinner::before {
    left: -8px;
    animation: bar-wave 1s ease-in-out infinite;
    animation-delay: 0s;
}

.loading-spinner::after {
    left: 8px;
    animation: bar-wave 1s ease-in-out infinite;
    animation-delay: 0.2s;
}

.loading-text {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 12px;
    font-weight: 500;
    color: #aaaaaa;
    letter-spacing: 2px;
    text-transform: uppercase;
    padding-bottom: 4px; /* Align with bottom of bars */
}

@keyframes bar-wave {
    0%, 100% { height: 12px; opacity: 0.5; }
    50% { height: 24px; opacity: 1; }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
