/* ============================================================
   public/css/main.css – Reset, biến, nav, footer, shared
   ============================================================ */

/* ── Variables ─────────────────────────────────────────── */
:root {
  --or: #ff6b35; --orl: #ff8c5a; --gr: #06d6a0;
  --bg: #fffbf5; --su: #fff; --tx: #1a1a2e; --mu: #6b7280;
  --bo: #e5e7eb; --sh: 0 4px 24px rgba(0,0,0,.08);
  --shl: 0 12px 48px rgba(0,0,0,.14);
  --fm: 'Baloo 2', cursive; --fb: 'Nunito', sans-serif;
  --nav-h: 62px; --sb-w: 260px;
  --radius: 12px; --radius-sm: 8px;
}

/* ── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--fb); background: var(--bg); color: var(--tx);
       min-height: 100vh; overflow-x: hidden; }
a { color: var(--or); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: var(--fb); }

/* ── Toast notification ─────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 10px; z-index: 9999;
}
.toast {
  padding: 12px 20px; border-radius: var(--radius-sm);
  font-size: .88rem; font-weight: 600; color: #fff;
  animation: toastIn .3s ease; box-shadow: var(--shl);
  max-width: 320px; line-height: 1.4;
}
.toast.success { background: var(--gr); }
.toast.error   { background: #ef4444; }
.toast.info    { background: var(--or); }
@keyframes toastIn { from { opacity:0; transform:translateY(12px); } to { opacity:1; transform:none; } }

/* ── Spinner ────────────────────────────────────────────── */
.spinner {
  width: 36px; height: 36px; border: 3px solid var(--bo);
  border-top-color: var(--or); border-radius: 50%;
  animation: spin .7s linear infinite; margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 20px; border-radius: 24px; border: none;
  font-weight: 700; font-size: .88rem; transition: transform .15s, box-shadow .15s;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary {
  background: linear-gradient(135deg, var(--or), var(--orl));
  color: #fff; box-shadow: 0 4px 14px rgba(255,107,53,.38);
}
.btn-success { background: linear-gradient(135deg, var(--gr), #04b889); color:#fff; box-shadow:0 4px 14px rgba(6,214,160,.3); }
.btn-ghost   { background: #fff; color: var(--or); border: 2px solid var(--or); }
.btn-ghost:hover { background: var(--or); color:#fff; }
.btn-danger  { background: #fee2e2; color: #dc2626; border: 1.5px solid #fca5a5; }
.btn-danger:hover { background: #dc2626; color:#fff; }
.btn-sm      { padding: 6px 14px; font-size: .8rem; }
.btn:disabled { opacity: .5; pointer-events: none; }

/* ── Forms ──────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-group label { font-weight: 700; font-size: .84rem; color: var(--tx); }
.form-control {
  padding: 10px 14px; border: 2px solid var(--bo); border-radius: var(--radius-sm);
  font-family: var(--fb); font-size: .9rem; outline: none;
  transition: border-color .2s; background: #fff; width: 100%;
}
.form-control:focus { border-color: var(--or); }
select.form-control { cursor: pointer; }
.form-hint { font-size: .76rem; color: var(--mu); }
.form-error { font-size: .78rem; color: #dc2626; font-weight: 600; }

/* ── Card ───────────────────────────────────────────────── */
.card {
  background: #fff; border-radius: var(--radius);
  box-shadow: var(--sh); overflow: hidden;
}
.card-body { padding: 20px; }

/* ── Badge / pill ───────────────────────────────────────── */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: .72rem; font-weight: 700;
}
.badge-orange  { background: #fff3ed; color: var(--or); }
.badge-green   { background: #ecfdf5; color: #059669; }
.badge-red     { background: #fee2e2; color: #dc2626; }
.badge-gray    { background: #f3f4f6; color: #6b7280; }
.badge-blue    { background: #eff6ff; color: #2563eb; }

/* ── NAVBAR ─────────────────────────────────────────────── */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 40px; background: #fff;
  box-shadow: 0 2px 16px rgba(0,0,0,.07);
}
.nav-logo {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--fm); font-size: 1.35rem; font-weight: 800;
  color: var(--or); cursor: pointer; user-select: none; text-decoration: none;
}
.nav-logo:hover { text-decoration: none; }
.nav-r { display: flex; align-items: center; gap: 6px; }
.nbtn {
  background: none; border: none; padding: 8px 13px;
  border-radius: 8px; font-family: var(--fb); font-size: .88rem;
  font-weight: 600; color: var(--tx); cursor: pointer; transition: background .15s;
}
.nbtn:hover { background: #f3f4f6; }

/* Nav user avatar / dropdown */
.nav-user { position: relative; }
.nav-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--or); color: #fff; border: none;
  font-weight: 700; font-size: .9rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.nav-avatar img { width: 100%; height: 100%; object-fit: cover; }
.nav-dropdown {
  display: none; position: absolute; top: calc(100%+8px); right: 0;
  background: #fff; border-radius: var(--radius);
  box-shadow: var(--shl); min-width: 200px; padding: 6px; z-index: 300;
}
.nav-user:hover .nav-dropdown { display: block; }
.nav-dd-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px; color: var(--tx);
  font-weight: 600; font-size: .87rem; cursor: pointer;
  transition: background .12s; text-decoration: none; border: none;
  background: none; width: 100%; text-align: left; font-family: var(--fb);
}
.nav-dd-item:hover { background: #fef3ec; color: var(--or); text-decoration: none; }
.nav-dd-sep { height: 1px; background: var(--bo); margin: 4px 0; }

/* Dropdown menu */
.drop { position: relative; }
.drop-menu {
  display: none; position: absolute; top: calc(100%+6px); left: 0;
  background: #fff; border-radius: var(--radius);
  box-shadow: var(--shl); min-width: 210px; padding: 6px; z-index: 300;
}
.drop:hover .drop-menu { display: block; }
.di {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 13px; border-radius: 10px; color: var(--tx);
  font-weight: 600; font-size: .87rem; cursor: pointer; transition: background .12s;
}
.di:hover { background: #fef3ec; color: var(--or); }

.nav-spacer { height: var(--nav-h); }

/* ── FOOTER ─────────────────────────────────────────────── */
.footer {
  background: var(--tx); color: #999; text-align: center; padding: 36px 20px;
}
.footer-logo { font-family: var(--fm); font-size: 1.25rem; font-weight: 800; color: var(--or); margin-bottom: 8px; }
.footer p { font-size: .85rem; margin-bottom: 14px; }
.footer-links { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; }
.footer-links a { color: #999; font-weight: 600; font-size: .84rem; }
.footer-links a:hover { color: var(--or); }

/* ── Empty state ────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 60px 20px; color: var(--mu);
}
.empty-state .ei { font-size: 3.5rem; margin-bottom: 14px; }
.empty-state h3 { font-family: var(--fm); font-size: 1.1rem; margin-bottom: 8px; color: var(--tx); }
.empty-state p { font-size: .88rem; }

/* ── Pagination ─────────────────────────────────────────── */
.pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 6px; margin-top: 32px; flex-wrap: wrap;
}
.page-btn {
  padding: 7px 13px; border: 2px solid var(--bo); border-radius: 8px;
  background: #fff; font-weight: 600; font-size: .84rem; cursor: pointer;
  transition: all .15s;
}
.page-btn:hover, .page-btn.active {
  border-color: var(--or); background: var(--or); color: #fff;
}
.page-btn:disabled { opacity: .4; pointer-events: none; }

/* ── Modal ──────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  z-index: 900; display: flex; align-items: center; justify-content: center;
  padding: 16px; backdrop-filter: blur(4px);
}
.modal-box {
  background: #fff; border-radius: 20px; padding: 28px;
  max-width: 520px; width: 100%; box-shadow: var(--shl);
  animation: modalIn .28s ease; max-height: 92vh; overflow-y: auto;
}
@keyframes modalIn { from{transform:scale(.92);opacity:0} to{transform:scale(1);opacity:1} }
.modal-title { font-family: var(--fm); font-size: 1.4rem; font-weight: 800; margin-bottom: 20px; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ── Frame card (grid item) ─────────────────────────────── */
.frames-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
}
.frame-card {
  background: #fff; border-radius: var(--radius);
  box-shadow: var(--sh); overflow: hidden; cursor: pointer;
  transition: transform .2s, box-shadow .2s; border: 2px solid transparent;
  position: relative;
}
.frame-card:hover { transform: translateY(-5px); box-shadow: var(--shl); border-color: var(--or); }
.frame-thumb {
  width: 100%; aspect-ratio: 1; object-fit: cover; display: block;
  background: #f0f2f8;
}
.frame-thumb-placeholder {
  width: 100%; aspect-ratio: 1; display: flex; align-items: center;
  justify-content: center; font-size: 2.5rem; background: #f0f2f8;
}
.frame-info { padding: 12px; }
.frame-title { font-family: var(--fm); font-weight: 700; font-size: .88rem; margin-bottom: 4px;
               white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.frame-meta  { display: flex; gap: 10px; font-size: .74rem; color: var(--mu); flex-wrap: wrap; }
.frame-actions {
  position: absolute; top: 8px; right: 8px;
  display: flex; gap: 4px; opacity: 0; transition: opacity .2s;
}
.frame-card:hover .frame-actions { opacity: 1; }
.frame-action-btn {
  width: 30px; height: 30px; border-radius: 6px; border: none;
  background: rgba(255,255,255,.9); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem; cursor: pointer; transition: background .15s;
}
.frame-action-btn:hover { background: #fff; }
.frame-status-badge {
  position: absolute; top: 8px; left: 8px;
}

/* ── Section header ─────────────────────────────────────── */
.sec-hd { text-align: center; margin-bottom: 32px; }
.sec-hd h2 { font-family: var(--fm); font-size: 1.8rem; font-weight: 800; margin-bottom: 8px; }
.sec-hd p  { color: var(--mu); font-size: .93rem; }
.sec { padding: 56px 40px; }
.sec-alt { padding: 56px 40px; background: #f7f8fc; }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 768px) {
  .nav { padding: 0 14px; }
  .sec, .sec-alt { padding: 36px 16px; }
  .frames-grid { grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 14px; }
}
/* Fix notification z-index */
.notif-dropdown { z-index: 500 !important; }
.frame-picker-sheet { z-index: 800 !important; }
/* Fix notification dropdown */
.notif-btn-wrap { position: relative; }
.notif-dropdown {
  position: absolute !important;
  top: calc(100% + 8px) !important;
  right: 0 !important;
  left: auto !important;
  width: 340px !important;
  max-height: 420px !important;
  overflow-y: auto !important;
  z-index: 9999 !important;
  display: none;
}
.notif-dropdown.show { display: block !important; }
/* Notification dropdown fix */
.notif-btn-wrap { position: relative; }
.notif-dropdown { display: none; }
.notif-dropdown.show { display: block; }