/* ===== UPLOAD AREA ===== */
.upload-area {
  border: 2px dashed rgba(124,58,237,0.4);
  border-radius: 16px;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.upload-area:hover {
  border-color: rgba(124,58,237,0.8);
  background: rgba(124,58,237,0.05);
}

.upload-area i {
  font-size: 2.5rem;
  color: #a78bfa;
}

.upload-area p {
  font-size: 0.9rem;
  color: #e1e1f1;
  font-weight: 500;
}

.upload-hint {
  font-size: 0.75rem !important;
  color: #8787a3 !important;
  font-weight: 400 !important;
}

/* ===== RESET & BASE ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  font-family: "Outfit", sans-serif;
  background-color: #0d0d1f;
  color: #e1e1f1;
  overflow-x: hidden;
  max-width: 100vw;
}

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

button {
  font-family: "Outfit", sans-serif;
  cursor: pointer;
}

input, textarea, select {
  font-family: "Outfit", sans-serif;
}

.hidden {
  display: none !important;
}

/* ===== LOGIN PAGE ===== */
.login-page {
  min-height: 100vh;
  display: flex;
  position: relative;
  overflow: hidden;
  background: #0a0a1a;
}

/* Animated background blobs */
.login-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.login-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.2;
}

.lb-1 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, #7c3aed, transparent);
  top: -150px;
  left: -150px;
  animation: loginFloat 10s ease-in-out infinite;
}

.lb-2 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #0ea5e9, transparent);
  bottom: -100px;
  right: -100px;
  animation: loginFloat 12s ease-in-out infinite reverse;
}

.lb-3 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, #f59e0b, transparent);
  top: 40%;
  left: 40%;
  animation: loginFloat 8s ease-in-out infinite;
  opacity: 0.1;
}

@keyframes loginFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-40px) scale(1.08); }
}

/* Left panel */
.login-left {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 3rem 3.5rem;
  position: relative;
  z-index: 1;
  background: linear-gradient(135deg, rgba(124,58,237,0.15) 0%, rgba(14,165,233,0.08) 100%);
  border-right: 1px solid rgba(255,255,255,0.06);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 3rem;
}

.login-brand-logo {
  width: 3rem;
}

.login-brand-name {
  font-size: 1rem;
  font-weight: 700;
  color: #e1e1f1;
}

.login-brand-tag {
  font-size: 0.75rem;
  color: #8787a3;
}

.login-hero-text {
  margin-bottom: 2.5rem;
}

.login-hero-text h2 {
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1.2;
  background: linear-gradient(135deg, #e1e1f1 0%, #a78bfa 60%, #38bdf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 1rem;
}

.login-hero-text p {
  font-size: 0.95rem;
  color: #8787a3;
  line-height: 1.7;
  max-width: 340px;
}

.login-features {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.login-feature {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  font-size: 0.88rem;
  color: #a0a0c0;
}

.login-feature-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(124,58,237,0.2);
  border: 1px solid rgba(124,58,237,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1rem;
  color: #a78bfa;
}

/* Right panel */
.login-right {
  width: 480px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  position: relative;
  z-index: 1;
}

.login-card {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.login-card-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-avatar {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  background: linear-gradient(135deg, #7c3aed, #0ea5e9);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  color: white;
  margin: 0 auto 1.25rem;
  box-shadow: 0 8px 32px rgba(124,58,237,0.4);
}

.login-card h1 {
  font-size: 1.75rem;
  font-weight: 800;
  color: #e1e1f1;
  margin-bottom: 0.4rem;
}

.login-subtitle {
  font-size: 0.88rem;
  color: #8787a3;
}

.login-card form {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  margin-bottom: 1.5rem;
}

.login-error {
  color: #f87171;
  font-size: 0.82rem;
  min-height: 1.2rem;
  text-align: center;
  background: rgba(239,68,68,0.08);
  border-radius: 8px;
  padding: 0.4rem 0.75rem;
  display: none;
}

.login-error:not(:empty) {
  display: block;
}

/* Login button */
.btn-login {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.9rem;
  background: linear-gradient(135deg, #7c3aed, #0ea5e9);
  border: none;
  border-radius: 14px;
  color: white;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 20px rgba(124,58,237,0.35);
  margin-top: 0.5rem;
}

.btn-login:hover {
  opacity: 0.92;
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(124,58,237,0.5);
}

.btn-login:active {
  transform: translateY(0);
}

.btn-login:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.back-link {
  font-size: 0.82rem;
  color: #8787a3;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  transition: color 0.2s;
  margin-top: 1rem;
}

.back-link:hover {
  color: #a78bfa;
}

/* Responsive: mobile stacks vertically */
@media (max-width: 768px) {
  .login-left {
    display: none;
  }

  .login-right {
    width: 100%;
    padding: 1.5rem;
  }
}

/* ===== FORM ELEMENTS ===== */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #a0a0c0;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrapper > i:first-child {
  position: absolute;
  left: 0.85rem;
  color: #8787a3;
  font-size: 1rem;
  pointer-events: none;
  z-index: 1;
}

.input-wrapper input {
  width: 100%;
  /* Override general input padding — tambahkan ruang untuk icon di kiri */
  padding: 0.7rem 0.9rem 0.7rem 2.5rem !important;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  color: #e1e1f1;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}

.input-wrapper input:focus {
  border-color: rgba(124,58,237,0.6);
  background: rgba(124,58,237,0.08);
}

.toggle-pw {
  position: absolute;
  right: 0.75rem;
  background: none;
  border: none;
  color: #8787a3;
  font-size: 1rem;
  padding: 0.25rem;
  transition: color 0.2s;
}

.toggle-pw:hover {
  color: #e1e1f1;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="url"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 0.7rem 0.9rem;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  color: #e1e1f1;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
  resize: vertical;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="url"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
  border-color: rgba(124,58,237,0.6);
  background: rgba(124,58,237,0.08);
}

input::placeholder,
textarea::placeholder {
  color: #4a4a6a;
}

/* ===== BUTTONS ===== */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.4rem;
  background: linear-gradient(135deg, #7c3aed, #0ea5e9);
  border: none;
  border-radius: 12px;
  color: white;
  font-size: 0.9rem;
  font-weight: 600;
  transition: opacity 0.2s, transform 0.2s;
}

.btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-primary.btn-full {
  width: 100%;
  justify-content: center;
  padding: 0.85rem;
  font-size: 1rem;
  margin-top: 0.5rem;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  color: #e1e1f1;
  font-size: 0.85rem;
  font-weight: 500;
  transition: background 0.2s, border-color 0.2s;
}

.btn-secondary:hover {
  background: rgba(124,58,237,0.15);
  border-color: rgba(124,58,237,0.4);
}

.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  background: rgba(239,68,68,0.15);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: 10px;
  color: #f87171;
  font-size: 0.8rem;
  font-weight: 500;
  transition: background 0.2s;
}

.btn-danger:hover {
  background: rgba(239,68,68,0.25);
}

.btn-logout {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.7rem 1rem;
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.2);
  border-radius: 12px;
  color: #f87171;
  font-size: 0.88rem;
  font-weight: 600;
  transition: background 0.2s;
}

.btn-logout:hover {
  background: rgba(239,68,68,0.2);
}

.btn-preview {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  color: #e1e1f1;
  font-size: 0.82rem;
  font-weight: 500;
  transition: background 0.2s;
  white-space: nowrap;
}

.btn-preview:hover {
  background: rgba(124,58,237,0.15);
}

/* Topbar logout button (visible on mobile) */
.btn-topbar-logout {
  display: none; /* Hidden on desktop — use sidebar logout */
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(239,68,68,0.15);
  border: 1px solid rgba(239,68,68,0.3);
  color: #f87171;
  font-size: 1.1rem;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}

.btn-topbar-logout:hover {
  background: rgba(239,68,68,0.25);
}

/* Back to top button for admin */
#admin-back-to-top {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 100;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed, #0ea5e9);
  border: none;
  color: white;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(124,58,237,0.4);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
}

#admin-back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

#admin-back-to-top:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(124,58,237,0.6);
}

/* ===== ADMIN LAYOUT ===== */
.admin-page {
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
  max-width: 100vw;
}

/* Sidebar */
.sidebar {
  width: 260px;
  min-height: 100vh;
  background: #0f0f24; /* Solid dark background agar tidak transparan */
  border-right: 1px solid rgba(255,255,255,0.1);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 50;
  transition: transform 0.3s ease;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.sidebar-logo {
  width: 2.2rem;
  flex-shrink: 0;
}

.sidebar-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: #e1e1f1;
}

.sidebar-sub {
  font-size: 0.72rem;
  color: #8787a3;
}

.sidebar-close {
  display: none;
  margin-left: auto;
  background: none;
  border: none;
  color: #8787a3;
  font-size: 1.2rem;
  padding: 0.25rem;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.85rem;
  border-radius: 12px;
  background: none;
  border: none;
  color: #8787a3;
  font-size: 0.88rem;
  font-weight: 500;
  text-align: left;
  transition: background 0.2s, color 0.2s;
  width: 100%;
}

.nav-item:hover {
  background: rgba(255,255,255,0.05);
  color: #e1e1f1;
}

.nav-item.active {
  background: rgba(124,58,237,0.2);
  color: #a78bfa;
}

.nav-item i {
  font-size: 1rem;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 1rem 0.75rem;
  border-top: 1px solid rgba(255,255,255,0.07);
}

/* Main Content */
.admin-main {
  flex: 1;
  margin-left: 260px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
  min-width: 0; /* Penting untuk flex child agar tidak overflow */
}

.admin-topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  background: rgba(255,255,255,0.02);
  position: sticky;
  top: 0;
  z-index: 10;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: #e1e1f1;
  font-size: 1.4rem;
  padding: 0.25rem;
}

.admin-topbar h2 {
  flex: 1;
  font-size: 1.1rem;
  font-weight: 700;
}

/* Tab Content */
.tab-content {
  padding: 1.5rem;
  flex: 1;
  overflow-x: hidden;
  min-width: 0;
}

.section-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow: visible; /* Jangan hidden — bisa memblokir klik pada tombol */
  width: 100%;
  box-sizing: border-box;
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #e1e1f1;
}

.card-title i {
  color: #a78bfa;
}

.card-desc {
  font-size: 0.82rem;
  color: #8787a3;
  line-height: 1.6;
}

.sub-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: #a0a0c0;
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-grid-3 {
  grid-template-columns: 1fr 1fr 1fr;
}

.action-row {
  display: flex;
  justify-content: flex-end;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(255,255,255,0.06);
}

/* ===== DYNAMIC LIST ITEMS ===== */
.list-item {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.list-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.list-item-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: #a0a0c0;
}

.list-item-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

/* Gallery Preview */
.gallery-preview {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  margin-top: 0.5rem;
}

.gallery-preview-placeholder {
  width: 100%;
  height: 80px;
  border-radius: 10px;
  border: 1px dashed rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #4a4a6a;
  font-size: 0.8rem;
  margin-top: 0.5rem;
}

/* Stars selector */
.stars-selector {
  display: flex;
  gap: 0.4rem;
}

.stars-selector button {
  background: none;
  border: none;
  font-size: 1.2rem;
  color: #4a4a6a;
  transition: color 0.15s;
  padding: 0;
}

.stars-selector button.active {
  color: #f59e0b;
}

/* ===== PASSWORD MESSAGE ===== */
.pw-msg {
  font-size: 0.82rem;
  min-height: 1.2rem;
}

.pw-msg.success {
  color: #4ade80;
}

.pw-msg.error {
  color: #f87171;
}

/* ===== TOAST ===== */
#admin-toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.admin-toast-item {
  background: #1e1e3a;
  border: 1px solid rgba(255,255,255,0.12);
  color: #e1e1f1;
  padding: 0.7rem 1.25rem;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: toastIn 0.3s ease;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.admin-toast-item.success {
  border-color: rgba(74,222,128,0.3);
  color: #4ade80;
}

.admin-toast-item.error {
  border-color: rgba(248,113,113,0.3);
  color: #f87171;
}

.admin-toast-item.fade-out {
  animation: toastOut 0.4s ease forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toastOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* ===== SIDEBAR OVERLAY (mobile) ===== */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 40;
}

.sidebar-overlay.active {
  display: block;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  /* Sidebar: slide dari kiri */
  .sidebar {
    transform: translateX(-100%);
    width: 280px;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 20px rgba(0,0,0,0.5);
  }

  .sidebar-close {
    display: block;
  }

  /* Main content: full width */
  .admin-main {
    margin-left: 0;
    width: 100%;
    overflow-x: hidden;
  }

  /* Show topbar logout on mobile */
  .btn-topbar-logout {
    display: flex;
  }

  /* Topbar: hamburger visible, padding lebih kecil */
  .menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
  }

  .admin-topbar {
    padding: 0.75rem 1rem;
    position: sticky;
    top: 0;
    z-index: 10;
    gap: 0.75rem;
  }

  .admin-topbar h2 {
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .btn-preview {
    padding: 0.45rem 0.75rem;
    font-size: 0.78rem;
    flex-shrink: 0;
  }

  /* Tab content */
  .tab-content {
    padding: 0.85rem;
  }

  /* Section card: full width */
  .section-card {
    padding: 1rem;
    border-radius: 16px;
    overflow: visible;
    width: 100%;
    box-sizing: border-box;
  }

  /* Form grids: single column */
  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-grid-3 {
    grid-template-columns: 1fr;
  }

  .list-item-grid {
    grid-template-columns: 1fr;
  }

  /* Input fields: full width */
  input[type="text"],
  input[type="password"],
  input[type="email"],
  input[type="url"],
  input[type="number"],
  textarea {
    font-size: 16px; /* Prevent iOS zoom on focus */
  }
}

@media (max-width: 480px) {
  .section-card {
    padding: 0.85rem;
    border-radius: 14px;
  }

  .tab-content {
    padding: 0.65rem;
  }

  .list-item {
    padding: 0.8rem;
  }

  .admin-topbar {
    padding: 0.65rem 0.75rem;
  }

  /* Login page mobile */
  .login-card {
    padding: 0 0.25rem;
  }

  .login-card h1 {
    font-size: 1.5rem;
  }

  .login-avatar {
    width: 54px;
    height: 54px;
    font-size: 1.5rem;
  }
}
