/* ===== Base Styles ===== */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f0f2f5;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

h1 {
    text-align: center;
    margin-bottom: 20px;
    color: #2a4365;
}

/* ===== Tab Navigation ===== */
.tab-container {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #cbd5e0;
}

.tab {
    padding: 10px 20px;
    cursor: pointer;
    margin: 0 5px;
    transition: all 0.3s ease;
}

.tab.active {
    border-bottom: 2px solid #4299e1;
    font-weight: bold;
    color: #2b6cb0;
}

/* ===== Editor Layout ===== */
.editor-container {
    display: flex;
    align-items: stretch;
    margin-bottom: 20px;
}

.control-sidebar {
    width: 60px;
    margin-right: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    flex-shrink: 0;
}

/* ===== Control Sliders ===== */
/* Common slider styles */
.density-slider-container,
.speed-slider-container,
.glow-size-slider-container {
    height: 150px;
    width: 40px;
    background-color: #e2e8f0;
    border-radius: 8px;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 0;
    margin-bottom: 15px;
}

/* Vertical range slider styles */
.density-slider,
.speed-slider,
.glow-size-slider {
    width: 100%;
    height: 100%;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    outline: none;
    writing-mode: vertical-lr;
    direction: rtl;
}

/* Slider thumb styles */
.density-slider::-webkit-slider-thumb,
.speed-slider::-webkit-slider-thumb,
.glow-size-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #3b82f6;
    cursor: pointer;
}

.density-slider::-moz-range-thumb,
.speed-slider::-moz-range-thumb,
.glow-size-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #3b82f6;
    cursor: pointer;
}

/* Slider labels */
.density-label,
.speed-label,
.glow-size-label {
    font-size: 10px;
    margin-top: 5px;
    color: #4a5568;
    text-align: center;
}

/* ===== Color Bar ===== */
.color-bar-container {
    height: 150px;
    width: 40px;
    background: #f0f0f0; /* Neutral background instead of predefined gradient */
    border-radius: 8px;
    position: relative;
    overflow: visible;
    margin-bottom: 15px;
}

.color-marker {
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid white;
    right: -10px;
    transform: translateY(-50%);
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.color-marker::after {
    content: "×";
    position: absolute;
    top: -12px;
    right: -12px;
    width: 16px;
    height: 16px;
    background-color: #ef4444;
    color: white;
    border-radius: 50%;
    font-size: 12px;
    line-height: 16px;
    text-align: center;
    font-weight: bold;
    opacity: 0.9;
}

/* ===== Input Areas ===== */
.input-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: #1a202c;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    width: 100%;
    max-width: 100%;
    aspect-ratio: 1/1;
}

.input-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
}

/* ===== Canvas Layers ===== */
.overlay-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
}

#lightsOverlayCanvas {
    z-index: 20;
    cursor: crosshair;
    pointer-events: auto;
}

#depthOverlayCanvas {
    z-index: 10;
    pointer-events: none;
}

#lineOverlayCanvas {
    z-index: 30;
    pointer-events: none;
}

.crosshair {
    cursor: crosshair;
}

video, #previewImage, #canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ===== Buttons and Controls ===== */
.button-container {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 7px;
    margin: 15px 0;
}

.button {
    padding: 8px 16px;
    border-radius: 6px;
    border: none;
    color: white;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Button color variants */
.button-rainbow {
  background-image: linear-gradient(
    to right, 
    #ff9999, /* light red */
    #ffcc99, /* light orange */
    #ffff99, /* light yellow */
    #99ff99, /* light green */
    #99ccff, /* light blue */
    #cc99ff, /* light indigo */
    #ff99ff  /* light violet */
  );
  color: white;
  text-shadow: -1px -1px 0 black, 
                1px -1px 0 black, 
               -1px 1px 0 black, 
                1px 1px 0 black,
               -2px 0 0 black,
                2px 0 0 black,
                0 -2px 0 black,
                0 2px 0 black;
}

.button-blue {
    background-color: #3b82f6;
}

.button-blue:hover:not(:disabled) {
    background-color: #2563eb;
}

.button-green {
    background-color: #10b981;
}

.button-green:hover:not(:disabled) {
    background-color: #059669;
}

.button-purple {
    background-color: #8b5cf6;
}

.button-purple:hover:not(:disabled) {
    background-color: #7c3aed;
}

.button-red {
    background-color: #ef4444;
}

.button-red:hover:not(:disabled) {
    background-color: #dc2626;
}

.button-gray {
    background-color: #6b7280;
}

.button-gray:hover:not(:disabled) {
    background-color: #4b5563;
}

.button-orange {
    background-color: #ed8936;
}

.button-orange:hover:not(:disabled) {
    background-color: #dd6b20;
}

.toggle-btn {
    margin-top: 5px;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 500;
}

/* File input styling */
.file-input {
    position: absolute;
    width: 0.1px;
    height: 0.1px;
    opacity: 0;
    overflow: hidden;
    z-index: -1;
}

.file-label {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 6px;
    background-color: #3b82f6;
    color: white;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.file-label:hover {
    background-color: #2563eb;
}

/* ===== Overlays and Modals ===== */
.processing-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    z-index: 100;
}

.color-picker-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.color-picker-container {
    background-color: white;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-width: 300px;
    width: 100%;
}

.color-picker-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 10px;
    color: #4a5568;
}

.color-picker-input {
    width: 100%;
    height: 40px;
    margin-bottom: 15px;
    border: none;
    outline: none;
}

.color-picker-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ===== Utility Classes ===== */
.hidden {
    display: none !important;
}

.instructions {
    text-align: center;
    margin: 10px 0;
    font-size: 14px;
    color: #4a5568;
}

/* ===== Progress Bar ===== */
.progress {
    width: 50%;
    height: 4px;
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 10px;
}

.progress-bar {
    height: 100%;
    background-color: #3b82f6;
    width: 0%;
    transition: width 0.3s ease;
    animation: progress-animation 1.5s infinite ease-in-out;
}

@keyframes progress-animation {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}

/* ===== Responsive Styles ===== */
@media (max-width: 768px) {
    .editor-container {
        flex-direction: column;
    }
    
    .control-sidebar {
        flex-direction: row;
        width: 100%;
        margin-right: 0;
        margin-bottom: 15px;
        justify-content: space-around;
    }
    
    .density-slider-container,
    .color-bar-container,
    .speed-slider-container,
    .glow-size-slider-container {
        height: 150px;
        margin-bottom: 0;
        margin-right: 5px;
    }
    
    .input-container {
        max-width: 100%;
        width: 100%;
        margin: 0 auto;
    }
}