/* ==========================================================================
   ALCAPO DESIGNER — ADMIN DASHBOARD STYLES (Apple macOS / iOS Aesthetic)
   ========================================================================== */

:root {
  --bg-admin: #f4f5f9;
  --bg-card: #ffffff;
  --bg-input: #f8f9fc;
  --border-color: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.16);
  --brand-red: #e52528;
  --brand-red-hover: #d31e21;
  --brand-red-subtle: rgba(229, 37, 40, 0.08);
  --text-primary: #0b0b0e;
  --text-secondary: #525260;
  --text-muted: #8a8a9a;
  --accent-green: #30d158;
  --accent-blue: #0071e3;
  --shadow-card: 0 4px 18px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.09);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Plus Jakarta Sans", sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-admin);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
}

/* ==========================================================================
   LOGIN VIEW
   ========================================================================== */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.login-logo {
  height: 52px;
  margin: 0 auto 20px;
  object-fit: contain;
}

.login-title {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.login-subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 28px;
}

.form-group {
  margin-bottom: 18px;
  text-align: left;
}

.form-label {
  display: block;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  font-size: 0.95rem;
  color: var(--text-primary);
  outline: none;
  transition: all 0.2s ease;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--brand-red);
  background: #ffffff;
  box-shadow: 0 0 0 3px var(--brand-red-subtle);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background: var(--brand-red);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--brand-red-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: #ffffff;
  border-color: var(--border-strong);
}

.btn-whatsapp {
  background: #25d366;
  color: #ffffff;
}

.btn-whatsapp:hover {
  background: #20bd5a;
}

/* ==========================================================================
   ADMIN DASHBOARD VIEW
   ========================================================================== */
.admin-header {
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.admin-header-container {
  max-width: 1300px;
  margin: 0 auto;
  padding: 0 24px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-logo-img {
  height: 38px;
}

.admin-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--brand-red-subtle);
  color: var(--brand-red);
  text-transform: uppercase;
}

.admin-nav-tabs {
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
}

.admin-tabs-container {
  max-width: 1300px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
}

.admin-tab-btn {
  padding: 16px 20px;
  background: none;
  border: none;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

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

.admin-tab-btn.active {
  color: var(--brand-red);
  border-bottom-color: var(--brand-red);
}

.admin-main {
  max-width: 1300px;
  margin: 32px auto;
  padding: 0 24px;
}

.dashboard-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-card);
  margin-bottom: 28px;
}

.card-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.card-title {
  font-size: 1.3rem;
  font-weight: 700;
}

/* ==========================================================================
   SERVICES TABLE / CARDS IN ADMIN
   ========================================================================== */
.admin-services-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.admin-services-table th {
  padding: 12px 16px;
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
  border-bottom: 1px solid var(--border-color);
  background: #fafafc;
}

.admin-services-table td {
  padding: 14px 16px;
  font-size: 0.92rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.admin-services-table tr:hover td {
  background-color: rgba(0, 0, 0, 0.015);
}

.service-thumb {
  width: 58px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  display: block;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.actions-cell {
  display: flex;
  gap: 8px;
}

.btn-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-secondary);
}

.btn-icon:hover {
  background: #ffffff;
  color: var(--text-primary);
}

.btn-icon.delete:hover {
  background: #ff3b30;
  color: #ffffff;
  border-color: #ff3b30;
}

/* Category Grouped Sections in Admin */
.category-group-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
  transition: box-shadow 0.2s ease;
}

.category-group-card:hover {
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.06);
}

.category-group-header {
  padding: 14px 20px;
  background: #fbfbfd;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.category-group-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.category-group-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  border: 1px solid var(--border-color);
  background: #ffffff;
  color: var(--text-primary);
  text-decoration: none;
  transition: all 0.15s ease;
}

.btn-sm:hover {
  background: var(--bg-input);
  border-color: var(--border-strong);
}

.btn-sm.btn-rename:hover {
  border-color: var(--brand-red);
  color: var(--brand-red);
}

.btn-sm.btn-add-here {
  background: var(--brand-red-subtle);
  color: var(--brand-red);
  border-color: rgba(229, 37, 40, 0.2);
}

.btn-sm.btn-add-here:hover {
  background: var(--brand-red);
  color: #ffffff;
  border-color: var(--brand-red);
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.filter-search-box {
  flex-grow: 1;
  min-width: 240px;
  position: relative;
}

.filter-search-box input {
  padding-left: 38px;
}

.filter-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.filter-category-select {
  min-width: 200px;
}

.empty-category-row {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.88rem;
}

/* ==========================================================================
   INTERACTIVE IMAGE PICKER COMPONENT (Saved Gallery & Local Upload)
   ========================================================================== */
.image-picker-component {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-top: 6px;
}

.image-picker-row {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.image-preview-frame {
  width: 120px;
  height: 80px;
  border-radius: var(--radius-sm);
  background: #ffffff;
  border: 1px solid var(--border-color);
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.image-preview-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-picker-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn-picker {
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: #ffffff;
  color: var(--text-primary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-picker:hover {
  border-color: var(--brand-red);
  color: var(--brand-red);
  box-shadow: var(--shadow-card);
}

/* Gallery Modal Grid */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 14px;
  margin-top: 16px;
  max-height: 50vh;
  overflow-y: auto;
  padding: 4px;
}

.gallery-card-item {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  aspect-ratio: 4 / 3;
  background: var(--bg-input);
  transition: all 0.2s ease;
}

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

.gallery-card-item:hover {
  transform: scale(1.04);
  border-color: var(--brand-red);
  box-shadow: var(--shadow-card);
}

.gallery-card-item .gallery-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.7);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 6px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   SECURITY & 2FA STYLES
   ========================================================================== */
.twofa-status-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  background: var(--bg-input);
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  border: 1px solid var(--border-color);
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.status-dot.active {
  background: var(--accent-green);
}

.status-dot.inactive {
  background: #ff9500;
}

.qr-code-box {
  background: #ffffff;
  padding: 16px;
  border-radius: var(--radius-md);
  display: inline-block;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-card);
  margin: 16px 0;
}

.qr-code-box img {
  width: 180px;
  height: 180px;
}

.secret-key-display {
  font-family: monospace;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 10px 18px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  display: inline-block;
  user-select: all;
}

/* Modal Dialog */
.admin-modal {
  border: none;
  border-radius: var(--radius-lg);
  background: #ffffff;
  padding: 0;
  max-width: 650px;
  width: 90%;
  margin: auto;
  box-shadow: var(--shadow-lg);
}

.admin-modal::backdrop {
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
}

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

.modal-body {
  padding: 28px;
  max-height: 80vh;
  overflow-y: auto;
}
