/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #e6e6e6;
    min-height: 100vh;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 16px;
}

/* Header styles */
header {
    text-align: center;
    margin-bottom: 24px;
    padding: 18px 0;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

header h1 {
    font-size: 1.9rem;
    margin-bottom: 6px;
    background: linear-gradient(45deg, #4cc9f0, #4361ee);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

header h1 i {
    margin-right: 8px;
}

.subtitle {
    font-size: 0.95rem;
    color: #a0a0c0;
    max-width: 600px;
    margin: 0 auto;
}

/* Main app container */
.app-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
    margin-bottom: 32px;
}

/* Images take full width */
.preview-section {
    width: 100%;
}

/* Controls below images */
.control-panel {
    width: 100%;
    margin-top: 12px;
}

/* Control panel styles */
.control-panel {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 18px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.control-panel h2 {
    font-size: 1.1rem;
    margin-bottom: 12px;
    color: #4cc9f0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-panel h3 {
    font-size: 1rem;
    margin: 16px 0 10px;
    color: #a0a0c0;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Upload section */
.upload-area {
    border: 2px dashed rgba(76, 201, 240, 0.3);
    border-radius: 10px;
    padding: 26px 16px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    margin-bottom: 16px;
}

.upload-area:hover {
    border-color: #4cc9f0;
    background: rgba(76, 201, 240, 0.05);
}

.upload-area.drag-over {
    border-color: #4361ee;
    background: rgba(67, 97, 238, 0.1);
}

.upload-icon {
    font-size: 2.2rem;
    color: #4cc9f0;
    margin-bottom: 10px;
}

.upload-area p {
    margin-bottom: 14px;
    color: #a0a0c0;
}

.image-info {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 12px;
    margin-top: 12px;
}

.image-info p {
    margin: 8px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.image-info i {
    color: #4cc9f0;
    width: 20px;
}

/* LUT buttons */
.lut-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin-bottom: 18px;
}

.lut-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 10px 8px;
    color: #e6e6e6;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-width: 120px;
}

.lut-btn:hover {
    background: rgba(76, 201, 240, 0.1);
    border-color: #4cc9f0;
    transform: translateY(-1px);
}

.lut-btn.active {
    background: rgba(67, 97, 238, 0.2);
    border-color: #4361ee;
    box-shadow: 0 2px 10px rgba(67, 97, 238, 0.3);
}

.lut-btn i {
    font-size: 1.15rem;
    margin-bottom: 2px;
}

.lut-btn .lut-name {
    font-weight: 600;
}

.lut-btn .lut-desc {
    font-size: 0.72rem;
    color: #a0a0c0;
    text-align: center;
}

/* Custom LUT upload */
.upload-lut-area {
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
}

.upload-lut-area p {
    margin-bottom: 15px;
    color: #a0a0c0;
}

/* Button styles */
.btn {
    padding: 9px 16px;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(45deg, #4cc9f0, #4361ee);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(76, 201, 240, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.btn-success {
    background: linear-gradient(45deg, #2ecc71, #27ae60);
    color: white;
}

.btn-warning {
    background: linear-gradient(45deg, #f39c12, #e67e22);
    color: white;
}

.btn-info {
    background: linear-gradient(45deg, #3498db, #2980b9);
    color: white;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* Hide Apply button since we auto-apply */
#applyBtn {
    display: none !important;
}

/* Preview section */
.preview-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 18px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.image-comparison {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

@media (max-width: 768px) {
    .image-comparison {
        grid-template-columns: 1fr;
    }
}

.image-container h3 {
    font-size: 1.05rem;
    margin-bottom: 10px;
    color: #4cc9f0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.image-wrapper {
    position: relative;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    overflow: hidden;
    min-height: 260px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

canvas {
    width: 100%;
    height: 100%;
    display: block;
    background: transparent;
}

.placeholder {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #a0a0c0;
}

.placeholder-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

/* Performance info */
.performance-info {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.performance-info h3 {
    font-size: 1rem;
    margin-bottom: 12px;
    color: #4cc9f0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.stat {
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-label {
    display: block;
    font-size: 0.9rem;
    color: #a0a0c0;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    font-size: 1.2rem;
    font-weight: 600;
    color: #4cc9f0;
}

/* Info panel */
.info-panel {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 18px;
    margin-bottom: 32px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.info-panel h2 {
    font-size: 1.1rem;
    margin-bottom: 12px;
    color: #4cc9f0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-content {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.info-content p {
    margin-bottom: 15px;
    color: #a0a0c0;
}

.info-content p:last-child {
    margin-bottom: 0;
}

.info-content strong {
    color: #4cc9f0;
}

/* Footer */
footer {
    text-align: center;
    padding: 20px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: #a0a0c0;
}

footer p {
    margin-bottom: 20px;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.footer-link {
    color: #4cc9f0;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: color 0.3s ease;
}

.footer-link:hover {
    color: #4361ee;
}

/* Loading animation */
.loading {
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: #4cc9f0;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Toast notifications */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    border-left: 4px solid #4cc9f0;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
    max-width: 400px;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.error {
    border-left-color: #e74c3c;
}

.toast.success {
    border-left-color: #2ecc71;
}

.toast.warning {
    border-left-color: #f39c12;
}

/* ===== NEW COMPACT LAYOUT ===== */

.image-comparison-area {
    margin-bottom: 5px; /* Reduced from 20px */
}

.image-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 0; /* Removed margin */
}

@media (max-width: 768px) {
    .image-comparison {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

/* Drag & drop zone for original image */
#originalDropZone {
    border: 2px dashed rgba(76, 201, 240, 0.3);
    transition: all 0.3s ease;
    min-height: 300px;
}

#originalDropZone.drag-over {
    border-color: #4cc9f0;
    background: rgba(76, 201, 240, 0.05);
}

/* Image header with stats/filter info on one line */
.image-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.image-header h3 {
    margin: 0;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Image stats next to "Original" */
.image-stats {
    font-size: 0.8rem;
    color: #a0a0c0;
    display: flex;
    align-items: center;
    gap: 5px;
}

.stats-label {
    font-weight: 500;
}

.stats-value {
    color: #4cc9f0;
    font-weight: 500;
}

/* Compact filter info on one line */
.filter-info-compact {
    font-size: 0.8rem;
    color: #a0a0c0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    background: rgba(76, 201, 240, 0.1);
    border-radius: 4px;
    border-left: 2px solid #4cc9f0;
}

.filter-label {
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 5px;
}

.filter-stats {
    color: #4cc9f0;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-stats i {
    font-size: 0.7rem;
}

#processingTime,
#renderMethod {
    color: #4cc9f0;
    font-weight: 500;
}

/* Compact LUT section */
.lut-section-compact {
    margin-bottom: 20px;
    margin-top: 0; /* No top margin - directly below images */
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.lut-buttons-compact {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr)); /* 6 defaults + More + extra */
    gap: 8px;
    flex: 1;
}

@media (max-width: 1200px) {
    .lut-buttons-compact {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .lut-buttons-compact {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 480px) {
    .lut-buttons-compact {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* LUT buttons container with More button */
.lut-buttons-with-more {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: start;
}

/* More LUTs button (styled like other LUT buttons) */
.btn-more {
    background: rgba(155, 89, 182, 0.15);
    border: 1px solid rgba(155, 89, 182, 0.4);
    color: #e6e6e6;
}

.btn-more:hover {
    background: rgba(155, 89, 182, 0.25);
    border-color: #9b59b6;
    transform: translateY(-1px);
}

.btn-more i {
    color: #9b59b6;
}

/* Dialog overlay */
.dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.dialog {
    background: #1a1a2e;
    border-radius: 12px;
    width: 500px;
    max-width: 90vw;
    max-height: 80vh;
    border: 1px solid rgba(76, 201, 240, 0.2);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    transform: scale(0.9);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.dialog-header {
    background: rgba(76, 201, 240, 0.1);
    padding: 15px 20px;
    border-bottom: 1px solid rgba(76, 201, 240, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dialog-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: #4cc9f0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.dialog-close {
    background: none;
    border: none;
    color: #a0a0c0;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.dialog-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.dialog-content {
    padding: 20px;
}

.lut-selector select {
    width: 100%;
    height: 300px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #e6e6e6;
    font-family: monospace;
    font-size: 0.9rem;
    padding: 10px;
    margin-bottom: 20px;
}

.lut-selector select option {
    padding: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.lut-selector select option:hover {
    background: rgba(76, 201, 240, 0.1);
}

.dialog-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Tone curve control */
.tone-curve-control {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 10px 0 15px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
}

.tone-curve-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: #a0a0c0;
    margin-left: 8px;
}

.tone-curve-control label {
    font-size: 0.9rem;
    color: #a0a0c0;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 110px;
}

#toneCurveSlider {
    flex: 1;
}

.tone-curve-value {
    width: 32px;
    text-align: right;
    color: #4cc9f0;
    font-weight: 500;
}

/* Compact upload controls */
.upload-controls-compact {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
}

.upload-buttons {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 15px;
}

.upload-button-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.image-info-compact {
    font-size: 0.85rem;
    color: #a0a0c0;
    text-align: center;
}

.action-buttons-compact {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.current-image-info {
    background: rgba(76, 201, 240, 0.1);
    border-radius: 8px;
    padding: 10px 15px;
    font-size: 0.9rem;
    text-align: center;
    margin-bottom: 20px;
    border-left: 3px solid #4cc9f0;
}

.current-image-info p {
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

/* Make everything more compact */
.image-container h3 {
    font-size: 1rem;
    margin-bottom: 10px;
}

.placeholder p {
    font-size: 0.9rem;
}

.btn {
    padding: 8px 16px;
    font-size: 0.9rem;
}

/* Whole page scrolls, not internal container */
.container {
    max-width: 1400px;
    padding: 20px;
    min-height: 100vh;
}

main {
    /* No max-height or overflow - whole page scrolls */
}