/* ==========================================================================
   BLOOM IRIS AGENCY — ADMIN PANEL
   Clean, functional back-office UI · plum/iris brand accents
   ========================================================================== */

:root {
  --plum:      #631A6C;
  --plum-deep: #4a1251;
  --iris:      #B45F9A;
  --iris-soft: #d49ec4;
  --ink:       #1f1825;
  --ink-soft:  #6b6175;
  --bg:        #f4f1f5;
  --surface:   #ffffff;
  --line:      #e7e0ea;
  --sidebar:   #271033;
  --green:     #1b9e5a;
  --amber:     #d98a16;
  --red:       #d23c3c;
  --blue:      #2f6fd0;
  --radius:    14px;
  --radius-sm: 9px;
  --shadow:    0 2px 14px rgba(39,16,51,.07);
  --shadow-md: 0 10px 34px rgba(39,16,51,.14);
  --font:      'Manrope', 'Segoe UI', system-ui, sans-serif;
  --sidebar-w: 256px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }
img { max-width: 100%; display: block; }
h1,h2,h3,h4 { line-height: 1.25; }

/* ---------- Layout shell ---------- */
.admin-shell { display: flex; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--sidebar); color: rgba(255,255,255,.72);
  display: flex; flex-direction: column;
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 50;
  transition: transform .3s ease;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 11px;
  padding: 22px 22px; border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand .mark {
  width: 38px; height: 38px; border-radius: 10px;
  background: linear-gradient(135deg, var(--plum), var(--iris));
  display: grid; place-items: center; color: #fff;
  font-weight: 700; font-size: 1.2rem;
}
.sidebar-brand .name { color: #fff; font-weight: 700; font-size: 1.05rem; }
.sidebar-brand .sub { font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: var(--iris-soft); }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 16px 12px; }
.nav-section { font-size: .68rem; letter-spacing: .14em; text-transform: uppercase;
  color: rgba(255,255,255,.34); padding: 16px 12px 8px; font-weight: 700; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  font-weight: 600; font-size: .9rem; margin-bottom: 2px;
  transition: background .2s ease, color .2s ease;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: linear-gradient(135deg, var(--plum), var(--iris)); color: #fff; }
.nav-item .badge {
  margin-left: auto; background: var(--iris); color: #fff;
  font-size: .68rem; font-weight: 700; padding: 1px 7px; border-radius: 20px;
}
.sidebar-foot { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.08); }

/* ---------- Main area ---------- */
.admin-main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }

/* ---------- Topbar ---------- */
.topbar {
  background: var(--surface); border-bottom: 1px solid var(--line);
  padding: 13px 26px; display: flex; align-items: center; gap: 16px;
  position: sticky; top: 0; z-index: 40;
}
.topbar h1 { font-size: 1.18rem; font-weight: 700; }
.topbar .crumbs { font-size: .82rem; color: var(--ink-soft); }
.topbar-spacer { flex: 1; }
.topbar-user { display: flex; align-items: center; gap: 10px; }
.topbar-user .avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, var(--plum), var(--iris));
  color: #fff; display: grid; place-items: center; font-weight: 700;
}
.topbar-user .info { line-height: 1.2; }
.topbar-user .info .nm { font-weight: 700; font-size: .86rem; }
.topbar-user .info .rl { font-size: .74rem; color: var(--ink-soft); text-transform: capitalize; }
.menu-toggle { display: none; width: 40px; height: 40px; border-radius: 9px;
  background: var(--bg); place-items: center; }

/* ---------- Content ---------- */
.content { padding: 26px; flex: 1; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h2 { font-size: 1.5rem; font-weight: 700; }
.page-head p { color: var(--ink-soft); font-size: .9rem; }

/* ---------- Stat cards ---------- */
.stat-cards { display: grid; grid-template-columns: repeat(4,1fr); gap: 18px; margin-bottom: 24px; }
.stat-card {
  background: var(--surface); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 16px;
}
.stat-card .ico {
  width: 50px; height: 50px; border-radius: 12px; flex-shrink: 0;
  display: grid; place-items: center; color: #fff;
}
.stat-card .ico svg { width: 24px; height: 24px; }
.stat-card .ico.plum  { background: linear-gradient(135deg, var(--plum), var(--iris)); }
.stat-card .ico.green { background: linear-gradient(135deg, #1b9e5a, #3fcb84); }
.stat-card .ico.amber { background: linear-gradient(135deg, #d98a16, #f0b452); }
.stat-card .ico.blue  { background: linear-gradient(135deg, #2f6fd0, #5b97e8); }
.stat-card .figure { font-size: 1.7rem; font-weight: 800; line-height: 1; }
.stat-card .label { font-size: .8rem; color: var(--ink-soft); margin-top: 4px; }

/* ---------- Generic card ---------- */
.card {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 22px;
}
.card-head {
  padding: 16px 20px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-head h3 { font-size: 1rem; font-weight: 700; }
.card-body { padding: 20px; }
.card-body.flush { padding: 0; }

/* ---------- Grid helpers ---------- */
.grid { display: grid; gap: 22px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3,1fr); }
.grid-2-1 { grid-template-columns: 2fr 1fr; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; }
table.data th {
  text-align: left; padding: 12px 16px; font-size: .74rem;
  letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft);
  border-bottom: 1px solid var(--line); font-weight: 700; white-space: nowrap;
}
table.data td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr { transition: background .15s ease; }
table.data tbody tr:hover { background: #faf7fb; }
table.data .thumb {
  width: 44px; height: 44px; border-radius: 8px; object-fit: cover;
  background: var(--bg);
}
table.data .row-title { font-weight: 700; }
table.data .row-sub { font-size: .8rem; color: var(--ink-soft); }

/* ---------- Pills ---------- */
.pill {
  display: inline-block; padding: 3px 11px; border-radius: 20px;
  font-size: .72rem; font-weight: 700; white-space: nowrap;
}
.pill-green { background: #e3f6ec; color: #1b7e47; }
.pill-amber { background: #fcefd8; color: #b06f10; }
.pill-red   { background: #fbe4e4; color: #b32a2a; }
.pill-blue  { background: #e3edfb; color: #2456a8; }
.pill-grey  { background: #ece8ee; color: #6b6175; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--radius-sm);
  font-weight: 700; font-size: .86rem; cursor: pointer;
  border: 1.5px solid transparent; transition: all .2s ease;
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: linear-gradient(135deg, var(--plum), var(--iris)); color: #fff; }
.btn-primary:hover { box-shadow: 0 8px 20px rgba(99,26,108,.32); transform: translateY(-1px); }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--iris); color: var(--plum); }
.btn-danger { background: #fbe4e4; color: var(--red); }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: .78rem; }
.btn-block { width: 100%; justify-content: center; }

.row-actions { display: flex; gap: 6px; }
.icon-btn {
  width: 32px; height: 32px; border-radius: 8px;
  display: grid; place-items: center; cursor: pointer;
  background: var(--bg); color: var(--ink-soft); transition: all .2s ease;
}
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:hover { background: var(--plum); color: #fff; }
.icon-btn.danger:hover { background: var(--red); }

/* ---------- Forms ---------- */
.form-grid { display: grid; gap: 18px; }
.form-grid.cols-2 { grid-template-columns: 1fr 1fr; }
.fld label { display: block; font-weight: 700; font-size: .82rem; margin-bottom: 6px; }
.fld label .req { color: var(--iris); }
.fld input[type=text], .fld input[type=email], .fld input[type=password],
.fld input[type=number], .fld input[type=url], .fld input[type=date],
.fld input[type=time], .fld select, .fld textarea {
  width: 100%; padding: 11px 13px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--line); background: #fbfafc;
  color: var(--ink); outline: none; transition: border-color .2s ease;
}
.fld input:focus, .fld select:focus, .fld textarea:focus {
  border-color: var(--iris); background: #fff;
}
.fld textarea { resize: vertical; min-height: 110px; }

/* ---------- File upload controls ---------- */
/* Custom dropzone-style control: native input is hidden, the label is the
   button. Used via the admin/partials/_upload_field partial. */
.upload-field { width: 100%; }
.upload-input {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.upload-label {
  display: flex; align-items: center; gap: 0;
  width: 100%;
  border: 1.5px dashed var(--line);
  border-radius: var(--radius-sm);
  background: #fbfafc;
  cursor: pointer; overflow: hidden;
  transition: border-color .2s ease, background .2s ease;
}
.upload-label:hover {
  border-color: var(--iris-soft);
  background: #fff;
}
.upload-input:focus + .upload-label {
  border-color: var(--iris);
  background: #fff;
}
.upload-field.is-filled .upload-label {
  border-style: solid;
  border-color: var(--iris-soft);
}
.upload-btn {
  display: inline-flex; align-items: center; gap: 8px;
  flex-shrink: 0;
  padding: 10px 16px;
  background: linear-gradient(135deg, var(--plum), var(--iris));
  color: #fff; font-weight: 700; font-size: .82rem;
  transition: opacity .2s ease;
}
.upload-label:hover .upload-btn { opacity: .94; }
.upload-btn svg { width: 17px; height: 17px; }
.upload-name {
  flex: 1; min-width: 0;
  padding: 0 14px;
  font-size: .82rem; color: var(--ink-soft);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.upload-field.is-filled .upload-name {
  color: var(--ink); font-weight: 600;
}

/* Fallback styling for any bare <input type=file> not using the partial. */
.fld input[type=file]:not(.upload-input) {
  width: 100%; padding: 9px 11px;
  border-radius: var(--radius-sm);
  border: 1.5px dashed var(--line);
  background: #fbfafc; color: var(--ink-soft);
  font-size: .84rem; cursor: pointer; outline: none;
  transition: border-color .2s ease, background .2s ease;
}
.fld input[type=file]:not(.upload-input):hover { border-color: var(--iris-soft); background: #fff; }
.fld input[type=file]:not(.upload-input)::file-selector-button,
.fld input[type=file]:not(.upload-input)::-webkit-file-upload-button {
  appearance: none; -webkit-appearance: none;
  margin-right: 12px; padding: 8px 16px; border: 0;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--plum), var(--iris));
  color: #fff; font-family: inherit; font-weight: 700;
  font-size: .82rem; cursor: pointer;
}
.fld .hint { font-size: .77rem; color: var(--ink-soft); margin-top: 5px; }
.fld-full { grid-column: 1 / -1; }
.form-actions {
  display: flex; gap: 10px; padding-top: 8px;
  border-top: 1px solid var(--line); margin-top: 6px;
}

/* checkbox / toggle */
.check { display: flex; align-items: center; gap: 9px; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--plum); }
.check span { font-weight: 600; font-size: .88rem; }

/* ---------- Alerts ---------- */
.alert { padding: 12px 16px; border-radius: var(--radius-sm);
  font-size: .87rem; font-weight: 600; margin-bottom: 18px; }
.alert-success { background: #e3f6ec; color: #1b7e47; }
.alert-error   { background: #fbe4e4; color: #b32a2a; }
.alert-info    { background: #e3edfb; color: #2456a8; }
.error-list { padding-left: 18px; }
.error-list li { list-style: disc; }

/* ---------- Filter bar ---------- */
.filter-row {
  display: flex; gap: 10px; flex-wrap: wrap;
  align-items: center; margin-bottom: 18px;
}
.filter-row .search { flex: 1; min-width: 200px; position: relative; }
.filter-row .search input {
  width: 100%; padding: 10px 13px 10px 38px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--line); background: var(--surface); outline: none;
}
.filter-row .search svg {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 17px; height: 17px; color: var(--ink-soft);
}
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab {
  padding: 8px 15px; border-radius: var(--radius-sm); font-weight: 700;
  font-size: .82rem; color: var(--ink-soft); background: var(--surface);
  border: 1.5px solid var(--line); cursor: pointer;
}
.tab:hover { color: var(--plum); border-color: var(--iris-soft); }
.tab.active { background: linear-gradient(135deg, var(--plum), var(--iris));
  color: #fff; border-color: transparent; }
.tab .count { opacity: .7; margin-left: 3px; }

/* ---------- Empty state ---------- */
.empty {
  text-align: center; padding: 56px 20px; color: var(--ink-soft);
}
.empty svg { width: 44px; height: 44px; color: var(--iris-soft); margin-bottom: 12px; }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center;
  background: linear-gradient(160deg, #2a0e2e, #631A6C); padding: 24px;
}
.login-card {
  background: var(--surface); border-radius: 20px;
  width: 100%; max-width: 410px; padding: 38px 34px;
  box-shadow: 0 30px 80px rgba(0,0,0,.4);
}
.login-card .brand {
  display: flex; flex-direction: column; align-items: center;
  text-align: center; margin-bottom: 26px;
}
.login-card .brand .mark {
  width: 56px; height: 56px; border-radius: 15px;
  background: linear-gradient(135deg, var(--plum), var(--iris));
  display: grid; place-items: center; color: #fff;
  font-weight: 700; font-size: 1.7rem; margin-bottom: 14px;
}
.login-card h1 { font-size: 1.3rem; font-weight: 800; }
.login-card .sub { color: var(--ink-soft); font-size: .86rem; margin-top: 3px; }

/* ---------- Activity feed ---------- */
.feed-item {
  display: flex; gap: 12px; padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.feed-item:last-child { border-bottom: none; }
.feed-item .dot {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  background: rgba(180,95,154,.13); color: var(--plum);
  display: grid; place-items: center;
}
.feed-item .dot svg { width: 16px; height: 16px; }
.feed-item .txt { font-size: .87rem; }
.feed-item .txt .when { font-size: .76rem; color: var(--ink-soft); }

/* ---------- Misc ---------- */
.muted { color: var(--ink-soft); }
.text-right { text-align: right; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.thumb-lg { width: 70px; height: 70px; border-radius: 10px; object-fit: cover; background: var(--bg); }
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 20px; }
.pagination a, .pagination strong {
  padding: 7px 13px; border-radius: 8px; font-weight: 700; font-size: .84rem;
  background: var(--surface); border: 1.5px solid var(--line);
}
.pagination strong { background: var(--plum); color: #fff; border-color: var(--plum); }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .stat-cards { grid-template-columns: repeat(2,1fr); }
  .grid-2, .grid-3, .grid-2-1 { grid-template-columns: 1fr; }
  .form-grid.cols-2 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .admin-main { margin-left: 0; }
  .menu-toggle { display: grid; }
  .stat-cards { grid-template-columns: 1fr; }
  .content { padding: 18px; }
}
