/* ==========================================================================
   Photo Rotator — Premium Upscaled & Fully Responsive Stylesheet
   Theme: Royal Blue (#1a3566), Amber Gold (#d97706), Slate, Glassmorphism
   Supported Breakpoints: 320px, 375px, 430px, 768px, 1024px, 1280px+
   ========================================================================== */

/* --- Tool Header & Badges --- */
.tool-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(26, 53, 102, 0.12);
  box-shadow: 0 4px 16px rgba(26, 53, 102, 0.05);
  font-size: 13px;
  font-weight: 600;
  color: var(--royal-dark, #122549);
  margin-bottom: 18px;
  max-width: 100%;
  text-align: center;
}

.tool-badge i {
  font-size: 15px;
  color: #059669;
  flex-shrink: 0;
}

/* --- Dropzone Base & Responsive Ergonomics --- */
.dropzone {
  position: relative;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 2px dashed rgba(26, 53, 102, 0.22);
  border-radius: 24px;
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  box-sizing: border-box;
}

.dropzone:hover {
  background: rgba(255, 255, 255, 0.95);
  border-color: var(--royal, #1a3566);
  transform: translateY(-2px);
  box-shadow: 0 16px 36px rgba(26, 53, 102, 0.08);
}

.dropzone.dragover,
.dropzone.drag-active {
  background: rgba(238, 246, 255, 0.95);
  border-color: #2563eb;
  border-style: solid;
  transform: scale(1.01);
  box-shadow: 0 0 0 5px rgba(37, 99, 235, 0.15), 0 20px 40px rgba(37, 99, 235, 0.12);
}

.file-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 10;
}

.dz-content {
  position: relative;
  z-index: 5;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.dz-icon-wrapper {
  width: 76px;
  height: 76px;
  border-radius: 22px;
  background: linear-gradient(135deg, #1a3566 0%, #2563eb 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  box-shadow: 0 12px 24px rgba(26, 53, 102, 0.22);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
}

.dropzone:hover .dz-icon-wrapper {
  transform: translateY(-4px) scale(1.06);
  box-shadow: 0 18px 36px rgba(37, 99, 235, 0.35);
}

.dz-icon-wrapper svg {
  width: 38px;
  height: 38px;
}

.dropzone h3 {
  font-size: 22px;
  font-weight: 800;
  color: var(--royal-dark, #122549);
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}

.dropzone p {
  font-size: 15px;
  color: var(--slate-600, #475569);
  margin-bottom: 18px;
  line-height: 1.5;
  max-width: 480px;
}

.dz-chips {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
  max-width: 100%;
}

.dz-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: rgba(26, 53, 102, 0.06);
  border: 1px solid rgba(26, 53, 102, 0.1);
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--royal, #1a3566);
  white-space: nowrap;
}

.dz-chip i {
  font-size: 12px;
  flex-shrink: 0;
}

.dz-btn {
  pointer-events: auto;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 28px;
  font-size: 15px;
  font-weight: 700;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(26, 53, 102, 0.22);
}

/* --- Processing Panel & File Bar --- */
.process-panel {
  animation: slideFadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideFadeIn {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.file-info {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 18px;
  border: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.03);
  margin-bottom: 20px;
}

.file-icon-box {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #10b981, #059669);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(16, 185, 129, 0.25);
  flex-shrink: 0;
}

.file-icon-box i {
  font-size: 22px;
}

.file-details {
  flex: 1;
  min-width: 0;
}

.file-details h4 {
  font-size: 15px;
  font-weight: 700;
  color: var(--slate-800, #1e293b);
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.file-details p {
  font-size: 13px;
  color: #059669;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.btn-icon {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.btn-icon:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #ef4444;
}

/* Error Alert */
#errorAlert {
  background: #fef2f2;
  border: 1.5px solid #fecaca;
  color: #b91c1c;
  padding: 12px 18px;
  border-radius: 14px;
  margin-bottom: 20px;
  font-size: 13.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

#errorAlert.hidden {
  display: none !important;
}

#closeErrorBtn:hover {
  opacity: 0.7;
}

/* --- Rotator 2-Column Layout --- */
.rotator-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 24px;
  align-items: start;
  margin-bottom: 20px;
}

/* Controls Column */
.rotator-controls {
  display: flex;
  flex-direction: column;
  gap: 18px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.03);
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.control-group label {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--royal-dark, #122549);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.angle-badge {
  background: linear-gradient(135deg, #d97706, #b45309);
  color: #ffffff;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
}

.btn-group {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.btn-group.two-col {
  grid-template-columns: repeat(2, 1fr);
}

.btn-icon-text {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 700;
  font-size: 13px;
  padding: 10px 8px;
  border-radius: 10px;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  color: var(--slate-700, #334155);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.btn-icon-text:hover {
  border-color: #2563eb;
  color: #2563eb;
  background: #eff6ff;
  transform: translateY(-1px);
}

.btn-icon-text:active {
  transform: translateY(1px);
}

.btn-icon-text:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

/* Quick step matched highlight */
.btn-icon-text.angle-matched {
  background: linear-gradient(135deg, #1a3566 0%, #2563eb 100%);
  color: #ffffff;
  border-color: #1a3566;
  box-shadow: 0 4px 12px rgba(26, 53, 102, 0.25);
}

.btn-icon-text.angle-matched:hover {
  background: linear-gradient(135deg, #122549 0%, #1d4ed8 100%);
  color: #ffffff;
  border-color: #122549;
  box-shadow: 0 6px 16px rgba(26, 53, 102, 0.35);
}

/* Flip buttons active toggle state (Rich Emerald Theme) */
.btn-icon-text.active {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
  color: #ffffff !important;
  border-color: #059669 !important;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35) !important;
}

.btn-icon-text.active:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%) !important;
  color: #ffffff !important;
  border-color: #047857 !important;
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.45) !important;
  transform: translateY(-1px);
}

.btn-icon-text.active:focus-visible {
  outline: 2px solid #059669;
  outline-offset: 2px;
}

/* Custom Angle Slider */
.angle-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  background: #e2e8f0;
  border-radius: 9999px;
  outline: none;
  transition: background 0.2s ease;
  cursor: pointer;
}

.angle-slider:focus-visible {
  outline: 2px solid #d97706;
  outline-offset: 3px;
}

.angle-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  cursor: pointer;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.5);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.angle-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.6);
}

.angle-slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  cursor: pointer;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.5);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.angle-slider::-moz-range-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.6);
}

.angle-slider-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
}

.angle-preset-btn {
  background: none;
  border: none;
  padding: 3px 8px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--slate-500, #64748b);
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s ease;
  font-family: inherit;
}

.angle-preset-btn:hover {
  color: #d97706;
  background: rgba(217, 119, 6, 0.12);
  transform: translateY(-1px);
}

.angle-preset-btn:focus-visible {
  outline: 2px solid #d97706;
  outline-offset: 1px;
}

.btn-reset-original {
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  color: var(--slate-600, #475569);
  font-weight: 700;
  font-size: 13.5px;
  padding: 10px 16px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
}

.btn-reset-original:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #ef4444;
}

.btn-reset-original:focus-visible,
.btn-icon:focus-visible,
.action-buttons .btn:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

/* Preview Column */
.rotator-preview-container {
  background: rgba(248, 250, 252, 0.95);
  border: 2px dashed rgba(203, 213, 225, 0.9);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 420px;
  padding: 24px;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}

.rotator-canvas-wrapper {
  max-width: 100%;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rotator-canvas-wrapper canvas {
  max-width: 100%;
  max-height: 480px;
  box-shadow: 0 14px 35px rgba(15, 23, 42, 0.12);
  border-radius: 8px;
  object-fit: contain;
  background: repeating-conic-gradient(#e2e8f0 0% 25%, #ffffff 0% 50%) 50% / 16px 16px;
  transition: transform 0.2s ease-in-out;
}

/* --- Floating Sticky Action Footer --- */
.action-footer {
  margin-top: 24px;
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 18px;
  border: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  bottom: 20px;
  z-index: 100;
}

.selection-status {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--slate-700, #334155);
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.action-buttons .btn {
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 700;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* --- Section Headlines & Content Blocks --- */
.section-headline {
  font-size: 26px;
  font-weight: 900;
  color: var(--royal-dark, #122549);
  text-align: center;
  margin-bottom: 10px;
  letter-spacing: -0.02em;
}

.section-subtitle {
  font-size: 15px;
  color: var(--slate-600, #475569);
  text-align: center;
  max-width: 680px;
  margin: 0 auto 32px;
  line-height: 1.6;
}

/* --- Steps & Guidelines --- */
.steps-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.step-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.step-number {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1a3566, #2563eb);
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(26, 53, 102, 0.2);
}

.step-text h5 {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--slate-800, #1e293b);
  margin-bottom: 3px;
}

.step-text p {
  font-size: 13.5px;
  color: var(--slate-600, #475569);
  line-height: 1.5;
  margin: 0;
}

.guidelines-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.guideline-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 12px;
  border: 1px solid rgba(226, 232, 240, 0.8);
}

.guideline-icon {
  font-size: 18px;
  color: #d97706;
  flex-shrink: 0;
  margin-top: 1px;
}

.guideline-text {
  font-size: 13.5px;
  color: var(--slate-700, #334155);
  line-height: 1.5;
}

.guideline-text strong {
  color: var(--slate-900, #0f172a);
}

/* ==========================================================================
   Comprehensive Responsive Breakpoints (Mobile, Tablet, Desktop)
   ========================================================================== */

/* --- Tablet (max-width: 900px) --- */
@media (max-width: 900px) {
  .rotator-layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .rotator-preview-container {
    min-height: 320px;
    padding: 16px;
  }

  .action-footer {
    flex-direction: column;
    gap: 14px;
    align-items: stretch;
    text-align: center;
  }

  .action-buttons {
    flex-direction: column;
  }
}

/* --- Mobile Devices (max-width: 480px) --- */
@media (max-width: 480px) {
  .tool-badge {
    font-size: 11px;
    padding: 5px 12px;
    gap: 6px;
    margin-bottom: 12px;
  }

  .dropzone {
    padding: 24px 14px 20px;
    border-radius: 16px;
  }

  .dz-icon-wrapper {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    margin-bottom: 12px;
  }

  .dz-icon-wrapper svg {
    width: 28px;
    height: 28px;
  }

  .dropzone h3 {
    font-size: 17px;
    margin-bottom: 4px;
  }

  .dropzone p {
    font-size: 12.5px;
    margin-bottom: 12px;
  }

  .dz-chips {
    gap: 6px;
    margin-bottom: 14px;
  }

  .dz-chip {
    font-size: 10.5px;
    padding: 3px 8px;
    gap: 4px;
  }

  .dz-btn {
    width: 100%;
    max-width: 260px;
    font-size: 14px;
    padding: 11px 18px;
    border-radius: 12px;
  }

  .file-info {
    padding: 12px 14px;
    gap: 10px;
    border-radius: 14px;
    margin-bottom: 16px;
  }

  .file-icon-box {
    width: 40px;
    height: 40px;
    border-radius: 10px;
  }

  .file-details h4 {
    font-size: 13.5px;
  }

  .file-details p {
    font-size: 11.5px;
  }

  .btn-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }

  .rotator-controls {
    padding: 16px;
    border-radius: 16px;
    gap: 16px;
  }

  .btn-icon-text {
    padding: 8px 6px;
    font-size: 12px;
  }

  .rotator-preview-container {
    min-height: 260px;
    padding: 12px;
    border-radius: 16px;
  }

  .rotator-canvas-wrapper canvas {
    max-height: 320px;
  }

  .action-footer {
    padding: 12px 14px;
    border-radius: 14px;
    bottom: 12px;
  }

  .action-buttons .btn {
    font-size: 14px;
    padding: 12px 18px;
    border-radius: 12px;
    min-height: 44px;
  }
}

/* --- Accessibility & Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
  .dropzone,
  .btn-icon-text,
  .action-buttons .btn {
    transition: none !important;
    animation: none !important;
  }
}
