/* =====================================================
   admin.css — Shared styles for admin/manage pages
   Extracted from inline <style> blocks in:
   - admin-users.html
   - manage.html
   - admin-settings.html
   - forgot-password.html
   ===================================================== */

/* ===== Pagination (manage + admin-users) ===== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 1.5rem 0;
  flex-wrap: wrap;
}

.pagination button {
  padding: 8px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.pagination button:hover {
  background: rgba(229, 62, 62, 0.1);
  border-color: var(--primary);
  color: var(--text);
}

.pagination button.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 700;
}

.pagination button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.pagination .page-info {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 0 0.5rem;
}

/* ===== Edit Modal (manage) ===== */
.edit-modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 500;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.edit-modal-overlay.active { display: flex; }

.edit-modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.edit-modal h2 {
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.edit-modal-close {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

/* ===== Small Action Buttons (manage + admin-users) ===== */
.btn-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  white-space: nowrap;
  text-decoration: none;
}

.btn-view {
  background: rgba(72, 187, 120, 0.1);
  color: #68d391;
  border-color: rgba(72, 187, 120, 0.25);
}

.btn-view:hover {
  background: rgba(72, 187, 120, 0.2);
  border-color: #68d391;
  transform: translateY(-1px);
}

.btn-edit-action {
  background: rgba(214, 158, 46, 0.1);
  color: #ecc94b;
  border-color: rgba(214, 158, 46, 0.25);
}

.btn-edit-action:hover {
  background: rgba(214, 158, 46, 0.2);
  border-color: #ecc94b;
  transform: translateY(-1px);
}

.btn-link-action {
  background: rgba(49, 130, 206, 0.1);
  color: #63b3ed;
  border-color: rgba(49, 130, 206, 0.25);
}

.btn-link-action:hover {
  background: rgba(49, 130, 206, 0.2);
  border-color: #63b3ed;
  transform: translateY(-1px);
}

.btn-delete-action {
  background: rgba(229, 62, 62, 0.1);
  color: #fc8181;
  border-color: rgba(229, 62, 62, 0.25);
}

.btn-delete-action:hover {
  background: rgba(229, 62, 62, 0.2);
  border-color: #fc8181;
  transform: translateY(-1px);
}

/* ===== Admin Settings ===== */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 600px) {
  .settings-grid { grid-template-columns: 1fr; }
}

.preset-btn {
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
}

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

.preset-btn.active {
  border-color: var(--primary);
  background: rgba(229, 62, 62, 0.1);
  color: var(--primary);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
}

.status-badge.configured {
  background: rgba(72, 187, 120, 0.15);
  color: var(--success);
}

.status-badge.not-configured {
  background: rgba(237, 137, 54, 0.15);
  color: var(--warning);
}

/* ===== Forgot Password ===== */
.step { display: none; }
.step.active { display: block; }

.otp-inputs {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 1.5rem 0;
}

.otp-inputs input {
  width: 48px;
  height: 56px;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  background: var(--bg-input);
  border: 2px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  transition: border-color 0.2s;
}

.otp-inputs input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(229, 62, 62, 0.15);
}

.success-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  animation: bounceIn 0.6s;
}

@keyframes bounceIn {
  0% { transform: scale(0); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.resend-link {
  color: var(--text-muted);
  font-size: 0.9rem;
  cursor: pointer;
}

.resend-link:hover {
  color: var(--primary);
}

.timer {
  color: var(--warning);
  font-weight: 600;
}

/* ===== Admin Users Page ===== */
.admin-page {
  width: 100%;
  min-height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
}

.admin-header {
  width: 100%;
  padding: 1.5rem 2rem;
  background: linear-gradient(135deg, rgba(229, 62, 62, 0.06) 0%, rgba(26, 26, 46, 0.5) 100%);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.admin-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}

.admin-header .crown {
  filter: drop-shadow(0 0 6px rgba(214, 158, 46, 0.5));
}

.admin-stats {
  display: flex;
  gap: 1rem;
}

.stat-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.stat-chip strong {
  color: var(--primary);
  font-weight: 700;
}

.admin-split {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Left Panel - Users List */
.panel-users {
  width: 30%;
  min-width: 260px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  background: rgba(15, 15, 25, 0.5);
}

.panel-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.panel-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 600;
}

.panel-search {
  position: relative;
}

.panel-search input {
  width: 100%;
  padding: 9px 12px 9px 34px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.85rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.panel-search input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(229, 62, 62, 0.1);
}

.panel-search input::placeholder {
  color: var(--text-muted);
}

.panel-search .sicon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.8rem;
  pointer-events: none;
}

.user-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0;
}

.user-list::-webkit-scrollbar { width: 5px; }
.user-list::-webkit-scrollbar-track { background: transparent; }
.user-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }

.user-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem 1.25rem;
  cursor: pointer;
  transition: background 0.15s;
  border-left: 3px solid transparent;
}

.user-item:hover {
  background: rgba(229, 62, 62, 0.04);
}

.user-item.active {
  background: rgba(229, 62, 62, 0.08);
  border-left-color: var(--primary);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: #fff;
  flex-shrink: 0;
  text-transform: uppercase;
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-email {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex-shrink: 0;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.65rem;
  font-weight: 600;
  white-space: nowrap;
}

.role-admin {
  background: linear-gradient(135deg, rgba(214, 158, 46, 0.2), rgba(214, 158, 46, 0.08));
  color: var(--gold);
  border: 1px solid rgba(214, 158, 46, 0.25);
}

.role-user {
  background: rgba(72, 187, 120, 0.1);
  color: var(--success);
  border: 1px solid rgba(72, 187, 120, 0.2);
}

.album-count {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Right Panel - Albums */
.panel-albums {
  width: 70%;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.panel-albums .panel-header {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.panel-albums .panel-header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.selected-user-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.selected-user-role {
  font-size: 0.8rem;
}

.album-search {
  position: relative;
  min-width: 200px;
}

.album-search input {
  width: 100%;
  padding: 8px 12px 8px 32px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.83rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.album-search input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(229, 62, 62, 0.1);
}

.album-search input::placeholder {
  color: var(--text-muted);
}

.album-search .sicon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.78rem;
  pointer-events: none;
}

.album-grid-wrapper {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
}

.album-grid-wrapper::-webkit-scrollbar { width: 5px; }
.album-grid-wrapper::-webkit-scrollbar-track { background: transparent; }
.album-grid-wrapper::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }

.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

/* Admin-users album card override */
.admin-page .album-card {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.admin-page .album-card:hover {
  box-shadow: 0 4px 20px rgba(229, 62, 62, 0.1);
  transform: translateY(-2px);
}

.album-card-icon {
  font-size: 2rem;
  line-height: 1;
}

.album-card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.album-card-title a {
  color: var(--text);
  text-decoration: none;
  transition: color 0.2s;
}

.album-card-title a:hover {
  color: var(--primary);
}

.admin-page .album-card-meta {
  font-size: 0.78rem;
}

.album-card-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  background: rgba(229, 62, 62, 0.08);
  border: 1px solid rgba(229, 62, 62, 0.15);
  border-radius: 6px;
  font-size: 0.78rem;
  color: var(--primary);
  text-decoration: none;
  transition: all 0.2s;
  margin-top: 0.2rem;
  width: fit-content;
}

.album-card-link:hover {
  background: rgba(229, 62, 62, 0.15);
  border-color: var(--primary);
  text-decoration: none;
}

/* Panel empty/loading states */
.panel-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 3rem 2rem;
  text-align: center;
  color: var(--text-muted);
}

.panel-empty .icon {
  font-size: 3rem;
  margin-bottom: 0.75rem;
  filter: grayscale(0.4);
}

.panel-empty p {
  font-size: 0.95rem;
  line-height: 1.6;
  max-width: 320px;
}

.panel-empty a {
  color: var(--primary);
  font-weight: 600;
}

.admin-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 3rem;
  gap: 0.75rem;
}

.admin-loading .spinner {
  width: 40px;
  height: 40px;
}

.admin-loading p {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.no-results {
  padding: 2rem 1.25rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Admin-users Action Buttons */
.user-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.admin-page .btn-action {
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 0.8rem;
}

.btn-edit {
  background: rgba(49, 130, 206, 0.1);
  color: #63b3ed;
  border-color: rgba(49, 130, 206, 0.25);
}

.btn-edit:hover {
  background: rgba(49, 130, 206, 0.2);
  border-color: #63b3ed;
  transform: translateY(-1px);
}

.btn-delete {
  background: rgba(229, 62, 62, 0.1);
  color: #fc8181;
  border-color: rgba(229, 62, 62, 0.25);
}

.btn-delete:hover {
  background: rgba(229, 62, 62, 0.2);
  border-color: #fc8181;
  transform: translateY(-1px);
}

/* Admin-users Modal */
.admin-page .modal-overlay {
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.admin-page .modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.admin-page .modal {
  border-radius: 16px;
  width: 90%;
  max-width: 480px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  transform: scale(0.9) translateY(20px);
  transition: transform 0.3s ease;
}

.admin-page .modal-overlay.active .modal {
  transform: scale(1) translateY(0);
}

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

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}

.admin-page .modal-close {
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s;
}

.admin-page .modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.modal-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.admin-page .form-group label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.admin-page .form-group input {
  padding: 10px 14px;
}

.admin-page .form-group input::placeholder {
  font-size: 0.85rem;
}

.form-group .hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-style: italic;
}

.admin-page .form-group select {
  padding: 10px 14px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23a0aec0' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.admin-page .form-group select option {
  background: #1a1a2e;
  color: #e2e8f0;
}

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

.btn-modal {
  padding: 9px 20px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s;
}

.btn-cancel {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  border-color: var(--border);
}

.btn-cancel:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.btn-save {
  background: linear-gradient(135deg, #3182ce, #2b6cb0);
  color: #fff;
}

.btn-save:hover {
  background: linear-gradient(135deg, #4299e1, #3182ce);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(49, 130, 206, 0.3);
}

.btn-save:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Confirm Dialog */
.confirm-dialog .modal {
  max-width: 400px;
}

.confirm-message {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text);
  text-align: center;
  padding: 0.5rem 0;
}

.confirm-message strong {
  color: var(--primary);
}

.btn-confirm-delete {
  background: linear-gradient(135deg, #e53e3e, #c53030);
  color: #fff;
}

.btn-confirm-delete:hover {
  background: linear-gradient(135deg, #fc8181, #e53e3e);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(229, 62, 62, 0.3);
}

/* Admin-users album card actions */
.admin-page .album-card-actions .btn-action {
  font-size: 0.72rem;
  padding: 5px 10px;
}

/* Admin-users pagination override */
.admin-page .pagination {
  padding: 1rem 1.25rem;
}

.admin-page .pagination button {
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 6px;
  font-size: 0.8rem;
}

.admin-page .pagination .page-info {
  font-size: 0.75rem;
}

/* ===== Mobile Responsive (admin-users) ===== */
@media (max-width: 768px) {
  .admin-split {
    flex-direction: column;
  }

  .panel-users {
    width: 100%;
    min-width: unset;
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 45vh;
  }

  .panel-albums {
    width: 100%;
    min-height: 50vh;
  }

  .admin-header {
    padding: 1rem;
  }

  .admin-header h2 {
    font-size: 1.2rem;
  }

  .admin-stats {
    gap: 0.5rem;
  }

  .stat-chip {
    padding: 4px 10px;
    font-size: 0.72rem;
  }

  .album-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
  }

  .album-grid-wrapper {
    padding: 1rem;
  }

  .panel-albums .panel-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
  }

  .album-search {
    width: 100%;
    min-width: unset;
  }

  .user-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

@media (max-width: 480px) {
  .album-grid {
    grid-template-columns: 1fr;
  }

  .admin-stats {
    flex-wrap: wrap;
  }

  .admin-page .modal {
    width: 95%;
  }
}
