/* Custom styling for the Advanced Image Resizer & Cropper Workspace */

:root {
  --checkerboard-color-1: rgba(255, 255, 255, 0.03);
  --checkerboard-color-2: rgba(255, 255, 255, 0.07);
}

/* WORKSPACE VIEWPORT LAYOUT */
.tool-layout {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 24px;
  align-items: start;
}

@media (max-width: 950px) {
  .tool-layout {
    grid-template-columns: 1fr;
  }
}

.panel {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 24px;
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: var(--shadow);
  transition: border-color 0.3s;
}

.panel:focus-within {
  border-color: var(--border-h);
}

/* DROPZONE */
.dropzone {
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 50px 30px;
  text-align: center;
  background: rgba(255, 255, 255, 0.01);
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--p);
  background: rgba(139, 92, 246, 0.04);
  box-shadow: var(--glow);
}

.dropzone-icon {
  font-size: 3.2rem;
  background: var(--grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 16px;
}

.dropzone h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--t);
}

.dropzone p {
  color: var(--t3);
  font-size: 0.88rem;
  margin-bottom: 16px;
}

.file-input {
  display: none;
}

/* IMAGE WORKSPACE VIEWPORT */
.viewport-card {
  width: 100%;
  min-height: 380px;
  max-height: 520px;
  border-radius: 10px;
  border: 1px solid var(--border);
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #0c0c20;
}

/* Checkerboard background for image viewport */
.checkerboard {
  background-image: 
    linear-gradient(45deg, var(--checkerboard-color-1) 25%, transparent 25%), 
    linear-gradient(-45deg, var(--checkerboard-color-1) 25%, transparent 25%), 
    linear-gradient(45deg, transparent 75%, var(--checkerboard-color-2) 75%), 
    linear-gradient(-45deg, transparent 75%, var(--checkerboard-color-2) 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

/* Crop wrapper sizing */
.crop-container {
  width: 100%;
  height: 100%;
  max-height: 520px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.crop-container img {
  max-width: 100%;
  max-height: 520px;
  display: block;
}

/* CROPPING TOOLBAR */
.transform-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 16px;
  margin-top: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.toolbar-group {
  display: flex;
  gap: 8px;
}

/* CROPPER JS ACCENT STYLING OVERRIDES */
.cropper-view-box {
  outline: 2px solid var(--p2);
  outline-color: var(--p2);
}

.cropper-line {
  background-color: var(--p2);
}

.cropper-point {
  background-color: var(--p);
  border: 1px solid #fff;
  border-radius: 50%;
  width: 10px !important;
  height: 10px !important;
}

.cropper-point.point-se {
  width: 14px !important;
  height: 14px !important;
  background-color: var(--p2);
}

.cropper-modal {
  background-color: var(--bg);
  opacity: 0.75;
}

/* RIGHT SETTINGS PANEL DETAILS */
.dimension-inputs {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
}

.input-number-wrap {
  position: relative;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
}

.input-number-wrap input {
  background: transparent;
  border: none;
  color: var(--t);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  width: 100%;
  outline: none;
}

.input-unit {
  font-size: 0.76rem;
  color: var(--t3);
  margin-left: 6px;
  font-weight: 600;
}

.chain-link-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--t2);
  transition: all 0.2s;
}

.chain-link-btn.active {
  background: rgba(139, 92, 246, 0.12);
  color: var(--p2);
  border-color: var(--p2);
}

.chain-link-btn:hover {
  transform: scale(1.05);
}

/* QUICK SCALE GRID */
.scale-buttons-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-top: 8px;
}

.scale-btn {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--t2);
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
}

.scale-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--t);
}

/* PRESETS SELECT DROPDOWN */
.custom-select {
  width: 100%;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  color: var(--t);
  font-family: inherit;
  outline: none;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: border-color 0.2s;
}

.custom-select:focus {
  border-color: var(--border-h);
}

.custom-select option {
  background-color: var(--bg);
  color: var(--t);
}

/* LIVE PREVIEW CONTAINER */
.live-preview-box {
  width: 100%;
  height: 130px;
  border-radius: 8px;
  border: 1px dashed var(--border);
  background: rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.live-preview-box img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.live-preview-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  font-size: 0.65rem;
  font-weight: 700;
  background: rgba(6, 182, 212, 0.15);
  color: var(--p2);
  border: 1px solid rgba(6, 182, 212, 0.25);
  padding: 2px 6px;
  border-radius: 4px;
}

/* STATS ROW */
.stats-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(255,255,255,0.01);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--t2);
}

.stat-item strong {
  color: var(--t);
}

/* BG FILL PICKER */
.bg-picker-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.color-input-container {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  flex-grow: 1;
}

.color-input-container input[type="color"] {
  border: none;
  background: none;
  width: 28px;
  height: 28px;
  cursor: pointer;
  outline: none;
  padding: 0;
}

.color-input-container input[type="text"] {
  background: transparent;
  border: none;
  color: var(--t);
  font-family: inherit;
  font-size: 0.85rem;
  width: 100%;
  outline: none;
  text-transform: uppercase;
}

/* KEYBOARD HUD CHEATSHEET */
.keyboard-hud {
  font-size: 0.74rem;
  color: var(--t3);
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 16px;
  border-top: 1px dashed var(--border);
  padding-top: 12px;
}

.kbd-shortcut {
  display: flex;
  justify-content: space-between;
}

.kbd-key {
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0px 5px;
  font-family: monospace;
  color: var(--t);
  font-size: 0.7rem;
}

/* PROCESSING OVERLAY spinner */
.processing-overlay {
  position: absolute;
  inset: 0;
  background: rgba(7, 7, 26, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  border-radius: var(--r);
  gap: 16px;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 3.5px solid rgba(139, 92, 246, 0.15);
  border-top-color: var(--p);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.processing-text {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--t);
}

.progress-bar-wrap {
  width: 160px;
  height: 6px;
  background: rgba(255,255,255,0.1);
  border-radius: 10px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--grad);
  transition: width 0.1s ease;
}

/* PREVENT DRAG AND DROP OVERLAY */
.drag-overlay {
  pointer-events: none;
}

/* OPERATION MODE TABS */
.mode-tabs {
  display: flex;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px;
}

.mode-tab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--t2);
  padding: 8px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
}

.mode-tab:hover {
  color: var(--t);
}

.mode-tab.active {
  background: var(--p);
  color: #fff;
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
}

/* CUSTOM INPUT SPINNERS */
.custom-spin-buttons {
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin-left: 6px;
  margin-right: 2px;
  border-left: 1px solid var(--border);
  padding-left: 6px;
}

.spin-btn {
  background: transparent;
  border: none;
  color: var(--t3);
  cursor: pointer;
  font-size: 0.65rem;
  padding: 1px 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, transform 0.1s;
}

.spin-btn:hover {
  color: var(--p2);
}

.spin-btn:active {
  transform: scale(0.85);
}

/* Hide default browser spinners */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield; /* Firefox */
}

/* HIDE CROP BOX FOR RESIZE ONLY MODE */
.cropper-hidden-box .cropper-crop-box {
  pointer-events: none !important;
}
.cropper-hidden-box .cropper-view-box {
  outline: none !important;
}
.cropper-hidden-box .cropper-line,
.cropper-hidden-box .cropper-point,
.cropper-hidden-box .cropper-dashed,
.cropper-hidden-box .cropper-center {
  display: none !important;
}
