/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e, #16213e, #0f0f23);
    color: #e0e0e0;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Login Page Styles */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
}

.login-box {
    background: rgba(255, 255, 255, 0.1);
    padding: 2rem;
    border-radius: 15px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    text-align: center;
    margin-bottom: 2rem;
    color: #64b5f6;
    font-size: 1.8rem;
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #b0b0b0;
    font-size: 0.9rem;
}

.input-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: #e0e0e0;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.input-group input:focus {
    outline: none;
    border-color: #64b5f6;
    box-shadow: 0 0 10px rgba(100, 181, 246, 0.3);
}

.login-btn {
    width: 100%;
    padding: 0.75rem;
    background: linear-gradient(45deg, #64b5f6, #42a5f5);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.login-btn:hover {
    background: linear-gradient(45deg, #42a5f5, #2196f3);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(100, 181, 246, 0.4);
}

/* Main Application Styles */
.main-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-header {
    background: rgba(0, 0, 0, 0.3);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.app-header h1 {
    color: #64b5f6;
    font-size: 1.5rem;
}

.logout-btn {
    padding: 0.5rem 1rem;
    background: rgba(244, 67, 54, 0.8);
    border: none;
    border-radius: 6px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    background: rgba(244, 67, 54, 1);
    transform: translateY(-1px);
}

.content-wrapper {
    display: flex;
    flex: 1;
    gap: 2rem;
    padding: 2rem;
    align-items: flex-start;
    justify-content: flex-start;
}

/* Controls Panel */
.controls-panel {
    width: 350px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    height: fit-content;
    backdrop-filter: blur(10px);
    position: fixed;
    left: 2rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    max-height: calc(100vh - 140px);
    overflow-y: auto;
}

.control-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.control-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.control-section h3 {
    color: #64b5f6;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.control-section label {
    display: block;
    margin-bottom: 0.5rem;
    color: #b0b0b0;
    font-size: 0.9rem;
}

/* Input Styles */
.slider {
    width: 100%;
    margin-bottom: 0.5rem;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.2);
    outline: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #64b5f6;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #64b5f6;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.number-input, .lane-input {
    width: 100%;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    color: #e0e0e0;
    font-size: 0.9rem;
}

.number-input:focus, .lane-input:focus {
    outline: none;
    border-color: #64b5f6;
    box-shadow: 0 0 8px rgba(100, 181, 246, 0.3);
}

/* Lane Configuration */
.lane-row {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.lane-input {
    margin-bottom: 0;
    font-size: 0.8rem;
    padding: 0.4rem;
}

.toggle-btn {
    width: 100%;
    padding: 0.6rem;
    background: linear-gradient(45deg, #4caf50, #45a049);
    border: none;
    border-radius: 6px;
    color: white;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.toggle-btn:hover {
    background: linear-gradient(45deg, #45a049, #388e3c);
    transform: translateY(-1px);
}

/* Timer Controls */
.timer-section {
    text-align: center;
}

.timer-display {
    font-size: 2rem;
    color: #64b5f6;
    margin-bottom: 1rem;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(100, 181, 246, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Subsecond timer input styling */
.timer-input {
    width: 260px;
    text-align: center;
    font-size: 2.4rem;
    font-weight: 800;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.05); /* match controls-panel background */
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    outline: none;
    caret-color: #ffffff;
    padding: 0.3rem 0.75rem;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.12);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

.timer-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.timer-input:focus {
    border-color: rgba(255, 255, 255, 0.35);
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.25), 0 8px 24px rgba(0, 0, 0, 0.35);
}

.timer-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.play-btn {
    padding: 0.8rem 1.5rem;
    background: linear-gradient(45deg, #4caf50, #45a049);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.play-btn:hover {
    background: linear-gradient(45deg, #45a049, #388e3c);
    transform: translateY(-2px);
}

.play-btn.stop {
    background: linear-gradient(45deg, #f44336, #d32f2f);
}

.play-btn.stop:hover {
    background: linear-gradient(45deg, #d32f2f, #c62828);
}

.speed-toggles {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.speed-btn {
    padding: 0.5rem 0.8rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    color: #b0b0b0;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.speed-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #e0e0e0;
}

.speed-btn.active {
    background: linear-gradient(45deg, #64b5f6, #42a5f5);
    color: white;
    border-color: #64b5f6;
}

/* Timer Scrubber */
.timer-scrubber {
    margin-bottom: 1rem;
}

.timer-scrubber label {
    display: block;
    margin-bottom: 0.5rem;
    color: #b0b0b0;
    font-size: 0.9rem;
}

.scrubber-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 0.3rem;
    font-size: 0.8rem;
    color: #888;
}

/* Jump Controls */
.jump-controls {
    margin-top: 1.5rem;
}

.jump-controls h4 {
    color: #64b5f6;
    margin-bottom: 0.8rem;
    font-size: 1rem;
    text-align: center;
}

.jump-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.jump-btn {
    padding: 0.6rem 0.4rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    color: #e0e0e0;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.75rem;
    text-align: center;
    line-height: 1.2;
    font-weight: 500;
}

.jump-btn:hover {
    background: rgba(100, 181, 246, 0.2);
    border-color: #64b5f6;
    color: #64b5f6;
    transform: translateY(-1px);
}

.jump-btn span {
    font-size: 0.65rem;
    color: #888;
    font-weight: normal;
}

.jump-btn:hover span {
    color: #64b5f6;
}

/* Image Container */
.image-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 5;
}

.image-wrapper {
    position: relative;
    display: inline-block;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(100, 181, 246, 0.3);
    width: 800px;
    height: 800px;
}

#centralImage {
    display: block;
    width: 800px;
    height: 800px;
    transform: rotate(30deg);
    transition: transform 0.3s ease;
    object-fit: cover;
}

/* Lane Overlay Canvas */
.lane-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: all;
    z-index: 10;
    cursor: crosshair;
}

.lane-overlay:hover {
    cursor: crosshair;
}

.image-wrapper {
    position: relative;
    user-select: none;
}

/* WIPE Overlay */
.wipe-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.wipe-text {
    font-size: 8rem;
    font-weight: 900;
    letter-spacing: 0.5rem;
    color: #ff5252;
    text-shadow: 0 0 25px rgba(255, 82, 82, 0.7), 0 0 60px rgba(255, 82, 82, 0.5);
}

/* Ripple Controls Grid */
.ripple-controls {
    display: grid;
    gap: 0.8rem;
}

.ripple-controls label {
    margin-bottom: 0.3rem;
}

/* Import/Export */
.import-export {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.config-textarea {
    width: 100%;
    min-height: 140px;
    resize: vertical;
    padding: 0.6rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    color: #e0e0e0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.85rem;
}

.config-textarea:focus {
    outline: none;
    border-color: #64b5f6;
    box-shadow: 0 0 8px rgba(100, 181, 246, 0.3);
}

.import-export-actions {
    display: flex;
    gap: 0.5rem;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .content-wrapper {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .controls-panel {
        position: fixed;
        left: 1rem;
        top: 50%;
        transform: translateY(-50%);
        width: 300px;
        max-height: calc(100vh - 120px);
    }
    
    .image-container {
        position: fixed;
        top: 60%;
        left: 50%;
        transform: translate(-50%, -50%);
    }
    
    .image-wrapper {
        width: 600px;
        height: 600px;
    }
    
    #centralImage {
        width: 600px;
        height: 600px;
    }
    
    .lane-row {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .speed-toggles {
        flex-wrap: wrap;
    }
    
    .jump-buttons {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.4rem;
    }
    
    .jump-btn {
        font-size: 0.7rem;
        padding: 0.5rem 0.3rem;
    }
}

@media (max-width: 768px) {
    .content-wrapper {
        padding: 1rem;
    }
    
    .app-header {
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .controls-panel {
        position: fixed;
        left: 0.5rem;
        top: 50%;
        transform: translateY(-50%);
        width: 280px;
        max-height: calc(100vh - 100px);
    }
    
    .image-container {
        position: fixed;
        top: 50%;
        left: 65%;
        transform: translate(-50%, -50%);
    }
    
    .lane-row {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .image-wrapper {
        width: 400px;
        height: 400px;
    }
    
    #centralImage {
        width: 400px;
        height: 400px;
    }
    
    .jump-buttons {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.3rem;
    }
    
    .jump-btn {
        font-size: 0.65rem;
        padding: 0.4rem 0.2rem;
    }
    
    .jump-btn span {
        font-size: 0.6rem;
    }
}

/* Smooth animations */
* {
    transition: all 0.3s ease;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

::-webkit-scrollbar-thumb {
    background: rgba(100, 181, 246, 0.5);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(100, 181, 246, 0.7);
}