/* ==========================================
   MIRACUZZY — ADMIN DASHBOARD STYLES
   Premium Dark Dashboard
   ========================================== */

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

/* ---------- RESET & ROOT ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #08080f;
  --bg-sidebar:  #0c0c16;
  --bg-panel:    #0f0f1a;
  --bg-card:     #131320;
  --bg-input:    #1a1a2a;
  --bg-hover:    #1e1e30;
  --border:      rgba(255,255,255,0.07);
  --border-focus:rgba(196,94,26,0.6);
  --accent:      #c45e1a;
  --accent-l:    #d97a3e;
  --accent-glow: rgba(196,94,26,0.22);
  --text:        #e8e8ed;
  --text-2:      #9595a8;
  --text-3:      #55556a;
  --success:     #2dd4a0;
  --danger:      #e05c5c;
  --warning:     #f0b429;
  --radius:      12px;
  --radius-sm:   8px;
  --sidebar-w:   260px;
  --topbar-h:    64px;
  --font:        'Inter', sans-serif;
  --font-head:   'Outfit', sans-serif;
  --trans:       0.2s ease;
}

html, body { height: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  overflow-x: hidden;
}

/* ---------- PASSWORD GATE ---------- */
#gate-overlay {
  position: fixed; inset: 0;
  background: radial-gradient(ellipse at 50% 30%, #0f0f1a 0%, #08080f 100%);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}
#gate-overlay.hidden { opacity: 0; visibility: hidden; pointer-events: none; }

.gate-box {
  width: 100%; max-width: 400px;
  padding: 48px 40px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 40px 80px rgba(0,0,0,0.6), 0 0 60px var(--accent-glow);
  text-align: center;
  animation: gateIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes gateIn {
  from { opacity:0; transform:scale(0.85) translateY(20px); }
  to   { opacity:1; transform:scale(1) translateY(0); }
}

.gate-icon {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, var(--accent), var(--accent-l));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 24px;
  font-size: 1.5rem;
  box-shadow: 0 0 30px var(--accent-glow);
}

.gate-box h1 {
  font-family: var(--font-head);
  font-size: 1.5rem; font-weight: 700;
  margin-bottom: 6px; color: var(--text);
}
.gate-box p { color: var(--text-2); font-size: 0.875rem; margin-bottom: 28px; }

.gate-box input[type="password"] {
  width: 100%; padding: 14px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text); font-size: 1rem;
  letter-spacing: 2px;
  outline: none; transition: var(--trans);
  margin-bottom: 14px;
  text-align: center;
}
.gate-box input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }

.gate-error {
  color: var(--danger); font-size: 0.8rem; margin-bottom: 12px;
  min-height: 18px; transition: var(--trans);
}

/* ---------- LAYOUT ---------- */
#app { display: flex; height: 100vh; }
#app.hidden { display: none; }

/* --- SIDEBAR --- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; left: 0; top: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--bg-hover) transparent;
}

.sidebar-brand {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand .brand-name {
  font-family: var(--font-head);
  font-size: 1.15rem; font-weight: 700;
  color: var(--text);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-brand .brand-name .accent { color: var(--accent); }
.sidebar-brand .brand-sub {
  font-size: 0.7rem; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 1.5px;
  margin-top: 4px;
}

.sidebar-nav {
  flex: 1; padding: 12px 12px;
  display: flex; flex-direction: column; gap: 2px;
}

.nav-section-label {
  font-size: 0.65rem; font-weight: 600; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 1.5px;
  padding: 12px 8px 6px;
}

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  cursor: pointer;
  transition: var(--trans);
  font-size: 0.875rem; font-weight: 500;
  user-select: none;
  border: 1px solid transparent;
}
.nav-item i { width: 16px; text-align: center; font-size: 0.85rem; flex-shrink: 0; }
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.active {
  background: linear-gradient(135deg, rgba(196,94,26,0.18), rgba(196,94,26,0.08));
  border-color: rgba(196,94,26,0.3);
  color: var(--accent-l);
}
.nav-item.active i { color: var(--accent); }

.sidebar-footer {
  padding: 16px; border-top: 1px solid var(--border);
  display: flex; gap: 8px;
}

/* --- MAIN CONTENT --- */
.main-area {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex; flex-direction: column;
  min-height: 100vh;
}

/* --- TOP BAR --- */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px;
  position: sticky; top: 0; z-index: 50;
}

.topbar-left h2 {
  font-family: var(--font-head);
  font-size: 1.1rem; font-weight: 600; color: var(--text);
}
.topbar-left p { font-size: 0.75rem; color: var(--text-2); }

.topbar-actions { display: flex; gap: 10px; align-items: center; }

/* --- PANELS --- */
.panel-area {
  flex: 1; padding: 28px;
  overflow-y: auto;
}

.panel { display: none; }
.panel.active { display: block; }

/* ---------- FORM ELEMENTS ---------- */
.form-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}

.form-section-title {
  font-family: var(--font-head);
  font-size: 0.9rem; font-weight: 600;
  color: var(--text); margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}
.form-section-title i { color: var(--accent); font-size: 0.85rem; }

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}
.form-row:last-child { margin-bottom: 0; }

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }

label {
  font-size: 0.75rem; font-weight: 600; color: var(--text-2);
  text-transform: uppercase; letter-spacing: 0.8px;
}

input[type="text"],
input[type="url"],
input[type="number"],
input[type="password"],
textarea,
select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text); font-family: var(--font);
  font-size: 0.875rem; padding: 10px 12px;
  outline: none; transition: var(--trans);
  width: 100%;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
textarea { resize: vertical; min-height: 90px; line-height: 1.6; }
select { cursor: pointer; }
select option { background: var(--bg-card); }

/* Toggle Switch */
.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0;
}
.toggle-row span { font-size: 0.875rem; color: var(--text-2); }
.toggle {
  width: 44px; height: 24px;
  background: var(--bg-hover); border-radius: 99px;
  position: relative; cursor: pointer; transition: var(--trans);
  border: 1px solid var(--border); flex-shrink: 0;
}
.toggle.on { background: var(--accent); border-color: var(--accent); }
.toggle::after {
  content: '';
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff;
  position: absolute; top: 3px; left: 3px;
  transition: var(--trans);
  box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}
.toggle.on::after { left: 21px; }

/* Image Upload */
.img-upload-wrap {
  display: flex; gap: 16px; align-items: flex-start;
}
.img-preview {
  width: 80px; height: 80px; border-radius: var(--radius-sm);
  background: var(--bg-hover); border: 1px solid var(--border);
  object-fit: cover; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3); font-size: 1.4rem;
  overflow: hidden;
}
.img-preview img { width: 100%; height: 100%; object-fit: cover; }
.img-upload-controls { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.file-input-label {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 14px;
  background: var(--bg-hover); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-2);
  font-size: 0.8rem; cursor: pointer; transition: var(--trans);
}
.file-input-label:hover { border-color: var(--accent); color: var(--accent); }
.file-input-label input[type="file"] { display: none; }
.img-note { font-size: 0.72rem; color: var(--text-3); }

/* ---------- DYNAMIC LISTS ---------- */
.list-editor { display: flex; flex-direction: column; gap: 10px; }

.list-item-row {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px 12px;
  animation: slideIn 0.2s ease;
}
@keyframes slideIn {
  from { opacity:0; transform:translateY(-8px); }
  to   { opacity:1; transform:translateY(0); }
}

.list-item-row .drag-handle {
  color: var(--text-3); cursor: grab; font-size: 0.85rem;
  padding: 0 4px; flex-shrink: 0;
}
.list-item-row input {
  flex: 1; border: none; background: transparent; padding: 0;
  font-size: 0.875rem; color: var(--text);
}
.list-item-row input:focus { box-shadow: none; }
.list-item-row .btn-remove {
  background: none; border: none; color: var(--text-3);
  cursor: pointer; font-size: 0.85rem; padding: 2px 4px;
  border-radius: 4px; transition: var(--trans); flex-shrink: 0;
}
.list-item-row .btn-remove:hover { color: var(--danger); background: rgba(224,92,92,0.1); }

.btn-add-item {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  background: transparent; border: 1px dashed var(--border);
  border-radius: var(--radius-sm); color: var(--text-3);
  font-size: 0.8rem; cursor: pointer; transition: var(--trans);
  font-family: var(--font);
}
.btn-add-item:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- CARD EDITORS (Projects / Achievements) ---------- */
.card-editor-list { display: flex; flex-direction: column; gap: 16px; }

.card-editor-item {
  background: var(--bg-input);
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden;
  transition: var(--trans);
}
.card-editor-item:hover { border-color: rgba(196,94,26,0.3); }

.card-editor-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  cursor: pointer; user-select: none;
  background: var(--bg-card);
}
.card-editor-header-left {
  display: flex; align-items: center; gap: 12px;
}
.card-editor-header-left img {
  width: 32px; height: 32px; border-radius: 6px; object-fit: cover;
  background: var(--bg-hover);
}
.card-editor-header-left .card-editor-title {
  font-weight: 600; font-size: 0.9rem;
}
.card-editor-header-left .card-editor-sub {
  font-size: 0.75rem; color: var(--text-2);
}
.card-editor-header-actions { display: flex; gap: 6px; }
.card-editor-body {
  padding: 16px;
  display: none;
  border-top: 1px solid var(--border);
}
.card-editor-body.open { display: block; }

.card-editor-item .form-row { margin-bottom: 12px; }

/* ---------- STATS EDITOR ---------- */
.stats-editor-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.stat-edit-card {
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.stat-edit-card label { font-size: 0.68rem; }

/* ---------- BUTTONS ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px; border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 0.875rem; font-weight: 600;
  cursor: pointer; border: none; transition: var(--trans);
  text-decoration: none; white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-l));
  color: #fff;
  box-shadow: 0 4px 15px rgba(196,94,26,0.35);
}
.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(196,94,26,0.5);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent-l); }

.btn-danger {
  background: rgba(224,92,92,0.15);
  border: 1px solid rgba(224,92,92,0.3);
  color: var(--danger);
}
.btn-danger:hover { background: rgba(224,92,92,0.25); }

.btn-success {
  background: rgba(45,212,160,0.12);
  border: 1px solid rgba(45,212,160,0.3);
  color: var(--success);
}

.btn-sm { padding: 6px 12px; font-size: 0.78rem; }
.btn-icon { padding: 8px; border-radius: 8px; }

/* ---------- TOAST ---------- */
#toast-container {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 10000;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  font-size: 0.85rem; color: var(--text);
  animation: toastIn 0.3s ease;
  min-width: 260px;
}
@keyframes toastIn {
  from { opacity:0; transform:translateX(20px); }
  to   { opacity:1; transform:translateX(0); }
}
.toast.success { border-color: rgba(45,212,160,0.4); }
.toast.success i { color: var(--success); }
.toast.error { border-color: rgba(224,92,92,0.4); }
.toast.error i { color: var(--danger); }
.toast.fadeout { animation: toastOut 0.3s ease forwards; }
@keyframes toastOut {
  to { opacity:0; transform:translateX(20px); }
}

/* ---------- MODAL CONFIRM ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 9000; opacity: 0; visibility: hidden; transition: var(--trans);
}
.modal-backdrop.open { opacity: 1; visibility: visible; }
.modal {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 32px;
  max-width: 420px; width: 90%;
  box-shadow: 0 24px 60px rgba(0,0,0,0.6);
  transform: scale(0.95); transition: var(--trans);
}
.modal-backdrop.open .modal { transform: scale(1); }
.modal h3 { font-family: var(--font-head); font-size: 1.1rem; margin-bottom: 10px; }
.modal p { color: var(--text-2); font-size: 0.875rem; margin-bottom: 24px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ---------- OVERVIEW PANEL ---------- */
.overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px; margin-bottom: 24px;
}
.overview-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  display: flex; flex-direction: column; gap: 6px;
}
.overview-card .ov-icon {
  width: 38px; height: 38px; border-radius: 10px;
  background: linear-gradient(135deg, rgba(196,94,26,0.2), rgba(196,94,26,0.08));
  border: 1px solid rgba(196,94,26,0.2);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent); font-size: 0.95rem; margin-bottom: 4px;
}
.overview-card .ov-label { font-size: 0.72rem; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.8px; font-weight: 600; }
.overview-card .ov-value { font-family: var(--font-head); font-size: 1.4rem; font-weight: 700; color: var(--text); }
.overview-card .ov-sub { font-size: 0.75rem; color: var(--text-2); }

.quick-links { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- SCROLLBAR ---------- */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-hover); border-radius: 99px; }

/* ---------- SECTION SAVE BAR ---------- */
.save-bar {
  position: sticky; bottom: 0;
  background: linear-gradient(to top, var(--bg-panel) 80%, transparent);
  padding: 16px 0 4px;
  display: flex; gap: 10px; align-items: center;
  margin-top: 24px;
}

/* ---------- COLOR BADGE ---------- */
.role-badge-preview {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 99px;
  font-size: 0.72rem; font-weight: 600;
  background: rgba(196,94,26,0.15);
  color: var(--accent-l);
  border: 1px solid rgba(196,94,26,0.3);
}

/* ---------- ICON PICKER HINT ---------- */
.icon-hint {
  font-size: 0.7rem; color: var(--text-3); margin-top: 4px;
}
.icon-hint a { color: var(--accent); text-decoration: none; }
.icon-hint a:hover { text-decoration: underline; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 768px) {
  .sidebar { width: 220px; transform: translateX(-100%); transition: transform 0.3s ease; }
  .sidebar.open { transform: translateX(0); }
  .main-area { margin-left: 0; }
  .topbar { padding: 0 16px; }
  .panel-area { padding: 16px; }
}
}



/* --- MODAL --- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
}
.modal-content {
  background: var(--bg-base); border: 1px solid var(--border-light);
  border-radius: 12px; width: 100%; max-width: 500px; max-height: 90vh;
  display: flex; flex-direction: column;
}
.modal-header {
  padding: 16px 20px; border-bottom: 1px solid var(--border-light);
  display: flex; justify-content: space-between; align-items: center;
}
.modal-header h3 { font-size: 1.1rem; margin: 0; }
.btn-close { background: none; border: none; color: var(--text-2); font-size: 1.2rem; cursor: pointer; }
.btn-close:hover { color: var(--text-1); }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.shake {
  animation: shake 0.4s ease-in-out;
}

/* --- DRAG AND DROP REORDERING --- */
.dragging {
  opacity: 0.4;
  filter: grayscale(50%);
  outline: 2px dashed var(--accent);
}
.drag-handle {
  cursor: grab;
  color: var(--text-3);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  margin-right: 8px;
  font-size: 1.1rem;
}
.drag-handle:active {
  cursor: grabbing;
  color: var(--text-1);
}
