/**
 * Utility Seva — Image Dimensions Checker Stylesheet
 * Strict Compact UI Layout (< 768px desktop screen height compliance)
 * Fully responsive across desktop, tablet, and mobile with Dark Mode support
 */

/* ==========================================================================
   1. Header & Navigation (Utility Seva Standard Header Integration)
   ========================================================================== */
.site-header .nav-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}

.site-header .theme-toggle-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background-color: var(--bg-surface);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.site-header .theme-toggle-btn:hover {
  background-color: var(--bg-surface-alt);
  color: var(--text-primary);
  border-color: var(--border-color-hover);
}

.site-header .theme-toggle-btn svg {
  width: 20px;
  height: 20px;
  display: block;
  flex-shrink: 0;
  margin: auto;
  stroke: currentColor;
  stroke-width: 2;
  transition: transform var(--transition-fast), opacity var(--transition-fast);
}

.site-header .theme-toggle-btn .sun-icon {
  display: none;
}

.site-header .theme-toggle-btn .moon-icon {
  display: block;
}

html[data-theme="dark"] .site-header .theme-toggle-btn .sun-icon,
html.dark .site-header .theme-toggle-btn .sun-icon {
  display: block;
}

html[data-theme="dark"] .site-header .theme-toggle-btn .moon-icon,
html.dark .site-header .theme-toggle-btn .moon-icon {
  display: none;
}

/* ==========================================================================
   2. Main Container & Top Bar
   ========================================================================== */
.converter-main {
  min-height: calc(100vh - var(--nav-height) - 80px);
  padding: 0.5rem 0 1.25rem 0;
  background-color: var(--bg-body, var(--bg-primary));
}

.converter-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.breadcrumb-nav-compact {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.775rem;
  color: var(--text-muted);
  margin-bottom: 0.1rem;
}

.breadcrumb-nav-compact a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.breadcrumb-nav-compact a:hover {
  color: var(--brand-600);
}

.converter-title-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.converter-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: -0.015em;
  line-height: 1.2;
}

.tool-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.12rem 0.48rem;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  background-color: rgba(16, 185, 129, 0.12);
  color: var(--success, #10b981);
  border: 1px solid rgba(16, 185, 129, 0.25);
  line-height: 1.3;
}

.converter-subtitle {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin: 0.1rem 0 0 0;
  line-height: 1.3;
}

/* Alert Notification Banner */
.converter-alert {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.75rem;
  margin-bottom: 0.5rem;
  border-radius: var(--radius-md);
  background-color: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #ef4444;
  font-size: 0.78rem;
  font-weight: 500;
  animation: fadeIn 0.2s ease;
}

.converter-alert svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* ==========================================================================
   3. Main Workspace: Two Columns (1366x768 Desktop Viewport Target)
   ========================================================================== */
.checker-workspace-grid {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 0.85rem;
  margin-bottom: 0.85rem;
  align-items: stretch;
}

/* Shared Card Container */
.checker-panel-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 0.75rem 0.85rem;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-card);
  transition: border-color var(--transition-fast), background-color var(--transition-normal);
  position: relative;
}

.panel-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border-color);
}

.panel-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.panel-title svg {
  width: 16px;
  height: 16px;
  color: var(--brand-500);
}

.panel-header-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-ghost-sm {
  padding: 0.18rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-ghost-sm:hover {
  background-color: var(--bg-surface-alt);
  color: var(--text-primary);
  border-color: var(--border-color-hover);
}

/* ==========================================================================
   4. Left Column: Image Stage & Drag-and-Drop Area
   ========================================================================== */
.image-preview-stage {
  position: relative;
  width: 100%;
  height: 380px;
  min-height: 260px;
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--border-color);
  background-color: var(--bg-surface-alt);
  transition: border-color var(--transition-fast), background-color var(--transition-fast);
}

.image-preview-stage.stage-checkerboard {
  background-image: linear-gradient(45deg, rgba(0, 0, 0, 0.05) 25%, transparent 25%),
                    linear-gradient(-45deg, rgba(0, 0, 0, 0.05) 25%, transparent 25%),
                    linear-gradient(45deg, transparent 75%, rgba(0, 0, 0, 0.05) 75%),
                    linear-gradient(-45deg, transparent 75%, rgba(0, 0, 0, 0.05) 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
}

html[data-theme="dark"] .image-preview-stage.stage-checkerboard,
html.dark .image-preview-stage.stage-checkerboard {
  background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.04) 25%, transparent 25%),
                    linear-gradient(-45deg, rgba(255, 255, 255, 0.04) 25%, transparent 25%),
                    linear-gradient(45deg, transparent 75%, rgba(255, 255, 255, 0.04) 75%),
                    linear-gradient(-45deg, transparent 75%, rgba(255, 255, 255, 0.04) 75%);
}

.image-preview-stage.drag-over {
  border-color: var(--brand-500);
  background-color: rgba(99, 102, 241, 0.08);
}

/* Upload Dropzone Empty State */
.upload-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1.5rem 1rem;
  width: 100%;
  height: 100%;
  cursor: pointer;
  outline: none;
}

.upload-icon-circle {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-full);
  background: rgba(99, 102, 241, 0.12);
  color: var(--brand-500);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.65rem;
  transition: transform var(--transition-fast);
}

.upload-dropzone:hover .upload-icon-circle {
  transform: scale(1.06);
}

.upload-primary-text {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
}

.upload-sub-text {
  font-size: 0.72rem;
  color: var(--text-muted);
  max-width: 280px;
  margin-bottom: 0.75rem;
  line-height: 1.35;
}

.btn-browse-photo {
  padding: 0.35rem 0.9rem;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  background-color: var(--brand-600);
  color: #ffffff;
  border: none;
  cursor: pointer;
  transition: background-color var(--transition-fast), transform var(--transition-fast);
  box-shadow: 0 1px 3px rgba(79, 70, 229, 0.3);
}

.btn-browse-photo:hover {
  background-color: var(--brand-700);
  transform: translateY(-1px);
}

/* Active Image Wrap */
.preview-img-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  overflow: hidden;
}

.preview-rendered-img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  display: block;
}

/* Stage Bottom Meta Card */
.meta-stats-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.5rem;
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-md);
  background-color: var(--bg-surface-alt);
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.meta-pills-wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.meta-pill strong {
  color: var(--text-primary);
  font-weight: 600;
}

.meta-format-badge {
  padding: 0.1rem 0.45rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  border-radius: var(--radius-sm);
  background-color: rgba(99, 102, 241, 0.14);
  color: var(--brand-600);
  letter-spacing: 0.03em;
}

/* ==========================================================================
   5. Right Column: Image Information & Specs
   ========================================================================== */
.right-info-column {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

/* Status Pill */
.status-pill-badge {
  padding: 0.12rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  background-color: var(--bg-surface-alt);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

.status-pill-badge.active {
  background-color: rgba(16, 185, 129, 0.12);
  color: #10b981;
  border-color: rgba(16, 185, 129, 0.3);
}

/* Hero Dimensions Banner */
.hero-dimensions-banner {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(139, 92, 246, 0.05) 100%);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.hero-dim-left {
  display: flex;
  flex-direction: column;
}

.hero-dim-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.hero-dim-val {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--brand-600);
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  margin-top: 0.1rem;
}

html[data-theme="dark"] .hero-dim-val,
html.dark .hero-dim-val {
  color: #818cf8;
}

.hero-dim-tags {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.hero-tag svg {
  width: 13px;
  height: 13px;
}

.hero-tag.tag-brand {
  background-color: rgba(99, 102, 241, 0.12);
  color: var(--brand-600);
  border-color: rgba(99, 102, 241, 0.25);
}

html[data-theme="dark"] .hero-tag.tag-brand,
html.dark .hero-tag.tag-brand {
  color: #a5b4fc;
}

/* Specs Accordion / Section Cards */
.spec-cards-container {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.spec-section-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: var(--bg-surface);
  padding: 0.5rem 0.65rem;
}

.spec-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.spec-section-title svg {
  width: 14px;
  height: 14px;
  color: var(--brand-500);
}

.spec-grid-2col {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.35rem 0.8rem;
}

.spec-grid-3col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.35rem 0.6rem;
}

.spec-item {
  display: flex;
  flex-direction: column;
}

.spec-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  line-height: 1.2;
}

.spec-value {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  word-break: break-word;
}

.spec-value.highlight-val {
  color: var(--brand-600);
}

html[data-theme="dark"] .spec-value.highlight-val,
html.dark .spec-value.highlight-val {
  color: #818cf8;
}

/* Action Buttons Bar */
.action-buttons-bar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.15rem;
  flex-wrap: wrap;
}

.btn-action-primary {
  flex: 1.2;
  min-width: 130px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.42rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  background-color: var(--brand-600);
  color: #ffffff;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: 0 1px 2px rgba(79, 70, 229, 0.25);
}

.btn-action-primary:hover:not(:disabled) {
  background-color: var(--brand-700);
  transform: translateY(-1px);
}

.btn-action-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-action-secondary {
  flex: 1;
  min-width: 130px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.42rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  background-color: var(--bg-surface-alt);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-action-secondary:hover:not(:disabled) {
  background-color: var(--border-color);
  border-color: var(--border-color-hover);
}

.btn-action-secondary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-action-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.42rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-action-ghost:hover:not(:disabled) {
  background-color: var(--bg-surface-alt);
  color: var(--text-primary);
}

.btn-action-ghost:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-action-primary svg,
.btn-action-secondary svg,
.btn-action-ghost svg {
  width: 14px;
  height: 14px;
}

/* Floating Toast Notification */
.copy-feedback-toast {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.65rem;
  background-color: #0f172a;
  color: #ffffff;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  animation: toastFade 0.25s ease;
  margin-top: 0.2rem;
  align-self: flex-start;
}

html[data-theme="dark"] .copy-feedback-toast,
html.dark .copy-feedback-toast {
  background-color: #f8fafc;
  color: #0f172a;
}

@keyframes toastFade {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   6. Common Image Size Reference Section
   ========================================================================== */
.reference-section-card {
  margin-top: 0.35rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: var(--bg-surface);
  padding: 0.55rem 0.75rem;
}

.reference-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}

.reference-title {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.reference-title svg {
  width: 14px;
  height: 14px;
  color: var(--brand-500);
}

.reference-hint {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.reference-chips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.35rem;
}

.ref-chip {
  padding: 0.3rem 0.45rem;
  border-radius: var(--radius-sm);
  background-color: var(--bg-surface-alt);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  transition: all var(--transition-fast);
  position: relative;
}

.ref-chip-name {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.ref-chip-dim {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  margin-top: 0.05rem;
}

.ref-chip-ratio {
  font-size: 0.62rem;
  color: var(--text-muted);
}

/* Matched Highlight states */
.ref-chip.matched-exact {
  border-color: #10b981;
  background-color: rgba(16, 185, 129, 0.12);
  box-shadow: 0 0 0 1px #10b981;
}

.ref-chip.matched-exact .ref-chip-name {
  color: #10b981;
}

.ref-chip.matched-exact::after {
  content: "Exact Match";
  position: absolute;
  top: -6px;
  right: 4px;
  font-size: 0.58rem;
  font-weight: 700;
  padding: 0.05rem 0.3rem;
  background-color: #10b981;
  color: #ffffff;
  border-radius: var(--radius-full);
}

.ref-chip.matched-ratio {
  border-color: var(--brand-500);
  background-color: rgba(99, 102, 241, 0.09);
}

.ref-chip.matched-ratio .ref-chip-name {
  color: var(--brand-600);
}

/* ==========================================================================
   7. Educational Guide Section (Below Workspace)
   ========================================================================== */
.educational-guide-section {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.guide-grid-3col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem;
}

.guide-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 0.85rem;
  box-shadow: var(--shadow-card);
}

.guide-card-header {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.4rem;
}

.guide-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-md);
  background-color: rgba(99, 102, 241, 0.12);
  color: var(--brand-600);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.guide-icon svg {
  width: 15px;
  height: 15px;
}

.guide-card-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.guide-card p {
  font-size: 0.74rem;
  color: var(--text-secondary);
  line-height: 1.45;
  margin: 0;
}

/* Processing Overlay Spinner */
.processing-overlay {
  position: absolute;
  inset: 0;
  background-color: rgba(255, 255, 255, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  z-index: 10;
}

html[data-theme="dark"] .processing-overlay,
html.dark .processing-overlay {
  background-color: rgba(15, 23, 42, 0.85);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(99, 102, 241, 0.2);
  border-top-color: var(--brand-600);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   8. Responsive Media Queries
   ========================================================================== */
@media (max-width: 960px) {
  .checker-workspace-grid {
    grid-template-columns: 1fr;
  }
  
  .image-preview-stage {
    height: 300px;
  }
  
  .guide-grid-3col {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .converter-title {
    font-size: 1.15rem;
  }
  
  .image-preview-stage {
    height: 240px;
  }
  
  .spec-grid-2col,
  .spec-grid-3col {
    grid-template-columns: 1fr;
  }
  
  .action-buttons-bar {
    flex-direction: column;
    align-items: stretch;
  }
  
  .hero-dimensions-banner {
    flex-direction: column;
    align-items: flex-start;
  }
}

