* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #1a3a5c;
  --primary-dark: #0f2a3f;
  --secondary: #e8a817;
  --secondary-hover: #f0b922;
  --light: #f4f7fc;
  --white: #fff;
  --text: #333;
  --text-light: #666;
  --border: #dde3ec;
  --danger: #dc3545;
  --success: #1e8e3e;
  --shadow: 0 4px 20px rgba(0,0,0,.08);
}

body {
  font-family: 'Poppins', system-ui, sans-serif;
  background: var(--light);
  color: var(--text);
  line-height: 1.5;
}

.hidden { display: none !important; }

/* Login */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
}

.login-card {
  width: 100%;
  max-width: 420px;
  padding: 2.5rem 2rem;
  text-align: center;
  background: var(--white);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}

.login-icon {
  font-size: 3rem;
  color: var(--secondary);
  margin-bottom: .5rem;
}

.login-card h1 {
  font-size: 1.4rem;
  color: var(--primary);
  margin-bottom: .2rem;
}

.login-card > p {
  color: var(--text-light);
  font-size: .9rem;
  margin-bottom: 1.8rem;
}

/* Form */
.form-group {
  margin-bottom: 1rem;
  text-align: left;
}

.form-group label {
  display: block;
  margin-bottom: .35rem;
  font-size: .85rem;
  font-weight: 500;
  color: var(--text);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: .8rem 1rem;
  font-family: inherit;
  font-size: .95rem;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: border-color .2s, box-shadow .2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px rgba(232,168,23,.18);
}

.form-group textarea {
  resize: vertical;
  min-height: 90px;
}

/* Input error state */
.form-group input.error,
.form-group textarea.error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.15);
  animation: shake 0.4s;
}

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

.help-text {
  font-size: .78rem;
  color: var(--text-light);
  margin-top: .3rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: .8rem 1.6rem;
  font-family: inherit;
  font-size: .9rem;
  font-weight: 600;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: all .2s;
}

.btn-primary {
  color: var(--primary-dark);
  background: var(--secondary);
}
.btn-primary:hover { background: var(--secondary-hover); transform: translateY(-2px); }

.btn-secondary {
  color: var(--text);
  background: #e8ecf1;
}
.btn-secondary:hover { background: #d8dde4; }

.btn-login {
  width: 100%;
  color: var(--white);
  background: var(--primary);
}
.btn-login:hover { background: var(--primary-dark); }
.btn-login:disabled { opacity: .7; cursor: not-allowed; }

.btn-danger {
  color: var(--white);
  background: var(--danger);
}
.btn-danger:hover { background: #b02a37; }

.login-error {
  margin-top: .8rem;
  color: var(--danger);
  font-size: .85rem;
  min-height: 1.2em;
  font-weight: 500;
}

.login-error:not(:empty) {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.back-link {
  display: inline-block;
  margin-top: 1.5rem;
  font-size: .85rem;
  color: var(--text-light);
  text-decoration: none;
}
.back-link:hover { color: var(--primary); }

/* Password wrapper dengan tombol mata */
.password-wrapper {
  position: relative;
  display: block;
}

.password-wrapper input {
  padding-right: 3rem;
}

.toggle-password {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
  font-size: 1rem;
}

.toggle-password:hover {
  color: var(--primary);
  background: rgba(26, 58, 92, 0.06);
}

.toggle-password:focus-visible {
  outline: 2px solid var(--secondary);
  outline-offset: 2px;
}

.toggle-password.is-visible {
  color: var(--primary);
}

/* Header dashboard */
.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .9rem 1.5rem;
  color: var(--white);
  background: var(--primary);
  box-shadow: 0 2px 10px rgba(0,0,0,.1);
}

.admin-header-left {
  display: flex;
  align-items: center;
  gap: .9rem;
}

.admin-header-left i {
  font-size: 1.8rem;
  color: var(--secondary);
}

.admin-header-left strong {
  display: block;
  font-size: 1rem;
}

.admin-header-left small {
  font-size: .75rem;
  opacity: .8;
}

.admin-header-right {
  display: flex;
  align-items: center;
  gap: .6rem;
}

.admin-email {
  font-size: .85rem;
  opacity: .85;
  display: none;
}

@media (min-width: 600px) {
  .admin-email { display: inline; }
}

.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  color: var(--white);
  background: rgba(255,255,255,.1);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  text-decoration: none;
  transition: all .2s;
}
.btn-icon:hover { background: rgba(255,255,255,.25); }
.btn-logout:hover { background: var(--danger); }

/* Tabs */
.admin-tabs {
  display: flex;
  gap: 4px;
  padding: 0 1rem;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.tab-btn {
  padding: .9rem 1.2rem;
  font-family: inherit;
  font-size: .9rem;
  font-weight: 500;
  color: var(--text-light);
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: all .2s;
}

.tab-btn:hover { color: var(--primary); }

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--secondary);
}

/* Layout utama */
.admin-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.2rem;
}

.tab-content { display: none; }
.tab-content.active { display: block; }

.tab-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.tab-header h2 {
  font-size: 1.4rem;
  color: var(--primary);
}

.tab-header p {
  font-size: .9rem;
  color: var(--text-light);
  margin-top: .2rem;
}

/* Item list */
.items-list {
  display: grid;
  gap: 1rem;
}

.item-card {
  display: flex;
  gap: 1rem;
  padding: 1rem;
  background: var(--white);
  border-radius: 12px;
  box-shadow: var(--shadow);
  transition: transform .2s;
}

.item-card:hover { transform: translateY(-2px); }

.item-thumb {
  flex-shrink: 0;
  width: 80px;
  height: 80px;
  overflow: hidden;
  background: #eaeef4;
  border-radius: 8px;
}

.item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.item-thumb .icon-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-size: 2rem;
  color: var(--secondary);
}

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

.item-body h4 {
  font-size: 1rem;
  color: var(--primary);
  margin-bottom: .3rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-body p {
  font-size: .85rem;
  color: var(--text-light);
  margin-bottom: .4rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.item-tag {
  display: inline-block;
  padding: .15rem .7rem;
  font-size: .7rem;
  font-weight: 600;
  color: var(--primary-dark);
  background: var(--secondary);
  border-radius: 50px;
}

.item-actions {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  justify-content: center;
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  color: var(--text-light);
  background: var(--light);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all .2s;
}

.icon-btn:hover { color: var(--white); background: var(--primary); }
.icon-btn.danger:hover { background: var(--danger); }

.empty-state {
  padding: 3rem 1rem;
  text-align: center;
  color: var(--text-light);
  background: var(--white);
  border-radius: 12px;
  border: 2px dashed var(--border);
}

.empty-state i {
  font-size: 2rem;
  margin-bottom: .5rem;
  display: block;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(15,42,63,.7);
  backdrop-filter: blur(4px);
}

.modal.active { display: flex; }

.modal-content {
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--white);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}

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

.modal-header h3 {
  font-size: 1.1rem;
  color: var(--primary);
}

.btn-close {
  width: 34px;
  height: 34px;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--text-light);
  background: transparent;
  border: none;
  border-radius: 50%;
  cursor: pointer;
}
.btn-close:hover { background: var(--light); color: var(--danger); }

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  display: flex;
  gap: .6rem;
  justify-content: flex-end;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
}

/* Toast dengan ikon — posisi di atas */
.toast {
  position: fixed;
  top: 20px;                            /* ← Toast muncul di atas */
  left: 50%;
  display: flex;
  align-items: center;
  gap: .6rem;
  max-width: calc(100vw - 40px);
  padding: .9rem 1.4rem;
  font-size: .9rem;
  font-weight: 500;
  color: var(--white);
  background: var(--primary-dark);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,.3);
  opacity: 0;
  z-index: 2000;
  pointer-events: none;
  transform: translateX(-50%) translateY(-100px);   /* ← Animasi turun dari atas */
  transition: all .3s;
}

.toast i {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }
.toast.info    { background: var(--primary); }

/* Responsive */
@media (max-width: 600px) {
  .item-card { flex-direction: column; }
  .item-thumb { width: 100%; height: 140px; }
  .item-actions { flex-direction: row; }
  .admin-header-left small { display: none; }
  .tab-btn { padding: .8rem .9rem; font-size: .85rem; }
  .tab-btn i { display: none; }

  /* Geser toast sedikit ke bawah supaya tidak menutupi header admin */
  .toast {
    top: 70px;
  }
}