/* ============================================================
   QR Dashboard shared styles
   Used by resources/views/account/qrcodes/{index,create,edit}.blade.php
   Design language ported from resources/views/tools/qr-code.blade.php
   so the account pages feel like the same product as the public tool.
============================================================ */

/* The site loads Bootstrap 5's reboot (border-box) globally, but these
   rules don't depend on that - explicit here so width:100%/flex sizing on
   padded elements (buttons, inputs, pills) can never overflow their
   container regardless of load order or of this file being reused
   somewhere Bootstrap isn't present. */
.qr-btn, .qr-dl-btn, .qr-dash-icon-btn, .qr-mode-pill, .qr-type-tab, .qr-design-tab,
.qr-swatch, .qr-frame-option, .qr-radio-pill span, .qr-input, .qr-textarea,
.qr-color-input, .qr-resolved-url-input, .qr-reset-btn, .qr-dash-toggle {
  box-sizing: border-box;
}

/* ===========================
   Banner
=========================== */
.qr-banner {
  background: linear-gradient(135deg, #1a2a6c 0%, #2563eb 100%);
  padding: 44px 0 36px;
  color: #fff;
}
.qr-breadcrumb { background: transparent; margin-bottom: 14px; }
.qr-breadcrumb .breadcrumb-item a { color: rgba(255,255,255,.75); }
.qr-breadcrumb .breadcrumb-item.active { color: #fff; }
.qr-breadcrumb .breadcrumb-item+.breadcrumb-item::before { color: rgba(255,255,255,.45); }
.qr-banner-title { font-size: 2rem; font-weight: 800; color: #fff; margin-bottom: 6px; }
.qr-banner-sub { color: rgba(255,255,255,.85); font-size: .95rem; margin: 0; max-width: 720px; }
.qr-banner-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.qr-banner-notice {
  margin-top: 14px; padding: 10px 14px; border-radius: 10px; background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.25); font-size: .84rem; color: #fff; max-width: 720px;
  display: flex; align-items: flex-start; gap: 8px;
}
.qr-banner-notice .fa { margin-top: 2px; flex-shrink: 0; }

/* ===========================
   Layout
=========================== */
.qr-main { background: #eff6ff; padding: 40px 0 60px; }
.qr-grid { display: grid; grid-template-columns: 1fr 1.3fr; gap: 24px; align-items: start; }
.qr-col { min-width: 0; }
.qr-preview-col { position: sticky; top: 24px; }

@media (max-width: 768px) {
  .qr-grid { grid-template-columns: 1fr; }
  .qr-preview-col { position: static; order: -1; }
  .qr-input-col { order: 0; }
}

/* ===========================
   Cards
=========================== */
.qr-card { background: #fff; border-radius: 16px; box-shadow: 0 4px 24px rgba(26,42,108,.08); overflow: hidden; margin-bottom: 22px; }
.qr-card:last-child { margin-bottom: 0; }
.qr-card-header {
  padding: 16px 22px; font-size: 1rem; font-weight: 700;
  color: #fff; display: flex; align-items: center; gap: 10px;
  background: linear-gradient(90deg, #1d4ed8, #1a2a6c);
}
.qr-card-body { padding: 22px; }

/* ===========================
   Content type tabs
=========================== */
.qr-type-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.qr-type-tab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 14px; border-radius: 22px; border: 2px solid #dbeafe;
  background: #eff6ff; cursor: pointer; font-size: .84rem; font-weight: 700;
  color: #1e40af; transition: all .15s;
}
.qr-type-tab:hover { border-color: #93c5fd; }
.qr-type-tab.active {
  background: linear-gradient(135deg, #2563eb, #1a2a6c);
  color: #fff; border-color: transparent;
  box-shadow: 0 3px 12px rgba(37,99,235,.35);
}

/* ===========================
   Form elements
=========================== */
.qr-form-group { margin-bottom: 18px; }
.qr-form-group:last-child { margin-bottom: 0; }
.qr-form-row { display: flex; gap: 14px; }
.qr-form-row .qr-form-group { flex: 1; }
@media (max-width: 480px) { .qr-form-row { flex-direction: column; gap: 0; } }

.qr-label { display: block; font-size: .85rem; font-weight: 700; color: #475569; margin-bottom: 7px; }
.qr-input, .qr-textarea {
  width: 100%; padding: 10px 12px; border: 2px solid #e2e8f0;
  border-radius: 10px; font-size: .95rem; color: #1e293b;
  outline: none; transition: border-color .2s; font-family: inherit;
  background: #fff; box-sizing: border-box;
}
.qr-input:focus, .qr-textarea:focus { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.qr-textarea { resize: vertical; min-height: 70px; }

.qr-input-with-btn { display: flex; gap: 8px; }
.qr-input-with-btn .qr-input { flex: 1; min-width: 0; }
.qr-input-btn {
  padding: 0 16px; border: 2px solid #e2e8f0; border-radius: 10px;
  background: #f8fafc; color: #1e40af; font-weight: 700; font-size: .82rem;
  cursor: pointer; white-space: nowrap;
}
.qr-input-btn:hover { border-color: #93c5fd; }

.qr-input-hint { font-size: .78rem; color: #9ca3af; margin-top: 5px; }

.qr-checkbox-row { display: flex; align-items: center; gap: 8px; font-size: .88rem; font-weight: 600; color: #475569; cursor: pointer; }
.qr-checkbox-row input { width: 16px; height: 16px; cursor: pointer; flex-shrink: 0; }

.qr-radio-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.qr-radio-pill { display: inline-flex; align-items: center; cursor: pointer; }
.qr-radio-pill input { display: none; }
.qr-radio-pill span {
  padding: 6px 14px; border-radius: 20px; border: 2px solid #e2e8f0; background: #f8fafc;
  font-size: .82rem; font-weight: 600; color: #64748b; transition: all .15s; user-select: none;
}
.qr-radio-pill input:checked + span {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff; border-color: transparent; box-shadow: 0 2px 8px rgba(37,99,235,.3);
}
.qr-radio-pill:hover span { border-color: #93c5fd; color: #1e40af; }

.qr-color-input { width: 100%; height: 42px; border: 2px solid #e2e8f0; border-radius: 10px; padding: 3px; cursor: pointer; background: #fff; }

.qr-file-input { width: 100%; font-size: .85rem; }

.qr-range { width: 100%; }

/* ===========================
   Design tabs
=========================== */
.qr-design-tabs { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.qr-design-tab {
  display: inline-flex; align-items: center; gap: 7px; flex: 1; justify-content: center;
  padding: 10px 12px; border-radius: 10px; border: 2px solid #dbeafe;
  background: #eff6ff; cursor: pointer; font-size: .82rem; font-weight: 700;
  color: #1e40af; transition: all .15s; min-width: 100px;
}
.qr-design-tab.active { background: linear-gradient(135deg, #2563eb, #1a2a6c); color: #fff; border-color: transparent; }

/* ===========================
   Swatches (dot / corner styles)
=========================== */
.qr-swatch-row { display: flex; flex-wrap: wrap; gap: 10px; }
.qr-swatch {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 10px 8px; width: 84px; border-radius: 12px; border: 2px solid #e2e8f0;
  background: #fff; cursor: pointer; transition: all .15s;
}
.qr-swatch:hover { border-color: #93c5fd; }
.qr-swatch.active { border-color: #2563eb; background: #eff6ff; box-shadow: 0 2px 8px rgba(37,99,235,.2); }
.qr-swatch small { font-size: .68rem; font-weight: 600; color: #64748b; text-align: center; line-height: 1.15; }

.qr-dot-icon, .qr-corner-icon, .qr-cornerdot-icon { display: block; background: #1d4ed8; }
.qr-dot-icon { width: 26px; height: 26px; }
.qr-dot-icon.type-square { border-radius: 0; }
.qr-dot-icon.type-dots { border-radius: 50%; }
.qr-dot-icon.type-rounded { border-radius: 8px; }
.qr-dot-icon.type-classy { border-radius: 0 10px 0 10px; }
.qr-dot-icon.type-classy-rounded { border-radius: 4px 10px 4px 10px; }
.qr-dot-icon.type-extra-rounded { border-radius: 11px; }

.qr-corner-icon { width: 28px; height: 28px; background: transparent; border: 5px solid #1d4ed8; box-sizing: border-box; }
.qr-corner-icon.type-square { border-radius: 0; }
.qr-corner-icon.type-dot { border-radius: 50%; }
.qr-corner-icon.type-extra-rounded { border-radius: 30%; }

.qr-cornerdot-icon { width: 14px; height: 14px; margin: 6px; }
.qr-cornerdot-icon.type-square { border-radius: 0; }
.qr-cornerdot-icon.type-dot { border-radius: 50%; }

/* ===========================
   Logo panel
=========================== */
.qr-error-msg { color: #dc2626; font-size: .8rem; margin-top: 6px; min-height: 1em; }
.qr-logo-preview-row { display: flex; align-items: center; gap: 14px; margin-top: 14px; flex-wrap: wrap; }
.qr-logo-preview-img { width: 56px; height: 56px; object-fit: contain; border: 2px solid #e2e8f0; border-radius: 10px; padding: 4px; background: #fff; }

/* ===========================
   Frame grid
=========================== */
.qr-frame-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
@media (max-width: 560px) { .qr-frame-grid { grid-template-columns: repeat(3, 1fr); } }
.qr-frame-option {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 12px 6px; border-radius: 12px; border: 2px solid #e2e8f0;
  background: #fff; cursor: pointer; transition: all .15s;
}
.qr-frame-option .fa { font-size: 1.2rem; color: #1d4ed8; }
.qr-frame-option small { font-size: .66rem; font-weight: 600; color: #64748b; text-align: center; line-height: 1.15; }
.qr-frame-option:hover { border-color: #93c5fd; }
.qr-frame-option.active { border-color: #2563eb; background: #eff6ff; box-shadow: 0 2px 8px rgba(37,99,235,.2); }

/* ===========================
   Preview stage
=========================== */
.qr-preview-stage {
  position: relative; display: flex; align-items: center; justify-content: center;
  background: #eff6ff; border: 2px dashed #dbeafe; border-radius: 16px;
  padding: 20px; min-height: 280px;
}
.qr-raw-wrap, .qr-composite-canvas { max-width: 280px; width: 100%; }
.qr-raw-wrap svg, .qr-raw-wrap canvas, .qr-composite-canvas {
  width: 100% !important; height: auto !important; max-width: 280px; display: block; margin: 0 auto;
}
.qr-invalid-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; background: rgba(250,249,255,.92); border-radius: 16px; padding: 20px; text-align: center;
}
.qr-invalid-overlay .fa { font-size: 1.8rem; color: #f59e0b; }
.qr-invalid-overlay span { font-size: .85rem; color: #6b7280; font-weight: 600; max-width: 220px; }

.qr-status-bar { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; font-size: .78rem; gap: 10px; flex-wrap: wrap; }
.qr-char-count { color: #9ca3af; font-weight: 600; }
.qr-validation-msg { color: #16a34a; font-weight: 700; text-align: right; flex: 1; }
.qr-validation-msg.qr-msg-error { color: #dc2626; }

/* ===========================
   Actions / buttons
=========================== */
.qr-download-box {
  margin-top: 18px; padding: 14px; border: 2px solid #dbeafe; border-radius: 12px; background: #fff;
}
.qr-download-box-label {
  display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: .85rem; color: #1a2a6c; margin-bottom: 10px;
}
.qr-download-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.qr-dl-btn {
  flex: 1; min-width: 70px; display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 6px; border-radius: 8px; border: 2px solid #dbeafe; background: #eff6ff;
  color: #1e40af; font-weight: 700; font-size: .85rem; cursor: pointer; transition: opacity .2s, transform .1s;
}
.qr-dl-btn .fa { font-size: .82rem; }
.qr-dl-btn:hover:not(.qr-disabled) { opacity: .85; transform: translateY(-1px); }
.qr-dl-btn:active:not(.qr-disabled) { transform: translateY(0); }
.qr-dl-btn-primary { background: linear-gradient(135deg, #2563eb, #1a2a6c); color: #fff; border-color: transparent; }
.qr-dl-btn.qr-disabled, .qr-dl-btn:disabled { opacity: .45; cursor: not-allowed; }

.qr-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.qr-btn {
  flex: 1; min-width: 130px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 14px; border-radius: 10px; border: none; cursor: pointer;
  font-size: .85rem; font-weight: 700; transition: opacity .2s, transform .1s;
}
.qr-btn:hover:not(.qr-disabled) { opacity: .92; transform: translateY(-1px); }
.qr-btn:active:not(.qr-disabled) { transform: translateY(0); }
.qr-btn-primary { background: linear-gradient(135deg, #2563eb, #1a2a6c); color: #fff; }
.qr-btn-secondary { background: #eff6ff; color: #1e40af; }
.qr-btn-sm { flex: none; padding: 7px 12px; font-size: .78rem; }
.qr-btn.qr-disabled, .qr-btn:disabled { opacity: .45; cursor: not-allowed; }
.qr-btn-block { width: 100%; flex: none; }

.qr-reset-btn {
  width: 100%; margin-top: 12px; padding: 10px; background: transparent;
  border: 2px dashed #bfdbfe; border-radius: 10px; color: #2563eb; font-weight: 700;
  font-size: .82rem; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px;
}
.qr-reset-btn:hover { background: #eff6ff; }

/* ===========================
   Toast
=========================== */
.qr-toast {
  position: fixed; left: 50%; bottom: 30px; transform: translate(-50%, 20px);
  background: #1f2937; color: #fff; padding: 12px 22px; border-radius: 10px;
  font-size: .85rem; font-weight: 600; opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s; z-index: 2000; box-shadow: 0 8px 24px rgba(0,0,0,.25);
  max-width: 90vw; text-align: center;
}
.qr-toast-visible { opacity: 1; transform: translate(-50%, 0); }

/* ============================================================
   Dashboard-specific: name field, edit notice, success panel
============================================================ */
.qr-name-card .qr-card-body { padding-bottom: 6px; }
.qr-edit-notice {
  display: flex; align-items: flex-start; gap: 10px; background: #eff6ff; border: 1px solid #bfdbfe;
  border-radius: 10px; padding: 12px 14px; font-size: .82rem; color: #1e40af; margin-bottom: 18px;
}
.qr-edit-notice .fa { margin-top: 2px; flex-shrink: 0; color: #2563eb; }

.qr-save-panel { margin-top: 4px; }
.qr-save-error { color: #dc2626; font-size: .82rem; font-weight: 600; margin-top: 10px; min-height: 1em; }

.qr-success-banner {
  margin-top: 18px; padding: 16px; border-radius: 12px; background: #f0fdf4; border: 2px solid #bbf7d0;
}
.qr-success-banner-title { display: flex; align-items: center; gap: 8px; font-weight: 800; color: #15803d; font-size: .95rem; margin-bottom: 10px; }
.qr-success-banner-title .fa { font-size: 1.1rem; }
.qr-resolved-url-row { display: flex; gap: 8px; margin-bottom: 12px; }
.qr-resolved-url-input {
  flex: 1; min-width: 0; padding: 9px 10px; border: 2px solid #bbf7d0; border-radius: 8px;
  background: #fff; font-size: .82rem; color: #166534; font-family: monospace;
}
.qr-success-links { display: flex; flex-wrap: wrap; gap: 10px; }
.qr-success-links a { font-size: .82rem; font-weight: 700; color: #1e40af; text-decoration: underline; }

/* ============================================================
   Dashboard: list / index page
============================================================ */
.qr-dash-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 24px; flex-wrap: wrap;
}
.qr-dash-title { font-size: 1.4rem; font-weight: 800; color: #1a2a6c; margin: 0; }

.qr-dash-list { display: flex; flex-direction: column; gap: 16px; }

.qr-dash-item {
  background: #fff; border-radius: 16px; box-shadow: 0 4px 20px rgba(26,42,108,.08);
  padding: 18px; display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
}
.qr-dash-item-thumb {
  width: 76px; height: 76px; flex-shrink: 0; border-radius: 12px; border: 2px solid #e2e8f0;
  display: flex; align-items: center; justify-content: center; overflow: hidden; background: #fff;
}
.qr-dash-item-thumb svg, .qr-dash-item-thumb canvas, .qr-dash-item-thumb img { width: 100% !important; height: 100% !important; display: block; }
.qr-dash-item-thumb.is-inactive { opacity: .35; filter: grayscale(1); }

.qr-dash-item-body { flex: 1 1 240px; min-width: 0; }
.qr-dash-item-name {
  display: flex; align-items: center; gap: 8px; font-weight: 700; color: #1a2a6c; font-size: 1rem;
  margin-bottom: 4px; overflow-wrap: anywhere;
}
.qr-dash-item-name .fa { color: #2563eb; flex-shrink: 0; }
.qr-dash-item-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .78rem; color: #64748b; }
.qr-dash-item-meta span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.qr-dash-item-link {
  margin-top: 6px; font-size: .78rem; color: #2563eb; word-break: break-all;
}

.qr-dash-item-stats { display: flex; gap: 16px; flex-shrink: 0; }
.qr-dash-stat { text-align: center; min-width: 56px; }
.qr-dash-stat-num { font-size: 1.1rem; font-weight: 800; color: #1a2a6c; line-height: 1.1; }
.qr-dash-stat-label { font-size: .68rem; color: #9ca3af; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; }

.qr-dash-item-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; flex-wrap: wrap; }

.qr-dash-toggle { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.qr-dash-toggle input { opacity: 0; width: 0; height: 0; }
.qr-dash-toggle-slider {
  position: absolute; cursor: pointer; inset: 0; background-color: #cbd5e1; border-radius: 24px; transition: .2s;
}
.qr-dash-toggle-slider::before {
  position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px;
  background-color: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.qr-dash-toggle input:checked + .qr-dash-toggle-slider { background-color: #16a34a; }
.qr-dash-toggle input:checked + .qr-dash-toggle-slider::before { transform: translateX(20px); }
.qr-dash-toggle input:disabled + .qr-dash-toggle-slider { opacity: .5; cursor: not-allowed; }

.qr-dash-icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 12px; border-radius: 8px; border: 2px solid #dbeafe; background: #eff6ff;
  color: #1e40af; font-weight: 700; font-size: .8rem; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.qr-dash-icon-btn:hover { border-color: #93c5fd; color: #1e40af; }
.qr-dash-icon-btn-danger { background: #fef2f2; border-color: #fecaca; color: #dc2626; }
.qr-dash-icon-btn-danger:hover { border-color: #fca5a5; color: #dc2626; }

/* Empty state */
.qr-dash-empty {
  background: #fff; border-radius: 16px; box-shadow: 0 4px 20px rgba(26,42,108,.08);
  padding: 48px 24px; text-align: center;
}
.qr-dash-empty .fa { font-size: 2.4rem; color: #93c5fd; margin-bottom: 14px; }
.qr-dash-empty-title { font-size: 1.1rem; font-weight: 800; color: #1a2a6c; margin-bottom: 8px; }
.qr-dash-empty-desc { font-size: .88rem; color: #64748b; margin-bottom: 20px; max-width: 420px; margin-left: auto; margin-right: auto; }

/* Pagination */
.qr-dash-pagination { display: flex; justify-content: center; margin-top: 26px; }
.qr-dash-pagination ul { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0; justify-content: center; }
.qr-dash-pagination a, .qr-dash-pagination span {
  display: inline-flex; align-items: center; justify-content: center; min-width: 36px; height: 36px;
  padding: 0 10px; border-radius: 8px; border: 2px solid #dbeafe; background: #fff; color: #1e40af;
  font-size: .82rem; font-weight: 700; text-decoration: none;
}
.qr-dash-pagination a:hover { border-color: #93c5fd; }
.qr-dash-pagination .qr-page-current { background: linear-gradient(135deg, #2563eb, #1a2a6c); color: #fff; border-color: transparent; }
.qr-dash-pagination .qr-page-disabled { color: #cbd5e1; border-color: #e2e8f0; cursor: not-allowed; }

/* Responsive: cards stack cleanly, no wrapping/overflow on narrow phones */
@media (max-width: 640px) {
  .qr-dash-item { flex-direction: column; align-items: stretch; text-align: left; }
  .qr-dash-item-thumb { align-self: flex-start; }
  .qr-dash-item-stats { justify-content: flex-start; }
  .qr-dash-item-actions { justify-content: flex-start; width: 100%; }
  .qr-dash-icon-btn { flex: 1 1 auto; }
  .qr-dash-toolbar { flex-direction: column; align-items: stretch; }
  .qr-dash-toolbar .qr-btn { width: 100%; }
}

/* ===========================
   Mode toggle pills (used on tools/qr-code.blade.php too, kept here for reuse)
=========================== */
.qr-mode-toggle { display: inline-flex; padding: 4px; background: #eff6ff; border-radius: 24px; gap: 4px; margin-bottom: 16px; }
.qr-mode-pill {
  padding: 8px 18px; border-radius: 20px; border: none; background: transparent; cursor: pointer;
  font-size: .84rem; font-weight: 700; color: #1e40af; transition: all .15s;
}
.qr-mode-pill.active { background: linear-gradient(135deg, #2563eb, #1a2a6c); color: #fff; box-shadow: 0 2px 8px rgba(37,99,235,.3); }
