/* ==========================================================================
   QLDT - Quản Lý Doanh Thu & Lợi Nhuận
   Fintech Modern Responsive Design System
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700;800&subset=vietnamese&display=swap');

:root {
  --font-sans: 'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif;
  
  /* Color Palette - Dark Fintech Theme */
  --bg-main: #090d16;
  --bg-card: #111827;
  --bg-card-hover: #172033;
  --bg-surface: #1e293b;
  --bg-input: #172033;
  
  --border: rgba(255, 255, 255, 0.08);
  --border-focus: #6366f1;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.25);
  
  --emerald: #10b981;
  --emerald-hover: #059669;
  --emerald-glow: rgba(16, 185, 129, 0.2);
  --emerald-light: rgba(16, 185, 129, 0.12);
  
  --rose: #f43f5e;
  --rose-hover: #e11d48;
  --rose-glow: rgba(244, 63, 94, 0.2);
  --rose-light: rgba(244, 63, 94, 0.12);
  
  --amber: #f59e0b;
  --amber-light: rgba(245, 158, 11, 0.12);
  
  --sky: #0ea5e9;
  --sky-light: rgba(14, 165, 233, 0.12);
  
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.35);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  --header-height: 64px;
  --bottom-nav-height: 68px;
}

/* Light Theme Variables */
[data-theme="light"] {
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-surface: #f1f5f9;
  --bg-input: #ffffff;
  
  --border: rgba(0, 0, 0, 0.08);
  --border-focus: #4f46e5;
  
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;
  
  --primary-glow: rgba(99, 102, 241, 0.15);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.08);
}

/* Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  overflow-x: hidden;
  width: 100%;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  width: 100%;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(var(--bottom-nav-height) + 20px);
}

@media (min-width: 1024px) {
  body {
    padding-bottom: 24px;
  }
}

a {
  color: inherit;
  text-decoration: none;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

/* Header & Navigation */
.app-header {
  height: var(--header-height);
  background: rgba(17, 24, 39, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
}

[data-theme="light"] .app-header {
  background: rgba(255, 255, 255, 0.88);
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  height: 100%;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

@media (min-width: 768px) {
  .header-inner {
    padding: 0 16px;
  }
}

/* Hide the secondary "Fintech" tag on very small screens to give the
   header icons enough breathing room and avoid crowding/clipping. */
@media (max-width: 400px) {
  .brand-badge {
    display: none;
  }
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

@media (min-width: 768px) {
  .brand-logo {
    gap: 10px;
    font-size: 1.15rem;
  }
}

.brand-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #6366f1, #3b82f6);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 18px;
  box-shadow: 0 2px 8px var(--primary-glow);
}

.nav-desktop {
  display: none;
  gap: 4px;
}

@media (min-width: 1024px) {
  .nav-desktop {
    display: flex;
  }
}

.nav-link {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

.nav-link:hover {
  color: var(--text-main);
  background: var(--bg-surface);
}

.nav-link.active {
  color: #fff !important;
  background: var(--primary) !important;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}

.nav-link.active svg {
  stroke: #fff !important;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

@media (min-width: 768px) {
  .header-actions {
    gap: 8px;
  }
}

.btn-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

@media (min-width: 768px) {
  .btn-icon {
    width: 38px;
    height: 38px;
  }
}

.btn-icon:hover {
  color: var(--text-main);
  border-color: var(--border-focus);
}

.btn-icon.active-privacy {
  color: var(--amber);
  border-color: var(--amber);
  background: var(--amber-light);
}

/* Layout & Containers */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px;
  width: 100%;
}

@media (min-width: 768px) {
  .container {
    padding: 24px 20px;
  }
}

/* ==========================================================================
   Page Header (Title + Subtitle + Actions)
   Shared header block used at the top of every feature page for a
   consistent, professional layout on both desktop and mobile.
   ========================================================================== */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.page-header-text {
  min-width: 0;
}

.page-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
  margin-bottom: 4px;
  line-height: 1.3;
}

@media (min-width: 768px) {
  .page-title {
    font-size: 1.5rem;
  }
}

.page-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.page-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

@media (max-width: 480px) {
  .page-actions {
    width: 100%;
  }

  .page-actions .btn {
    flex: 1;
  }
}

/* Reusable section spacing rhythm */
.section-block {
  margin-bottom: 28px;
}

/* ==========================================================================
   Stat Strip — responsive summary boxes for money totals.
   Stacks full-width on mobile (guarantees room for long amounts, never
   truncates) and lays out as an even row from tablet width upward.
   ========================================================================== */
.stat-strip {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

@media (min-width: 640px) {
  .stat-strip {
    flex-direction: row;
  }
}

.stat-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  min-width: 0;
  flex: 1;
}

@media (min-width: 640px) {
  .stat-box {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 4px;
  }
}

.stat-box.stat-thu { border-left-color: var(--emerald); }
.stat-box.stat-chi { border-left-color: var(--rose); }
.stat-box.stat-neutral { border-left-color: #38bdf8; }
.stat-box.stat-amber { border-left-color: var(--amber); }

.stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
  flex-shrink: 0;
}

.stat-value {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  white-space: nowrap;
  text-align: right;
}

@media (min-width: 640px) {
  .stat-value {
    font-size: 1.2rem;
    text-align: left;
  }
}

/* Card System */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s;
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.14);
}

[data-theme="light"] .card:hover {
  border-color: rgba(0, 0, 0, 0.15);
}

/* Stats / KPI Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

@media (min-width: 768px) {
  .kpi-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
  }
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary);
  opacity: 0.8;
}

.kpi-card.kpi-revenue::before { background: var(--emerald); }
.kpi-card.kpi-expense::before { background: var(--rose); }
.kpi-card.kpi-profit::before { background: #38bdf8; }
.kpi-card.kpi-debt::before { background: var(--amber); }

.kpi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.kpi-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.kpi-badge-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}

.kpi-amount {
  font-size: clamp(1.05rem, 5vw, 1.35rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-main);
  margin-bottom: 4px;
  line-height: 1.2;
  word-break: break-word;
}

@media (min-width: 768px) {
  .kpi-amount {
    font-size: 1.6rem;
  }
}

.kpi-sub {
  font-size: 0.75rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Privacy Mode Masking */
body.privacy-mode .money-value {
  letter-spacing: 0.15em;
  user-select: none;
}

/* Prevent long formatted money strings from forcing grid/flex overflow on mobile.
   Values must always stay fully visible — never truncate an amount — so we
   allow wrapping instead of clipping with an ellipsis. */
.money-value {
  display: inline-block;
  max-width: 100%;
  overflow-wrap: break-word;
  word-break: break-word;
  vertical-align: bottom;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 10px var(--primary-glow);
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-emerald {
  background: var(--emerald);
  color: #fff;
  box-shadow: 0 2px 10px var(--emerald-glow);
}

.btn-emerald:hover {
  background: var(--emerald-hover);
  transform: translateY(-1px);
}

.btn-rose {
  background: var(--rose);
  color: #fff;
}

.btn-rose:hover {
  background: var(--rose-hover);
}

.btn-secondary {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-main);
}

.btn-secondary:hover {
  border-color: var(--border-focus);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

/* Form Controls */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}

/* Fix browser autofill bright white background in Dark Mode */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
select:-webkit-autofill {
  -webkit-text-fill-color: var(--text-main) !important;
  -webkit-box-shadow: 0 0 0px 1000px var(--bg-input) inset !important;
  box-shadow: 0 0 0px 1000px var(--bg-input) inset !important;
  border-color: var(--border-focus) !important;
  transition: background-color 5000s ease-in-out 0s;
}

.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Password Input with Eye Toggle */
.password-group {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.password-group .form-control {
  padding-right: 44px;
}

.password-toggle-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: color 0.2s, background-color 0.2s;
  user-select: none;
}

.password-toggle-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.08);
}

select.form-control {
  cursor: pointer;
}

textarea.form-control {
  resize: vertical;
  min-height: 80px;
}

/* Filter Bar */
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.filter-pills {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.filter-pills::-webkit-scrollbar {
  display: none;
}

.filter-pill {
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--bg-surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.filter-pill:hover, .filter-pill.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-lg);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.data-table th {
  background: var(--bg-surface);
  color: var(--text-muted);
  font-weight: 600;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-main);
  vertical-align: middle;
}

.data-table tr:hover td {
  background: var(--bg-card-hover);
}

/* Mobile Transaction Cards (Hidden on desktop, shown on mobile) */
.mobile-trans-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

@media (min-width: 768px) {
  .mobile-trans-list {
    display: none;
  }
}

.desktop-table-view {
  display: none;
}

@media (min-width: 768px) {
  .desktop-table-view {
    display: block;
  }
}

.trans-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all 0.2s;
}

.trans-item:active {
  background: var(--bg-card-hover);
  transform: scale(0.99);
}

.trans-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.trans-icon-box {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.trans-info {
  min-width: 0;
}

.trans-cat {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-main);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.trans-date-note {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.trans-right {
  text-align: right;
  flex-shrink: 0;
  padding-left: 10px;
}

.trans-val {
  font-weight: 700;
  font-size: 0.95rem;
}

.trans-val.thu { color: var(--emerald); }
.trans-val.chi { color: var(--rose); }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-thu {
  background: var(--emerald-light);
  color: var(--emerald);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-chi {
  background: var(--rose-light);
  color: var(--rose);
  border: 1px solid rgba(244, 63, 94, 0.2);
}

.badge-warning {
  background: var(--amber-light);
  color: var(--amber);
}

/* Mobile Bottom Navigation Bar */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background: rgba(17, 24, 39, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 50;
  padding: 0 8px;
}

[data-theme="light"] .bottom-nav {
  background: rgba(255, 255, 255, 0.95);
}

@media (min-width: 1024px) {
  .bottom-nav {
    display: none;
  }
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  flex: 1;
  color: var(--text-dim);
  font-size: 0.7rem;
  font-weight: 600;
  height: 100%;
  transition: all 0.2s;
}

.nav-item.active {
  color: var(--primary) !important;
  font-weight: 700;
}

.nav-item.active svg {
  stroke: var(--primary) !important;
  transform: translateY(-2px) scale(1.1);
  filter: drop-shadow(0 2px 8px rgba(99, 102, 241, 0.5));
}

.nav-item svg {
  width: 22px;
  height: 22px;
  transition: transform 0.2s ease, stroke 0.2s ease;
}

/* Center Action Button in Mobile Nav */
.nav-action-center {
  position: relative;
  top: -14px;
}

.btn-center-action {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.45);
  border: 3px solid var(--bg-main);
  transition: transform 0.2s;
  cursor: pointer;
}

.btn-center-action:active {
  transform: scale(0.92);
}

/* Floating "Thêm Giao Dịch" Button (Desktop / Tablet)
   Fixed to the bottom-right corner, visible on every page. Hidden on mobile
   widths where the bottom nav's own center "+" button already covers this. */
.fab-add-transaction {
  display: none;
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 60;
  align-items: center;
  gap: 8px;
  padding: 14px 20px;
  border: none;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.45);
  transition: transform 0.2s, box-shadow 0.2s;
}

.fab-add-transaction:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(99, 102, 241, 0.55);
}

.fab-add-transaction:active {
  transform: scale(0.96);
}

@media (min-width: 1024px) {
  .fab-add-transaction {
    display: flex;
  }
}

/* Modals & Bottom Sheets */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.2s ease;
}

@media (min-width: 768px) {
  .modal-overlay {
    align-items: center;
  }
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  width: 100%;
  max-width: 540px;
  border-radius: 20px 20px 0 0;
  padding: 20px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (min-width: 768px) {
  .modal-content {
    border-radius: var(--radius-lg);
    animation: zoomIn 0.25s ease;
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.btn-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* AI Vision Dropzone & Scan UI */
.ai-scan-box {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  background: var(--bg-surface);
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}

.ai-scan-box:hover, .ai-scan-box.dragover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.05);
}

.scan-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary-glow);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 24px;
}

.preview-container {
  max-height: 280px;
  border-radius: var(--radius-md);
  overflow: hidden;
  margin: 16px 0;
  display: none;
  background: #000;
  position: relative;
}

.preview-container img {
  width: 100%;
  height: auto;
  max-height: 280px;
  object-fit: contain;
  display: block;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@keyframes zoomIn {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

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

/* ==========================================================================
   Toast Notification System (Floating Pop-up)
   ========================================================================== */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 999999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: 90vw;
  width: 380px;
}

@media (max-width: 767px) {
  .toast-container {
    top: 14px;
    left: 14px;
    right: 14px;
    width: auto;
  }
}

.toast-item {
  pointer-events: auto;
  background: rgba(17, 24, 39, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  transform: translateY(-20px);
  opacity: 0;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

[data-theme="light"] .toast-item {
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}

.toast-item.show {
  transform: translateY(0);
  opacity: 1;
}

.toast-item.hide {
  transform: translateY(-20px);
  opacity: 0;
}

.toast-item.toast-success {
  border-left: 5px solid var(--emerald);
}

.toast-item.toast-danger {
  border-left: 5px solid var(--rose);
}

.toast-item.toast-warning {
  border-left: 5px solid var(--amber);
}

.toast-item.toast-info {
  border-left: 5px solid var(--sky);
}

.toast-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  margin-top: 2px;
}

.toast-success .toast-icon {
  background: var(--emerald-light);
  color: var(--emerald);
}

.toast-danger .toast-icon {
  background: var(--rose-light);
  color: var(--rose);
}

.toast-warning .toast-icon {
  background: var(--amber-light);
  color: var(--amber);
}

.toast-info .toast-icon {
  background: var(--sky-light);
  color: var(--sky);
}

.toast-body {
  flex: 1;
  min-width: 0;
}

.toast-title {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-main);
  margin-bottom: 2px;
}

.toast-msg {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
  word-break: break-word;
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 18px;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.2s;
}

.toast-close:hover {
  color: var(--text-main);
}

.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: var(--primary);
  width: 100%;
  transform-origin: left;
  animation: toastProgress 4s linear forwards;
}

.toast-success .toast-progress { background: var(--emerald); }
.toast-danger .toast-progress { background: var(--rose); }
.toast-warning .toast-progress { background: var(--amber); }

@keyframes toastProgress {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

/* Button Polish */
.btn:active {
  transform: scale(0.98);
}

