/* ================================================================== */
/*  Admin Portal – Styles                                              */
/*  Follows the same visual language as the Mailand Manual app         */
/* ================================================================== */

/* ── Page wrapper ── */
.admin-portal {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: "Atlas Grotesk", Helvetica, Arial, sans-serif;
}

.admin-portal .app {
  position: sticky;
  top: 0;
  z-index: 2;
  width: 100%;
  background: var(--white);
  border-radius: 0 0 16px 16px;
  box-shadow: var(--header-shadow);
}

.admin-portal .container {
  width: 480px;
  max-width: calc(100% - 32px);
  margin: 0 auto;
  padding: 0 0 10px;
}

.admin-portal .container-2 {
  position: relative;
  height: 112px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.admin-portal .button {
  position: absolute;
  left: calc(50% - 152px);
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--green);
  font-family: "Atlas Grotesk", Helvetica, Arial, sans-serif;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 0;
}

.admin-portal .icon {
  width: 16px;
  height: 16px;
}

.admin-portal .text-wrapper-2 {
  font-size: 14px;
  line-height: 1;
  letter-spacing: 0.28px;
}

.admin-portal .frame {
  width: 64px;
  height: auto;
}

.admin-portal .subpage {
  position: relative;
  margin-top: 0;
  border-left-color: transparent !important;
  padding-left: 17px;
}

.admin-portal .subpage::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  border-radius: 999px;
  background: var(--green);
}

.admin-portal .page-title {
  margin: 0;
  font-family: "Atlas Grotesk", Helvetica, Arial, sans-serif;
  font-size: var(--header);
  font-weight: 700;
  letter-spacing: 0.32px;
  line-height: 24px;
}

/* ── Content area ── */
.admin-content {
  width: 480px;
  max-width: calc(100% - 32px);
  margin: 0 auto;
  padding: 20px 0 40px;
}

/* ── Day Tabs ── */
.admin-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.admin-tab {
  flex: 1;
  min-width: 0;
  height: 47px;
  border: 1px solid var(--text);
  border-radius: 12px;
  background: var(--white);
  color: var(--text);
  font-family: "Atlas Grotesk", Helvetica, Arial, sans-serif;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.28px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.admin-tab:hover {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}

.admin-tab.active {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}

.admin-day-title {
  margin: 0 0 20px;
  font-family: "Atlas Grotesk", Helvetica, Arial, sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.28px;
  line-height: 21px;
  color: var(--muted);
  text-align: center;
}

/* ── Container Cards (admin list) ── */
.admin-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
  min-height: 60px;
}

.admin-card {
  background: var(--white);
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: adminFadeIn 0.25s ease;
}

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

.admin-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-card-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 6px;
  line-height: 1.2;
  white-space: nowrap;
}

.admin-card-badge--standard {
  background: #e8e8e8;
  color: #333;
}

.admin-card-badge--info {
  background: #d4f5e2;
  color: #005a24;
}

.admin-card-badge--alert {
  background: #1a1a1a;
  color: #fff;
}

body.dark-mode .admin-card-badge--standard {
  background: #3a3a3a;
  color: #ccc;
}

body.dark-mode .admin-card-badge--info {
  background: #0a3d1c;
  color: #7aefa4;
}

body.dark-mode .admin-card-badge--alert {
  background: #ffffff;
  color: #000;
}

.admin-card-time {
  font-size: 13px;
  font-weight: 700;
  color: var(--green);
}

.admin-card-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.admin-card-title {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
}

.admin-card-desc {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Card actions ── */
.admin-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid rgba(0, 0, 0, 0.07);
}

body.dark-mode .admin-card-actions {
  border-top-color: rgba(255, 255, 255, 0.1);
}

.admin-action-btn {
  border: 0;
  border-radius: 8px;
  padding: 6px 10px;
  font-family: "Atlas Grotesk", Helvetica, Arial, sans-serif;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  background: #f0f0f0;
  color: var(--text);
  line-height: 1;
}

body.dark-mode .admin-action-btn {
  background: #2a2a2a;
  color: #ddd;
}

.admin-action-btn:hover {
  background: #ddd;
}

body.dark-mode .admin-action-btn:hover {
  background: #3d3d3d;
}

.admin-action-btn--edit {
  background: var(--green);
  color: #fff;
}

.admin-action-btn--edit:hover {
  background: #006d2e;
}

.admin-action-btn--delete {
  background: transparent;
  color: #c62828;
  margin-left: auto;
}

.admin-action-btn--delete:hover {
  background: #fdecea;
}

body.dark-mode .admin-action-btn--delete {
  color: #ef9a9a;
  background: transparent;
}

body.dark-mode .admin-action-btn--delete:hover {
  background: #3a1a1a;
}

/* ── Add button ── */
.admin-add-btn {
  width: 100%;
  min-height: 56px;
  border: 2px dashed var(--green);
  border-radius: 16px;
  background: transparent;
  color: var(--green);
  font-family: "Atlas Grotesk", Helvetica, Arial, sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.28px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.2s, color 0.2s;
  margin-bottom: 16px;
}

.admin-add-btn:hover {
  background: var(--green);
  color: #fff;
}

.admin-add-icon {
  font-size: 20px;
  line-height: 1;
}

/* ── Reset button ── */
.admin-reset-btn {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--muted);
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-family: "Atlas Grotesk", Helvetica, Arial, sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.admin-reset-btn:hover {
  border-color: #c62828;
  color: #c62828;
}

/* ================================================================== */
/*  Modal / Overlay                                                    */
/* ================================================================== */
.admin-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.admin-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

/* ── Edit / Add modal ── */
.admin-modal {
  width: 100%;
  max-width: 520px;
  max-height: 92vh;
  background: var(--white);
  border-radius: 24px 24px 0 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.admin-overlay.open .admin-modal {
  transform: translateY(0);
}

.admin-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

body.dark-mode .admin-modal-head {
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

.admin-modal-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.admin-modal-close {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: #f0f0f0;
  color: var(--text);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

body.dark-mode .admin-modal-close {
  background: #2a2a2a;
}

.admin-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px 8px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.admin-modal-foot {
  display: flex;
  gap: 10px;
  padding: 12px 20px 20px;
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
}

/* ── Form fields ── */
.admin-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.admin-field.hidden {
  display: none;
}

.admin-field label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: var(--muted);
}

.admin-hint {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

.admin-field select,
.admin-field input,
.admin-field textarea {
  width: 100%;
  border: 1.5px solid #d0d0d0;
  border-radius: 10px;
  padding: 10px 12px;
  font-family: "Atlas Grotesk", Helvetica, Arial, sans-serif;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.45;
  color: var(--text);
  background: var(--white);
  transition: border-color 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

.admin-field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23888' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

body.dark-mode .admin-field select,
body.dark-mode .admin-field input,
body.dark-mode .admin-field textarea {
  border-color: #444;
}

.admin-field select:focus,
.admin-field input:focus,
.admin-field textarea:focus {
  outline: none;
  border-color: var(--green);
}

.admin-field textarea {
  resize: vertical;
  min-height: 80px;
}

/* ── Preview ── */
.admin-preview-wrap {
  margin-top: 4px;
}

.admin-preview-label {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: var(--muted);
}

.admin-preview {
  border: 1.5px solid #d0d0d0;
  border-radius: 12px;
  padding: 10px 12px;
  min-height: 40px;
  transition: border-color 0.2s;
}

body.dark-mode .admin-preview {
  border-color: #444;
}

/* Preview container styles (reuse app classes) */
.admin-preview .prev-card {
  background: var(--white);
  border-radius: 12px;
  padding: 10px 12px;
}

.admin-preview .prev-line {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  line-height: 21px;
}

.admin-preview .prev-time {
  color: var(--green);
}

.admin-preview .prev-detail {
  margin: 6px 0 0;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.45;
  color: #6f6f6f;
}

.admin-preview .prev-info {
  border: 2px solid var(--green);
  border-radius: 12px;
  padding: 10px 14px;
}

.admin-preview .prev-info-text {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.45;
}

.admin-preview .prev-info-text::before {
  content: "\2139\fe0f\00a0";
}

.admin-preview .prev-alert {
  border: 2px solid var(--green);
  border-radius: 12px;
  background: #000;
  color: #fff;
  padding: 10px 14px;
}

body.dark-mode .admin-preview .prev-alert {
  background: #fff;
  color: #000;
}

.admin-preview .prev-alert-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  line-height: 21px;
}

.admin-preview .prev-alert-text {
  margin: 6px 0 0;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.45;
}

/* ── Buttons ── */
.admin-btn {
  flex: 1;
  min-height: 46px;
  border: 0;
  border-radius: 12px;
  font-family: "Atlas Grotesk", Helvetica, Arial, sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.28px;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}

.admin-btn--cancel {
  background: #f0f0f0;
  color: var(--text);
}

body.dark-mode .admin-btn--cancel {
  background: #2a2a2a;
  color: #ddd;
}

.admin-btn--cancel:hover {
  background: #e0e0e0;
}

body.dark-mode .admin-btn--cancel:hover {
  background: #3a3a3a;
}

.admin-btn--save {
  background: var(--green);
  color: #fff;
}

.admin-btn--save:hover {
  background: #006d2e;
}

.admin-btn--delete {
  background: #c62828;
  color: #fff;
}

.admin-btn--delete:hover {
  background: #a01010;
}

/* ── Confirm dialog ── */
.admin-confirm {
  width: calc(100% - 40px);
  max-width: 360px;
  background: var(--white);
  border-radius: 20px;
  padding: 24px 20px 20px;
  text-align: center;
  transform: scale(0.9);
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  align-self: center;
}

.admin-overlay.open .admin-confirm {
  transform: scale(1);
}

.admin-confirm p {
  margin: 0 0 18px;
  font-size: 15px;
  font-weight: 700;
}

.admin-confirm-actions {
  display: flex;
  gap: 10px;
}

/* ── Toast ── */
.admin-toast {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  z-index: 200;
  background: #1a1a1a;
  color: #fff;
  font-family: "Atlas Grotesk", Helvetica, Arial, sans-serif;
  font-size: 13px;
  font-weight: 700;
  padding: 12px 20px;
  border-radius: 12px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.35s ease;
}

body.dark-mode .admin-toast {
  background: #fff;
  color: #000;
}

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

/* ── Empty state ── */
.admin-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 400;
}

/* ── Export / Import row ── */
.admin-io-row {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.admin-io-btn {
  flex: 1;
  min-height: 46px;
  border: 1.5px solid var(--green);
  border-radius: 12px;
  background: transparent;
  color: var(--green);
  font-family: "Atlas Grotesk", Helvetica, Arial, sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.2px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.2s, color 0.2s;
}

.admin-io-btn:hover,
.admin-io-btn:focus-within {
  background: var(--green);
  color: #fff;
}

.admin-io-icon {
  font-size: 16px;
  line-height: 1;
}

/* ================================================================== */
/*  Responsive                                                         */
/* ================================================================== */
@media (max-width: 620px) {
  .admin-portal .button {
    left: 12px;
  }

  .admin-content {
    width: 100%;
    padding-left: 16px;
    padding-right: 16px;
  }

  .admin-modal {
    max-height: 95vh;
    border-radius: 20px 20px 0 0;
  }

  .admin-card {
    padding: 12px 14px;
  }
}

@media (min-width: 621px) {
  .admin-overlay {
    align-items: center;
  }

  .admin-modal {
    border-radius: 24px;
    max-height: 85vh;
    transform: translateY(40px);
  }

  .admin-overlay.open .admin-modal {
    transform: translateY(0);
  }

  .admin-modal-foot {
    padding-bottom: 20px;
  }
}

/* ================================================================== */
/*  Login Gate                                                         */
/* ================================================================== */
.admin-login-gate {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.admin-login-gate.hidden {
  display: none;
}

.admin-login-card {
  width: 100%;
  max-width: 360px;
  background: var(--white);
  border-radius: 24px;
  padding: 40px 28px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.10);
  animation: adminLoginIn 0.4s ease;
}

@keyframes adminLoginIn {
  from { opacity: 0; transform: scale(0.95) translateY(12px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.admin-login-logo {
  width: 56px;
  height: auto;
  margin-bottom: 8px;
}

.admin-login-title {
  margin: 0;
  font-family: "Atlas Grotesk", Helvetica, Arial, sans-serif;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.4px;
  line-height: 1.3;
}

.admin-login-subtitle {
  margin: 0 0 14px;
  font-family: "Atlas Grotesk", Helvetica, Arial, sans-serif;
  font-size: 13px;
  color: var(--muted);
}

.admin-login-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin-login-field {
  width: 100%;
}

.admin-login-input {
  width: 100%;
  border: 1.5px solid #d0d0d0;
  border-radius: 12px;
  padding: 12px 14px;
  font-family: "Atlas Grotesk", Helvetica, Arial, sans-serif;
  font-size: 15px;
  font-weight: 400;
  color: var(--text);
  background: var(--white);
  transition: border-color 0.2s;
  -webkit-appearance: none;
  appearance: none;
  text-align: center;
}

body.dark-mode .admin-login-input {
  border-color: #444;
}

.admin-login-input:focus {
  outline: none;
  border-color: var(--green);
}

.admin-login-input.shake {
  animation: adminShake 0.4s ease;
}

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

.admin-login-error {
  margin: 0;
  font-family: "Atlas Grotesk", Helvetica, Arial, sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: #c62828;
  text-align: center;
  opacity: 0;
  height: 0;
  overflow: hidden;
  transition: opacity 0.2s, height 0.2s;
}

.admin-login-error.visible {
  opacity: 1;
  height: 20px;
}

.admin-login-btn {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 12px;
  background: var(--green);
  color: #fff;
  font-family: "Atlas Grotesk", Helvetica, Arial, sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.28px;
  cursor: pointer;
  transition: background 0.2s;
}

.admin-login-btn:hover {
  background: #006d2e;
}

.admin-login-back {
  margin-top: 12px;
  font-family: "Atlas Grotesk", Helvetica, Arial, sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--green);
  text-decoration: none;
}

.admin-login-back:hover {
  text-decoration: underline;
}
