/* Base styles */
body {
    font-family: Poppins, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #1a1a1a;
    color: #e0e0e0;
    overflow: hidden;
}

/* Header */
.app-header {
    height: 50px;
    background-color: #141414;
    border-bottom: 1px solid #2a2a2a;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 15px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

.logo {
    font-family: Poppins, sans-serif;
    font-size: 1.5em;
    font-weight: 800;
    color: #e0e0e0;
    letter-spacing: -0.5px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.fa-solid, .fas {
    font-family: "Font Awesome 6 Free";
    font-size: 1.5em;
    font-weight: 900;
}

.header-btn {
    background: none;
    border: none;
    color: #808080;
    width: 30px;
    height: 30px;
    display: none; /* Hide by default on desktop */
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: color 0.2s ease;
    z-index: 10;
}

.header-btn:hover {
    color: #e0e0e0;
}

/* Main layout */
.app-container {
    display: flex;
    height: calc(100vh - 130px); /* Reduced to account for header (50px) and footer (120px) */
    margin-top: 50px;
    overflow: hidden;
    background-color: #1a1a1a;
}

h1 {
    display: block;
    font-size: 1.5em;
    margin-block-start: 0.67em;
    margin-block-end: 2em;
    margin-inline-start: 0px;
    margin-inline-end: 0px;
    font-weight: 600;
    unicode-bidi: isolate;
}

h2 {
    display: block;
    font-size: 1em;
    margin-block-start: 0.83em;
    margin-inline-start: 0px;
    margin-inline-end: 0px;
    font-weight: bold;
    unicode-bidi: isolate;
}

/* Side panels */
.panel {
    flex: 0 0 300px;
    width: 300px;
    min-width: 300px;
    max-width: 300px;
    background-color: #1a1a1a;
    overflow-y: auto;
    padding: 0px 10px 10px 10px;
    box-sizing: border-box;
    transition: transform 0.3s ease;
}

.exif-panel {
    border-right: 1px solid #2a2a2a;
}

.edit-panel {
    border-left: 1px solid #2a2a2a;
}

/* Responsive styles */
@media (max-width: 768px) {
    .header-btn {
        display: flex; /* Show on mobile */
    }

    .panel {
        position: fixed;
        top: 60px;
        bottom: 0;
        z-index: 90;
    }

    .exif-panel {
        left: 0;
        transform: translateX(-100%);
    }

    .edit-panel {
        right: 0;
        transform: translateX(100%);
    }

    .panel.active {
        transform: translateX(0);
    }

    .main-content {
        margin: 0;
        justify-content: flex-start; /* Align content to the top */
    }

    .examples-footer {
        height: 80px;
    }

    .app-container {
        height: calc(100vh - 150px); /* Adjusted for smaller footer on mobile */
    }

    .example-item {
        height: 60px; /* Smaller on mobile */
        width: 90px;
    }

    .upload-section {
        flex-direction: column;
        gap: 10px;
    }
    
    /* Fix for the gap between image comparison and upload section on mobile */
    .before-after-container {
        flex: 0 1 auto; /* Don't let it grow, but allow it to shrink */
        margin-bottom: 10px; /* Reduce bottom margin on mobile */
        min-height: 200px; /* Set a minimum height to ensure visibility */
        max-height: 30vh; /* Limit maximum height on mobile */
    }
    
    /* Ensure the main content scrolls properly on mobile */
    .main-content {
        overflow-y: auto;
        display: flex;
        flex-direction: column;
    }
}

/* Desktop styles */
@media (min-width: 769px) {
    .panel {
        display: block;
        position: static;
        transform: none !important; /* Ensure panels are always visible on desktop */
    }
    
    .exif-panel, .edit-panel {
        transform: none !important;
    }
}

/* Main content area */
.main-content {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow-y: auto;
    box-sizing: border-box;
    height: 100%;
}

/* Upload section */
.upload-section {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    display: flex;
    gap: 20px;
    align-items: center;
    flex-shrink: 0; /* Prevent upload section from shrinking */
}

.upload-container {
    flex: 1;
    border: 2px dashed #2a2a2a;
    padding: 10px;
    text-align: center;
    font-size: 12px;
    background-color: #1a1a1a;
    border-radius: 4px;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
    min-width: 0; /* Allows flex shrinking */
}

.upload-container:hover {
    border-color: #3a3a3a;
}

.supported-formats {
    font-size: 11px;
    color: #808080;
    margin-top: 8px;
}

/* Image container */
.image-container {
    width: 100%;
    max-width: 100%;
    height: 60vh;
    margin: 0 auto 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #1a1a1a;
    overflow: hidden;
}

#preview {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Sections styling */
.section {
    margin-bottom: 12px;
    background-color: #1a1a1a;
    overflow: hidden;
}

.section-header {
    padding: 0px 8px 0px;
    color: #dfdfdf;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.5px;
    -webkit-user-select: none;
    user-select: none;
}

.section-content {
    padding: 0 10px 40px 10px;
}

/* Profile section */
.profile-content {
    color: #e0e0e0;
    font-size: 11px;
}

/* Common slider styling */
.slider-container {
    margin-bottom: 6px;
    width: 100%;
    box-sizing: border-box;
}

.slider-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2px;
    font-size: 11px;
    line-height: 14px;
}

.slider-header span:first-child {
    color: #808080;
}

.slider-header span:last-child {
    color: #e0e0e0;
}

.gradient-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 2px;
    border-radius: 1px;
    outline: none;
    background: #2a2a2a;
    margin: 8px 0;
}

.gradient-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 10px;
    height: 10px;
    border-radius: 5px;
    background: #e0e0e0;
    cursor: pointer;
    border: none;
    transition: background-color 0.2s;
}

.gradient-slider::-webkit-slider-thumb:hover {
    background: #ffffff;
}

/* Specific slider gradients */
.temperature {
    background: linear-gradient(to right, #4B79FF, #FFFFFF, #FF7C4B);
}

.tint {
    background: linear-gradient(to right, #4BFF5E, #FFFFFF, #FF4B7C);
}

/* Tone sliders */
.exposure {
    background: linear-gradient(to right, #000000, #ffffff);
}

.contrast, .texture, .clarity {
    background: linear-gradient(to right, #2a2a2a, #e0e0e0);
}

.highlights, .whites {
    background: linear-gradient(to right, #4a4a4a, #ffffff);
}

.shadows, .blacks {
    background: linear-gradient(to right, #000000, #4a4a4a);
}

/* Curves */
.curve-canvas {
    width: 100%;
    height: 250px;
    background-color: #141414;
    border: 1px solid #4e4e4e;
    border-radius: 2px;
    margin-bottom: 4px;
}

.curves-container {
    width: 100%;
}

.curve-controls {
    display: flex;
    gap: 8px;
    margin-top: 4px;
    padding: 4px;
    background: #141414;
    border-radius: 2px;
}

.curve-toggle {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.curve-toggle input[type="checkbox"] {
    margin-right: 4px;
    cursor: pointer;
}

.curve-label {
    font-size: 10px;
    font-weight: 500;
    padding: 2px 4px;
    border-radius: 2px;
}

.curve-label.rgb { color: #ffffff; }
.curve-label.red { color: #ff4444; }
.curve-label.green { color: #44ff44; }
.curve-label.blue { color: #4444ff; }

/* HSL / Color section */
.color-adjustments {
    margin-bottom: 12px;
}

.color-group {
    margin-bottom: 4px;
}

.color-group h4 {
    margin: 0 0 4px 0;
    font-size: 11px;
    color: #808080;
    font-weight: normal;
}

/* HSL specific gradients */
#red-hue-slider { background: linear-gradient(to right, #ff8000, #ff0000); }
#orange-hue-slider { background: linear-gradient(to right, #ffff00, #ff8000); }
#yellow-hue-slider { background: linear-gradient(to right, #00ff00, #ffff00); }
#green-hue-slider { background: linear-gradient(to right, #00ffff, #00ff00); }
#aqua-hue-slider { background: linear-gradient(to right, #0000ff, #00ffff); }
#blue-hue-slider { background: linear-gradient(to right, #8000ff, #0000ff); }
#purple-hue-slider { background: linear-gradient(to right, #ff00ff, #8000ff); }
#magenta-hue-slider { background: linear-gradient(to right, #ff0000, #ff00ff); }

#red-saturation-slider { background: linear-gradient(to right, #ffffff, #ff0000); }
#orange-saturation-slider { background: linear-gradient(to right, #ffffff, #ff8000); }
#yellow-saturation-slider { background: linear-gradient(to right, #ffffff, #ffff00); }
#green-saturation-slider { background: linear-gradient(to right, #ffffff, #00ff00); }
#aqua-saturation-slider { background: linear-gradient(to right, #ffffff, #00ffff); }
#blue-saturation-slider { background: linear-gradient(to right, #ffffff, #0000ff); }
#purple-saturation-slider { background: linear-gradient(to right, #ffffff, #8000ff); }
#magenta-saturation-slider { background: linear-gradient(to right, #ffffff, #ff00ff); }

#red-luminance-slider { background: linear-gradient(to right, #000000, #ff0000); }
#orange-luminance-slider { background: linear-gradient(to right, #000000, #ff8000); }
#yellow-luminance-slider { background: linear-gradient(to right, #000000, #ffff00); }
#green-luminance-slider { background: linear-gradient(to right, #000000, #00ff00); }
#aqua-luminance-slider { background: linear-gradient(to right, #000000, #00ffff); }
#blue-luminance-slider { background: linear-gradient(to right, #000000, #0000ff); }
#purple-luminance-slider { background: linear-gradient(to right, #000000, #8000ff); }
#magenta-luminance-slider { background: linear-gradient(to right, #000000, #ff00ff); }

/* Detail section */
.detail-group {
    margin-bottom: 12px;
}

.detail-group h4 {
    margin: 4px 0;
    font-size: 11px;
    color: #808080;
    font-weight: normal;
}

/* Calibration section */
.calibration-group {
    margin: 12px 0;
}

.calibration-group .slider-container {
    margin-bottom: 4px;
}

/* Red primary gradients */
.calibration-red-hue {
    background: linear-gradient(to right, #ff0000, #ff8000);
}

.calibration-red-saturation {
    background: linear-gradient(to right, #2a2a2a, #ff0000);
}

/* Green primary gradients */
.calibration-green-hue {
    background: linear-gradient(to right, #00ff00, #00ff80);
}

.calibration-green-saturation {
    background: linear-gradient(to right, #2a2a2a, #00ff00);
}

/* Blue primary gradients */
.calibration-blue-hue {
    background: linear-gradient(to right, #0000ff, #8000ff);
}

.calibration-blue-saturation {
    background: linear-gradient(to right, #2a2a2a, #0000ff);
}

/* Camera info section */
.info-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 11px;
    border-bottom: 1px solid #2a2a2a;
}

.info-label {
    color: #808080;
}

#camera-info {
    margin-bottom: 12px;
}

/* EXIF table */
.metadata-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}

.metadata-table td {
    padding: 4px 0;
    border-bottom: 1px solid #2a2a2a;
    color: #e0e0e0;
}

.metadata-table td:first-child {
    color: #808080;
    padding-right: 8px;
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #1a1a1a;
}

::-webkit-scrollbar-thumb {
    background: #3a3a3a;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #4a4a4a;
}

/* Download section */
.download-section {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
    min-width: -webkit-fill-available;
    min-width: fit-content;
}

.download-btn {
    padding: 10px 20px;
    background-color: #2a2a2a;
    border: 1px solid #404040;
    color: #e0e0e0;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.download-btn:hover {
    background-color: #404040;
    border-color: #606060;
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: #1a1a1a;
    padding: 30px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid #404040;
    max-width: 500px;
    width: 90%;
    position: relative;
}

.loader {
    border: 3px solid #2a2a2a;
    border-top: 3px solid #e0e0e0;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#loadingText {
    margin: 0;
    color: #e0e0e0;
    font-size: 14px;
}

.sponsor-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #404040;
}

.sponsor-message {
    color: #e0e0e0;
    font-size: 16px;
    margin-bottom: 20px;
    line-height: 1.4;
}

.sponsor-placeholder {
    background-color: #2a2a2a;
    border-radius: 4px;
    overflow: hidden;
}

.sponsor-image {
    width: 100%;
    height: auto;
    display: block;
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    color: #808080;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    line-height: 1;
    transition: color 0.2s ease;
}

.modal-close:hover {
    color: #e0e0e0;
}

/* No XMP Data Modal */
.no-xmp-message {
    text-align: center;
    padding: 10px 0;
}

.no-xmp-message h3 {
    color: #e0e0e0;
    margin-bottom: 15px;
    font-size: 20px;
}

.no-xmp-message p {
    color: #b0b0b0;
    margin-bottom: 15px;
    line-height: 1.5;
}

.modal-actions {
    margin-top: 25px;
}

.upload-another-btn {
    display: inline-block;
    background-color: #2a2a2a;
    color: #e0e0e0;
    padding: 12px 20px;
    border-radius: 4px;
    border: 1px solid #404040;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.upload-another-btn:hover {
    background-color: #404040;
    border-color: #606060;
}

/* Examples section */
.examples-container {
    display: flex;
    gap: 10px;
    height: 100%;
}

.example-item {
    flex: 0 0 auto;
    height: 80px; /* Fixed height */
    width: 120px; /* Fixed width based on 3:2 aspect ratio */
    border-radius: 4px;
    overflow: hidden;
    transition: transform 0.2s ease;
    cursor: pointer;
}

.example-item:hover {
    transform: translateY(-2px);
}

.example-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.example-info {
    flex: 1;
}

.example-title {
    font-size: 12px;
    color: #e0e0e0;
    margin-bottom: 2px;
}

.example-author {
    font-size: 11px;
    color: #808080;
}

/* Before After Container */
.before-after-container {
    position: relative;
    width: 90%;
    max-width: 100%;
    flex: 1;
    margin: 0 auto 20px;
    background-color: #1a1a1a;
    overflow: hidden;
    min-height: 0; /* Allow container to shrink */
}

.img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    background-color: #1a1a1a;
}

.background-img {
    z-index: 1;
}

.foreground-img {
    z-index: 2;
}

.slider {
    position: absolute;
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 100%;
    background: transparent;
    outline: none;
    margin: 0;
    padding: 0;
    cursor: col-resize;
    z-index: 4;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 2px;
    height: 100%;
    background: white;
    cursor: col-resize;
}

.slider::-moz-range-thumb {
    width: 2px;
    height: 100%;
    background: white;
    cursor: col-resize;
    border: none;
}

/* Shadows tint gradient */
.tint {
    background: linear-gradient(to right, #00ff00, #ff00ff);
}

/* Slider styles */
input[type="range"]:disabled {
    opacity: 1;
    cursor: default;
    pointer-events: none;
}

input[type="range"]:disabled::-webkit-slider-thumb {
    cursor: default;
}

input[type="range"]:disabled::-moz-range-thumb {
    cursor: default;
}

input[type="range"]:disabled::-ms-thumb {
    cursor: default;
}

/* Color Grading Styles */
.color-grading {
  width: 250px;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  border-radius: 4px;
}

.color-grading .header {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
  color: #fff;
}

.color-grading .header-text {
  color: #fff;
  margin-right: auto;
  font-size: 14px;
}

.color-grading .tools {
  display: flex;
  gap: 8px;
}

.color-grading .tool {
  width: 20px;
  height: 20px;
  border: 2px solid #555;
  border-radius: 50%;
  cursor: pointer;
}

.color-grading .tool.active {
  border-color: #fff;
}

.color-grading .tool:first-child {
  position: relative;
}

.color-grading .tool:first-child:before,
.color-grading .tool:first-child:after {
  content: '';
  position: absolute;
  background: #fff;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.color-grading .tool:first-child:before {
  top: 2px;
  left: 2px;
}

.color-grading .tool:first-child:after {
  bottom: 2px;
  right: 2px;
}

.color-grading .color-section {
  margin-bottom: 15px;
}

.color-grading .label {
  color: #999;
  font-size: 12px;
  margin-bottom: 8px;
}

.color-grading .color-wheels {
  display: flex;
  justify-content: space-between;
  margin-bottom: 15px;
  margin-top: 10px;
}

.color-grading .wheel-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  width: 80px;
}

.color-grading .wheel-wrapper {
  position: relative;
  width: 60px;
  display: flex;
  align-items: center;
}

.color-grading .color-wheel {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: conic-gradient(
    red, yellow, lime, cyan, blue, magenta, red
  );
  position: relative;
}

.color-grading .color-wheel:after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 2px solid white;
  background: transparent;
}

.color-grading .position-dot {
  width: 8px;
  height: 8px;
  background: #fff;
  border-radius: 50%;
  position: absolute;
  right: -10px;
  top: 50%;
  transform: translateY(-50%);
}

.color-grading .wheel-slider {
  width: 100%;
  height: 2px;
  background: #2a2a2a;
  position: relative;
  margin-top: 8px;
}

.color-grading .wheel-slider .handle {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #e0e0e0;
  border-radius: 5px;
  top: 50%;
  transform: translate(-50%, -50%);
  cursor: pointer;
  transition: background-color 0.2s;
}

.color-grading .wheel-slider .handle:hover {
  background: #ffffff;
}

.color-grading .slider-section {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}

.color-grading .slider-section .label {
  width: 70px;
  margin-bottom: 0;
  color: #808080;
  font-size: 11px;
}

.color-grading .slider-container {
  flex-grow: 1;
  margin-right: 10px;
}

.color-grading .slider {
  width: 100%;
  height: 2px;
  background: #2a2a2a;
  position: relative;
  margin: 10px 0;
}

.color-grading .slider .handle {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #e0e0e0;
  border-radius: 5px;
  top: 50%;
  transform: translate(-50%, -50%);
  cursor: pointer;
  transition: background-color 0.2s;
}

.color-grading .slider .handle:hover {
  background: #ffffff;
}

.color-grading .number-input {
  color: #e0e0e0;
  background: none;
  border: none;
  font-size: 11px;
  width: 30px;
  text-align: right;
}

/* Disabled state styles */
.color-grading.disabled .color-wheel,
.color-grading.disabled .wheel-slider .handle,
.color-grading.disabled .slider .handle,
.color-grading.disabled .number-input {
  pointer-events: none;
  opacity: 0.5;
}

/* Examples Footer */
.examples-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #141414;
    border-top: 1px solid #2a2a2a;
    height: 80px; /* Reduced height */
    z-index: 1000;
}

.examples-scroller {
    width: 100%;
    height: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 10px;
    box-sizing: border-box;
}

.examples-container {
    display: flex;
    gap: 10px;
    height: 100%;
}

.example-item {
    flex: 0 0 auto;
    height: 60px; /* Fixed height */
    width: 100px; /* Fixed width based on 3:2 aspect ratio */
    border-radius: 4px;
    overflow: hidden;
    transition: transform 0.2s ease;
    cursor: pointer;
}

.example-item:hover {
    transform: translateY(-2px);
}

.example-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Scrollbar styling for the examples footer */
.examples-scroller::-webkit-scrollbar {
    height: 8px;
}

.examples-scroller::-webkit-scrollbar-track {
    background: #1a1a1a;
    border-radius: 4px;
}

.examples-scroller::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 4px;
}

.examples-scroller::-webkit-scrollbar-thumb:hover {
    background: #444;
}

/* Presets Modal Styles */
.presets-content {
    max-width: 450px;
    text-align: center;
}

.presets-image-container {
    margin: 0 auto 20px;
    max-width: 400px;
}

.presets-image {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.promo-text {
    text-align: center;
    margin-bottom: 20px;
    color: #ffffff;
}

.promo-text h3 {
    font-size: 24px;
    margin-bottom: 15px;
    color: #ffcc00;
}

.promo-text p {
    font-size: 16px;
    margin-bottom: 10px;
}

.promo-text a {
    color: #4da6ff;
    text-decoration: none;
}

.promo-text a:hover {
    text-decoration: underline;
}

.close-presets-btn {
    background-color: #434443;
    color: white;
    border: none;
    padding: 10px 25px;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s;
    margin: 0 auto;
    display: block;
}

.close-presets-btn:hover {
    background-color: #45a049;
}

