/* ==========================================================
   ADMIN DASHBOARD STYLING
   ========================================================== */

:root {
  --admin-bg: #faf4f6;
  --panel-bg: #ffffff;
  --rose-primary: #c54a6f;
  --rose-dark: #78263f;
  --rose-light: #ffdce5;
  --rose-border: #f2c2cf;
  --text-main: #3d262d;
  --text-muted: #82636c;
  --success: #28a745;
  --danger: #dc3545;
  --radius: 14px;
  --shadow: 0 4px 20px rgba(120, 38, 63, 0.08);
}

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

body {
  background-color: var(--admin-bg);
  font-family: 'Tajawal', sans-serif;
  color: var(--text-main);
  direction: rtl;
  min-height: 100vh;
}

/* ==========================================================
   1. LOGIN SCREEN
   ========================================================== */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: 
    radial-gradient(circle at 15% 15%, rgba(255, 215, 225, 0.6), transparent 50%),
    radial-gradient(circle at 85% 85%, rgba(255, 200, 215, 0.5), transparent 50%),
    var(--admin-bg);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--panel-bg);
  border-radius: 20px;
  padding: 36px 28px;
  text-align: center;
  box-shadow: 0 10px 35px rgba(120, 38, 63, 0.15);
  border: 1.5px solid var(--rose-border);
}

.login-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
}

.login-card h2 {
  font-size: 1.4rem;
  color: var(--rose-dark);
  margin-bottom: 6px;
}

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

.pin-input-group input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1.5px solid var(--rose-border);
  font-size: 1rem;
  text-align: center;
  direction: ltr;
  letter-spacing: 2px;
  outline: none;
  margin-bottom: 16px;
}

.pin-input-group input:focus {
  border-color: var(--rose-primary);
  box-shadow: 0 0 0 3px rgba(197, 74, 111, 0.2);
}

.btn-primary {
  width: 100%;
  padding: 14px 20px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, #e7829d, #c54a6f);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(197, 74, 111, 0.3);
  transition: all 0.2s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(197, 74, 111, 0.4);
}

.login-error-msg {
  color: var(--danger);
  font-size: 0.85rem;
  margin-top: 10px;
}

.login-footer {
  margin-top: 22px;
}

.back-link {
  color: var(--rose-primary);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
}

/* ==========================================================
   2. MAIN DASHBOARD LAYOUT
   ========================================================== */
.admin-layout {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px 80px;
}

/* Topbar */
.admin-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--panel-bg);
  padding: 16px 24px;
  border-radius: var(--radius);
  border: 1px solid var(--rose-border);
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

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

.brand-icon {
  font-size: 2rem;
}

.topbar-brand h1 {
  font-size: 1.35rem;
  color: var(--rose-dark);
}

.brand-venue {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 20px;
  background: var(--rose-light);
  color: var(--rose-dark);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 700;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: #fbc6d4;
}

.btn-logout {
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid #e0ccd1;
  background: #fff;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
}

.btn-logout:hover {
  background: #f8e8ec;
  color: var(--danger);
}

/* Stat Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--panel-bg);
  border-radius: var(--radius);
  border: 1px solid var(--rose-border);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow);
}

.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  flex-shrink: 0;
}

.rsvp-icon { background: #ffe4ec; }
.attend-icon { background: #e3f7e8; }
.decline-icon { background: #fbeee8; }
.photo-icon { background: #eef2fb; }
.wish-icon { background: #fcf0e2; }

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
}

.stat-info h3 {
  font-size: 1.6rem;
  color: var(--rose-dark);
  line-height: 1.2;
}

.stat-sub {
  font-size: 0.75rem;
  color: var(--success);
  font-weight: 700;
}

/* Tabs */
.admin-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--rose-border);
  padding-bottom: 2px;
  overflow-x: auto;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

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

.tab-btn .badge {
  background: var(--rose-light);
  color: var(--rose-dark);
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 12px;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

/* Section Toolbar */
.section-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--panel-bg);
  padding: 14px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--rose-border);
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.search-box input {
  padding: 9px 14px;
  border-radius: 10px;
  border: 1.5px solid var(--rose-border);
  font-family: inherit;
  font-size: 0.9rem;
  width: 240px;
  outline: none;
}

.search-box input:focus {
  border-color: var(--rose-primary);
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-group select {
  padding: 9px 14px;
  border-radius: 10px;
  border: 1.5px solid var(--rose-border);
  font-family: inherit;
  font-size: 0.88rem;
  background: #fff;
  outline: none;
}

.btn-action {
  padding: 9px 16px;
  border-radius: 10px;
  border: 1.5px solid var(--rose-primary);
  background: #fff;
  color: var(--rose-primary);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-action:hover {
  background: var(--rose-primary);
  color: #fff;
}

.btn-add {
  background: var(--rose-primary);
  color: #fff;
}

.btn-danger-outline {
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--danger);
  background: #fff;
  color: var(--danger);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-danger-outline:hover {
  background: var(--danger);
  color: #fff;
}

/* Data Table */
.table-responsive {
  background: var(--panel-bg);
  border-radius: var(--radius);
  border: 1px solid var(--rose-border);
  box-shadow: var(--shadow);
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: right;
  font-size: 0.9rem;
}

.data-table th {
  background: #fff3f6;
  padding: 14px 16px;
  color: var(--rose-dark);
  font-weight: 700;
  border-bottom: 1.5px solid var(--rose-border);
  white-space: nowrap;
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid #f6e6ea;
  vertical-align: middle;
}

.data-table tr:hover {
  background: #fffafb;
}

.badge-status {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 15px;
  font-size: 0.8rem;
  font-weight: 700;
}

.badge-attending {
  background: #dff5e5;
  color: #1e7e34;
}

.badge-declined {
  background: #fde8e8;
  color: #c82333;
}

.wa-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #25d366;
  text-decoration: none;
  font-weight: 700;
}

.wa-btn:hover {
  text-decoration: underline;
}

.btn-del-row {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  color: #b09199;
  transition: color 0.2s ease;
}

.btn-del-row:hover {
  color: var(--danger);
}

.empty-table-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Photos Grid */
.admin-photos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

.admin-photo-card {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--rose-border);
  aspect-ratio: 1/1;
  background: #fff;
}

.admin-photo-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-overlay-actions {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.admin-photo-card:hover .photo-overlay-actions {
  opacity: 1;
}

.btn-photo-action {
  background: #fff;
  border: none;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: transform 0.2s ease;
}

.btn-photo-action:hover {
  transform: scale(1.1);
}

/* Messages List */
.admin-messages-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-msg-card {
  background: var(--panel-bg);
  border-radius: var(--radius);
  border: 1px solid var(--rose-border);
  padding: 16px 20px;
  box-shadow: var(--shadow);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.admin-msg-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}

.admin-msg-sender {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--rose-dark);
}

.admin-msg-time {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.admin-msg-body {
  font-size: 0.95rem;
  color: var(--text-main);
  line-height: 1.6;
}

/* Modal Add Manual RSVP */
.admin-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 20px;
}

.admin-modal-card {
  width: 100%;
  max-width: 480px;
  background: #fff;
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.modal-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.modal-top h3 {
  color: var(--rose-dark);
  font-size: 1.2rem;
}

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

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.form-field label {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
}

.form-field input, .form-field select, .form-field textarea {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1.5px solid var(--rose-border);
  font-family: inherit;
  font-size: 0.92rem;
  outline: none;
}

.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
  border-color: var(--rose-primary);
}

/* Toast */
.admin-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(60, 18, 30, 0.95);
  color: #fff;
  padding: 12px 24px;
  border-radius: 20px;
  font-weight: 700;
  z-index: 9999;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
}

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