/* OfficeUtils – Custom Styles */

/* ── Variables ─────────────────────────────────── */
:root {
  --ou-primary: #2563eb;
  --ou-secondary: #7c3aed;
  --ou-accent: #f59e0b;
  --ou-bg: #f8fafc;
  --ou-card-bg: #ffffff;
  --ou-border: #e2e8f0;
  --ou-text: #1e293b;
  --ou-muted: #64748b;
  --ou-shadow: 0 4px 24px rgba(0,0,0,.08);
  --ou-radius: 14px;
  --ou-transition: .22s ease;
}

[data-bs-theme="dark"] {
  --ou-bg: #0f172a;
  --ou-card-bg: #1e293b;
  --ou-border: #334155;
  --ou-text: #f1f5f9;
  --ou-muted: #94a3b8;
  --ou-shadow: 0 4px 24px rgba(0,0,0,.4);
}

/* ── Base ───────────────────────────────────────── */
body {
  background: var(--ou-bg);
  color: var(--ou-text);
  font-family: 'Segoe UI', system-ui, sans-serif;
  transition: background var(--ou-transition), color var(--ou-transition);
}

/* ── Navbar ─────────────────────────────────────── */
.navbar {
  background: linear-gradient(135deg, #1d4ed8 0%, #6d28d9 100%) !important;
}
.navbar-brand span { font-size: 1.3rem; }
.dropdown-menu-animated {
  animation: fadeSlide .18s ease;
  border: none;
  box-shadow: var(--ou-shadow);
  border-radius: 12px;
  padding: .5rem;
  min-width: 220px;
}
.dropdown-item {
  border-radius: 8px;
  padding: .45rem .85rem;
  font-size: .88rem;
  transition: background var(--ou-transition);
}
.dropdown-item:hover { background: #eff6ff; }
[data-bs-theme="dark"] .dropdown-item:hover { background: #1e3a5f; }

@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Hero ───────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, #1d4ed8 0%, #7c3aed 100%);
  color: #fff;
  border-radius: var(--ou-radius);
  padding: 3rem 2rem;
  margin-bottom: 2.5rem;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.hero-search { max-width: 560px; }
.hero-search .form-control {
  border-radius: 50px 0 0 50px;
  border: 2px solid rgba(255,255,255,.3);
  background: rgba(255,255,255,.15);
  color: #fff;
  font-size: 1rem;
  padding: .7rem 1.2rem;
}
.hero-search .form-control::placeholder { color: rgba(255,255,255,.7); }
.hero-search .form-control:focus {
  background: rgba(255,255,255,.25);
  border-color: rgba(255,255,255,.6);
  color: #fff;
  box-shadow: none;
}
.hero-search .btn {
  border-radius: 0 50px 50px 0;
  background: var(--ou-accent);
  border: none;
  color: #000;
  font-weight: 600;
  padding: .7rem 1.4rem;
}

/* ── Category section ───────────────────────────── */
.section-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--ou-text);
  border-left: 4px solid var(--ou-primary);
  padding-left: .75rem;
  margin-bottom: 1.25rem;
}

/* ── Tool Cards ─────────────────────────────────── */
.tool-card {
  background: var(--ou-card-bg);
  border: 1px solid var(--ou-border);
  border-radius: var(--ou-radius);
  padding: 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  text-decoration: none;
  color: var(--ou-text);
  transition: transform var(--ou-transition), box-shadow var(--ou-transition), border-color var(--ou-transition);
  height: 100%;
}
.tool-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--ou-shadow);
  border-color: var(--ou-primary);
  color: var(--ou-text);
}
.tool-card-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.tool-card-title {
  font-weight: 600;
  font-size: .95rem;
  margin: 0 0 .2rem;
}
.tool-card-desc {
  font-size: .8rem;
  color: var(--ou-muted);
  margin: 0;
  line-height: 1.4;
}
.tool-card .badge-new {
  font-size: .65rem;
  background: #dcfce7; color: #15803d;
  border-radius: 20px; padding: 2px 8px;
  vertical-align: middle;
}

/* ── Upload area ────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--ou-border);
  border-radius: var(--ou-radius);
  padding: 2.5rem;
  text-align: center;
  background: var(--ou-card-bg);
  cursor: pointer;
  transition: border-color var(--ou-transition), background var(--ou-transition);
}
.upload-zone:hover,
.upload-zone.dz-drag-hover,
.upload-zone.highlight {
  border-color: var(--ou-primary);
  background: #eff6ff;
}
[data-bs-theme="dark"] .upload-zone:hover,
[data-bs-theme="dark"] .upload-zone.highlight { background: #1e3a5f; }
.upload-zone .dz-message { margin: 0; }
.upload-icon { font-size: 3rem; color: var(--ou-primary); margin-bottom: .75rem; }

/* Dropzone overrides */
.dropzone { min-height: auto; background: transparent; border: none; padding: 0; }
.dropzone .dz-preview.dz-file-preview .dz-image { border-radius: 10px; background: #eff6ff; }
.dropzone .dz-preview .dz-filename span { background: transparent; }
.dropzone .dz-preview .dz-progress { border-radius: 10px; }

/* ── Tool page layout ───────────────────────────── */
.tool-header {
  background: var(--ou-card-bg);
  border: 1px solid var(--ou-border);
  border-radius: var(--ou-radius);
  padding: 1.5rem 2rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.tool-header-icon {
  width: 60px; height: 60px;
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem;
}
.tool-header h1 { font-size: 1.4rem; font-weight: 700; margin: 0; }
.tool-header p  { font-size: .9rem; color: var(--ou-muted); margin: 0; }

/* ── Result card ────────────────────────────────── */
.result-card {
  background: var(--ou-card-bg);
  border: 1px solid var(--ou-border);
  border-radius: var(--ou-radius);
  padding: 1.5rem;
  margin-top: 1.5rem;
  display: none;
}
.result-card.visible { display: block; animation: fadeIn .3s ease; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Buttons ────────────────────────────────────── */
.btn-primary {
  background: var(--ou-primary);
  border-color: var(--ou-primary);
  border-radius: 10px;
  font-weight: 600;
  padding: .6rem 1.5rem;
  transition: all var(--ou-transition);
}
.btn-primary:hover { background: #1d4ed8; transform: translateY(-1px); }
.btn-success { border-radius: 10px; font-weight: 600; }
.btn-download {
  background: linear-gradient(135deg, #059669, #0d9488);
  border: none; color: #fff;
  border-radius: 10px;
  font-weight: 600;
  padding: .7rem 1.8rem;
  font-size: 1rem;
}
.btn-download:hover { background: linear-gradient(135deg, #047857, #0f766e); color: #fff; }

/* ── Progress bar ───────────────────────────────── */
.ou-progress { display: none; margin-top: 1rem; }
.ou-progress .progress { height: 8px; border-radius: 10px; }
.ou-progress .progress-bar { border-radius: 10px; background: linear-gradient(90deg, var(--ou-primary), var(--ou-secondary)); }

/* ── Form elements ──────────────────────────────── */
.form-control, .form-select {
  border-radius: 10px;
  border-color: var(--ou-border);
  background: var(--ou-card-bg);
  color: var(--ou-text);
}
.form-control:focus, .form-select:focus {
  border-color: var(--ou-primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
  background: var(--ou-card-bg);
  color: var(--ou-text);
}
textarea.form-control { min-height: 180px; resize: vertical; font-family: 'Courier New', monospace; }

/* ── Card ───────────────────────────────────────── */
.card {
  background: var(--ou-card-bg);
  border: 1px solid var(--ou-border);
  border-radius: var(--ou-radius);
  box-shadow: none;
}
.card-header {
  background: transparent;
  border-bottom: 1px solid var(--ou-border);
  font-weight: 700;
  border-radius: calc(var(--ou-radius) - 1px) calc(var(--ou-radius) - 1px) 0 0 !important;
}

/* ── Text tool panels ───────────────────────────── */
.stat-badge {
  background: var(--ou-bg);
  border: 1px solid var(--ou-border);
  border-radius: 10px;
  padding: .6rem 1rem;
  text-align: center;
  min-width: 100px;
}
.stat-badge .stat-num { font-size: 1.6rem; font-weight: 700; color: var(--ou-primary); line-height: 1; }
.stat-badge .stat-lbl { font-size: .75rem; color: var(--ou-muted); }

/* ── Breadcrumb ─────────────────────────────────── */
.breadcrumb { font-size: .85rem; }
.breadcrumb-item a { text-decoration: none; color: var(--ou-primary); }

/* ── Tips box ───────────────────────────────────── */
.tips-box {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  padding: 1rem 1.25rem;
  font-size: .85rem;
  color: #1e40af;
}
[data-bs-theme="dark"] .tips-box { background: #1e3a5f; border-color: #1d4ed8; color: #93c5fd; }

/* ── QR output ──────────────────────────────────── */
#qrOutput img { border-radius: 12px; border: 4px solid var(--ou-border); }

/* ── Color preview ──────────────────────────────── */
.color-preview {
  width: 80px; height: 80px;
  border-radius: 16px;
  border: 2px solid var(--ou-border);
  display: inline-block;
}

/* ── Diff viewer ────────────────────────────────── */
.diff-added   { background: #dcfce7; }
.diff-removed { background: #fee2e2; }
.diff-equal   { background: transparent; }

/* ── Footer ─────────────────────────────────────── */
.footer { border-top: 1px solid #1e293b; }
.footer a { color: #adb5bd; text-decoration: none; }
.footer a:hover { color: #fff !important; }
.footer .text-muted { color: #adb5bd !important; }
.footer h6 { color: #f1f5f9; }

/* ── Responsive tweaks ──────────────────────────── */
@media (max-width: 576px) {
  .hero { padding: 2rem 1rem; }
  .tool-header { flex-direction: column; }
}

/* ── Utility ────────────────────────────────────── */
.text-purple { color: #7c3aed !important; }
.bg-purple   { background-color: #7c3aed !important; }
.cursor-pointer { cursor: pointer; }
