/* assets/css/styles.css - Cleaned and deduplicated */

/* ---------------------------
   Theme variables
   --------------------------- */
:root {
    --muted: #6b7280;
    --light: #f8fafc;
    --card: #ffffff;
    --accent: #0ea5a4;
    --panel-width: 380px;
    --glass-size: 100px;
    --glass-border: 8px;
    --preview-size: 64px;
    --muted-color: #6c757d;
    --light-color: #f8f9fa;
    --card-bg: #ffffff;
    --accent-color: #0d6efd;
}

/* ---------------------------
   Base
   --------------------------- */
* {
    box-sizing: border-box;
    font-family: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
}

body {
    background: var(--light);
    color: #0f172a;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Inter", sans-serif;
}

/* ---------------------------
   Layout & Cards
   --------------------------- */
.card {
    background: var(--card);
}

.card.image-card {
    height: 72vh;
    max-height: 900px;
    min-height: 380px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    border-radius: 8px;
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
}

@media (max-width: 991px) {
    .card.image-card {
        height: 50vh;
        min-height: 260px;
    }
}

/* ---------------------------
   Image & Drop Area
   --------------------------- */
#image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    cursor: crosshair;
    border-radius: 6px;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
}

#drop-area {
    border: 1px dashed var(--muted);
    border-radius: 10px;
    background: var(--card);
    min-height: 170px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease;
}

#drop-area.dragover {
    border-color: var(--accent);
    background: #ecfdf5;
}

/* ---------------------------
   Magnifier
   --------------------------- */
#magnifier-glass-container {
    position: absolute;
    width: 160px;
    height: 160px;
    border-radius: 14px;
    pointer-events: none;
    display: none;
    z-index: 3000;
    box-shadow: 0 18px 40px rgba(2, 6, 23, 0.20);
    overflow: hidden;
    background-clip: padding-box;
    outline: 6px solid rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(2px);
}

#magnifier-grid {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 10px;
    overflow: hidden;
    pointer-events: none;
    background-color: rgba(14, 165, 164, 0.04);
}

.magnifier-cell {
    position: absolute;
    box-sizing: border-box;
    background-repeat: no-repeat;
    background-size: cover;
    background-position: 0 0;
    border: 1px solid rgba(255, 255, 255, 0.14);
}

#magnifier-grid .center-box {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 32px;
    height: 32px;
    border: 3px solid rgba(220, 20, 20, 0.98);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.02);
    box-sizing: border-box;
    pointer-events: none;
    z-index: 4;
}

#magnifier-grid .inner-cross {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 18px;
    height: 18px;
    pointer-events: none;
    z-index: 5;
}

#magnifier-grid .inner-cross::before,
#magnifier-grid .inner-cross::after {
    content: "";
    position: absolute;
    background: rgba(30, 30, 30, 0.65);
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    border-radius: 1px;
}

#magnifier-grid .inner-cross::before {
    width: 2px;
    height: 100%;
}

#magnifier-grid .inner-cross::after {
    height: 2px;
    width: 100%;
}

#magnifier-grid .coord {
    position: absolute;
    left: 8px;
    bottom: 8px;
    background: rgba(0, 0, 0, 0.48);
    color: #fff;
    font-size: 11px;
    padding: 4px 6px;
    border-radius: 6px;
    pointer-events: none;
    z-index: 6;
}

/* ---------------------------
   Magnifier Preview
   --------------------------- */
#magnifier-preview {
    position: fixed;
    z-index: 4000;
    display: none;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 12px;
    width: 90px;
    height: 90px;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    transition: left 0.06s linear, top 0.06s linear;
}

#magnifier-preview.show,
#magnifier-preview.visible {
    display: flex !important;
    opacity: 1;
    visibility: visible;
}

#magnifier-preview.hidden,
#magnifier-preview.d-none {
    display: none !important;
    opacity: 0;
    visibility: hidden;
}

#magnifier-preview.floating {
    position: fixed;
    z-index: 4000;
    transform: none;
    transition: left .06s linear, top .06s linear;
    display: flex !important;
}

#magnifier-preview-swatch {
    width: 64px;
    height: 64px;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ---------------------------
   Eye Cursor
   --------------------------- */
#eyecursor {
    position: fixed;
    width: 20px;
    height: 20px;
    pointer-events: none;
    z-index: 3500;
    transform: translate(-50%, -50%);
    display: none;
}

#eyecursor::before,
#eyecursor::after {
    content: "";
    position: absolute;
    background: rgba(220, 20, 20, 0.98);
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    border-radius: 1px;
}

#eyecursor::before {
    width: 2px;
    height: 100%;
}

#eyecursor::after {
    height: 2px;
    width: 100%;
}

/* ---------------------------
   Colors & Palette
   --------------------------- */
.colors-wrapper {
    position: sticky;
    top: 100px;
    max-height: calc(72vh - 140px);
    overflow-y: auto;
    padding-right: 6px;
}

#colors {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    box-sizing: border-box;
}

.colors .color {
    width: 100%;
}

.colors-wrapper .d-flex.align-items-center.justify-content-between {
    gap: 12px;
}

.colors-wrapper p {
    margin: 0;
    font-size: 0.95rem;
}

.preview {
    width: var(--preview-size);
    height: var(--preview-size);
    border-radius: 6px;
    border: 1px solid #e6e6e6;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
    flex-shrink: 0;
    background-size: cover !important;
    background-position: center center !important;
    background-repeat: no-repeat !important;
}

.colors .preview {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    box-shadow: none;
}

.d-flex .preview {
    flex-shrink: 0;
}

/* ---------------------------
   Palette Swatches
   --------------------------- */
#palette {
    min-height: 48px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

.palette-swatch {
    width: 44px;
    height: 44px;
    border: none;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.06);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-size: cover !important;
    background-position: center center !important;
    background-repeat: no-repeat !important;
    transition: transform .08s ease, box-shadow .08s ease;
}

.palette-swatch:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(2, 6, 23, 0.10);
}

.palette-swatch:focus {
    outline: 2px solid rgba(14, 165, 164, 0.18);
    outline-offset: 2px;
}

.palette-swatch.selected {
    outline: 3px solid rgba(13, 110, 253, 0.9) !important;
    transform: translateY(-3px);
}

.palette-swatch.multi-selected {
    outline: 3px solid rgba(13, 110, 253, 0.45) !important;
    transform: translateY(-3px);
}

.palette-swatch .drag-handle {
    position: absolute;
    right: -6px;
    bottom: -6px;
    width: 18px;
    height: 18px;
    border-radius: 4px;
    font-size: 12px;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.06);
}

/* ---------------------------
   Palette Controls
   --------------------------- */
.palette-controls {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.palette-controls .btn {
    padding: 0.18rem 0.45rem;
    font-size: 0.78rem;
}

#palette-increase,
#palette-decrease {
    min-width: 36px;
    padding: 0 8px;
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

#palette-increase:hover,
#palette-decrease:hover {
    filter: brightness(0.98);
}

#palette-size {
    text-align: center;
    padding: 0.25rem 0.35rem;
}

#palette-card {
    border-radius: 8px;
}

#palette-card .btn {
    white-space: nowrap;
}

#palette-status {
    color: var(--muted);
    font-size: 0.9rem;
}

/* ---------------------------
   Output Result
   --------------------------- */
#output-result {
    border-radius: 14px !important;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
}

#output-swatch {
    width: 80px;
    height: 80px;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.10);
    background-size: cover;
}

#output-table {
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
}

.output-row {
    display: grid;
    grid-template-columns: 60px 1fr 40px;
    align-items: center;
    padding: 0.75rem 0.75rem;
    background: #ffffff;
    transition: background 0.2s ease, transform 0.15s ease;
    border-bottom: 1px solid #e5e7eb;
}

.output-row:last-child {
    border-bottom: none;
}

.output-row:hover {
    background: #f9fafb;
    transform: translateX(2px);
}

.output-label {
    font-weight: 600;
    color: #374151;
    font-size: 0.88rem;
}

.output-value {
    font-family: monospace;
    font-size: 0.95rem;
    color: #111827;
}

/* ---------------------------
   Saved Colors
   --------------------------- */
.saved-color-item {
    background: #ffffff;
    border-radius: 14px;
    padding: 16px 18px;
    margin-bottom: 12px;
    border: 1px solid #e5e7eb;
    transition: box-shadow 0.18s ease, transform 0.18s ease;
}

.saved-color-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    transform: translateY(-1px);
}

.saved-color-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.saved-color-swatch {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.saved-color-lines {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.saved-line {
    display: grid;
    grid-template-columns: 70px 1fr 40px;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid #e5e7eb;
}

.saved-line:last-child {
    border-bottom: none;
}

.saved-line-label {
    font-weight: 600;
    color: #374151;
    font-size: 0.88rem;
    padding-right: 12px;
    border-right: 1px solid #e5e7eb;
}

.saved-line-value {
    font-family: monospace;
    padding: 0 12px;
    border-right: 1px solid #e5e7eb;
    color: #111827;
    font-size: 0.92rem;
}

.remove-color-btn {
    font-size: 0.80rem;
    border-radius: 8px;
}

/* ---------------------------
   Copy Buttons & Icons
   --------------------------- */
.copy-icon-btn,
.copy-icon,
.copy-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    background: #f9fafb;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.copy-icon-btn:hover,
.copy-icon:hover {
    background: #eef2ff;
    border-color: #6366f1;
}

.copy-icon-btn svg,
.copy-icon svg {
    width: 18px;
    height: 18px;
    color: #6b7280;
}

.copy-icon-btn.copied,
.copy-icon.copied {
    background: #d1fae5 !important;
    border-color: #10b981 !important;
}

.copy-icon-btn.copied svg,
.copy-icon.copied svg {
    color: #059669 !important;
}

.colors .btn-sm {
    padding: .18rem .5rem;
}

/* ---------------------------
   Toast Notification
   --------------------------- */
.copy-toast-container {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 5000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.copy-toast {
    background: #111827;
    color: #fff;
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 0.9rem;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    opacity: 0;
    transform: translateY(10px);
    transition: all .25s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.copy-toast.show {
    opacity: 1;
    transform: translateY(0px);
}

.copy-toast svg {
    width: 18px;
    height: 18px;
    stroke: #10b981;
}

/* ---------------------------
   Buttons
   --------------------------- */
.btn.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* ---------------------------
   Scrollbar
   --------------------------- */
.colors-wrapper::-webkit-scrollbar {
    width: 8px;
}

.colors-wrapper::-webkit-scrollbar-thumb {
    background: #e6e6e6;
    border-radius: 6px;
}

/* ---------------------------
   Canvas
   --------------------------- */
#canvas {
    display: none;
}

/* ---------------------------
   Mobile Responsive
   --------------------------- */
@media (max-width: 576px) {
    
        #magnifier-glass-container {
        width: 120px;
        height: 120px;
    }

    #magnifier-preview-swatch {
        width: 48px;
        height: 48px;
    }

    #magnifier-preview {
        width: 70px;
        height: 70px;
        padding: 8px;
    }

    :root {
        --panel-width: 100%;
        --preview-size: 48px;
    }

    .palette-swatch {
        width: 30px;
        height: 30px;
    }
}

@media (max-width: 991px) {
    .colors-wrapper {
        position: relative;
        top: 0;
        max-height: none;
        overflow: visible;
    }
}


/* Keyboard hint pills */
/* ---------- Paste-friendly UX ---------- */

.paste-zone {
  border: 2px dashed #e5e7eb;
  border-radius: 12px;
  transition: all 0.25s ease;
}

.paste-zone.paste-active {
  border-color: #0d6efd;
  background: rgba(13,110,253,0.05);
  box-shadow: 0 0 0 3px rgba(13,110,253,0.15);
}

/* Keyboard hint */
.kbd-hint {
  padding: 6px 12px;
  border-radius: 6px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  font-family: system-ui, -apple-system, BlinkMacSystemFont;
  transition: all 0.2s ease;
}

/* Glow when Ctrl / Cmd pressed */
.kbd-hint.active {
  background: #e0edff;
  border-color: #0d6efd;
  color: #0d6efd;
  box-shadow: 0 0 0 2px rgba(13,110,253,0.35);
}



/* ---------- Control Panel UI ---------- */

.control-panel {
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
}

.control-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}

.control-box {
  min-width: 140px;
}

.control-box select {
  font-weight: 500;
}

/* Better input focus */
.control-panel .form-control:focus,
.control-panel .form-select:focus {
  box-shadow: 0 0 0 2px rgba(13,110,253,0.15);
  border-color: #0d6efd;
}



/* ===============================
   Palette – Professional UI
================================ */

.palette-card {
  border-radius: 14px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
}

/* Swatch grid */
.palette-grid {
  display: flex;
  flex-wrap: wrap;
}

/* Swatch */
.palette-swatch {
  width: 56px;
  height: 56px;
  box-shadow:
    0 1px 2px rgba(0,0,0,0.08),
    inset 0 0 0 1px rgba(0,0,0,0.06);
  cursor: pointer;
  position: relative;
  transition: all 0.18s ease;
}

/* Hover */
.palette-swatch:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow:
    0 6px 16px rgba(0,0,0,0.15),
    inset 0 0 0 1px rgba(0,0,0,0.1);
}

/* Selected */
.palette-swatch.selected {
  outline: 3px solid rgba(13,110,253,0.9);
}

/* Multi-select */
.palette-swatch.multi-selected {
  outline: 3px solid rgba(13,110,253,0.45);
}

/* Size input */
.palette-size-input {
  width: 48px;
  font-weight: 600;
}

/* Toolbar buttons */
.palette-toolbar .btn {
  min-width: 68px;
  font-weight: 500;
}

/* Status */
.palette-status {
  font-size: 13px;
  color: #64748b;
}

/* Status success */
.palette-status.success {
  color: #0f766e;
  font-weight: 500;
}


/* ===============================
   Palette Delete Button Visibility
================================ */

/* Base delete button style (always hidden by default) */
.palette-swatch .delete-single-btn {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #dc3545;
  color: white;
  border: 2px solid white;
  display: none; /* HIDDEN BY DEFAULT */
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  z-index: 10;
  transition: all 0.2s ease;
  padding: 0;
  line-height: 1;
}

.palette-swatch .delete-single-btn:hover {
  background: #c82333;
  transform: scale(1.1);
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}



/* DELETE MODE: Delete button always visible */
.palette-card.palette-delete-mode-active .palette-swatch .delete-single-btn {
  display: flex !important;
  opacity: 1 !important;
  visibility: visible !important;
}

/* DELETE MODE STYLING */
.palette-card.palette-delete-mode-active .palette-swatch {
  cursor: pointer;
  transition: all 0.2s ease;
}

.palette-card.palette-delete-mode-active .palette-swatch:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.palette-card.palette-delete-mode-active .palette-swatch.selected-to-delete {
  outline: 3px solid #dc3545 !important;
  background-color: rgba(220, 53, 69, 0.1) !important;
  position: relative;
}

.palette-card.palette-delete-mode-active .palette-swatch.selected-to-delete::after {
  content: "✓";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  background: #dc3545;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: bold;
  z-index: 5;
}

/* Disable drag-and-drop in delete mode */
.palette-card.palette-delete-mode-active .palette-swatch {
  cursor: pointer !important;
}

.palette-card.palette-delete-mode-active .palette-swatch .drag-handle {
  display: none !important;
}