/* ============================================================
   TALAH TICKET — ADMIN PORTAL
   Styles & Layout System
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;600;700;900&family=Inter:wght@300;400;600;700;800&display=swap');

:root {
  --forest:    #1F3D2B;
  --forest-dk: #162c1f;
  --forest-lt: #2a5239;
  --ivory:     #F5F1E4;
  --gold:      #F2CA6E;
  --gold-dk:   #d9a83a;
  --sage:      #E7EBE1;
  --gray:      #9AA39B;
  --white:     #ffffff;
  --text-dark: #1a2e23;
  --text-mid:  #3d5447;
  --success:   #2ecc71;
  --warning:   #f1c40f;
  --danger:    #e74c3c;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-xl: 32px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-sm: 0 4px 12px rgba(31,61,43,0.06);
  --shadow-md: 0 8px 24px rgba(31,61,43,0.1);
  --shadow-lg: 0 16px 48px rgba(31,61,43,0.15);
}

/* === RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Cairo', 'Inter', sans-serif;
  background: var(--ivory);
  color: var(--text-dark);
  direction: rtl; /* Default Arabic RTL */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body.lang-en {
  direction: ltr;
}

a { text-decoration: none; color: inherit; }

button, input, textarea, select {
  font-family: inherit;
  outline: none;
}

/* ============================================================
   SECURE LOGIN PAGE
   ============================================================ */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--forest-dk) 0%, var(--forest) 100%);
  padding: 20px;
  position: fixed;
  inset: 0;
  z-index: 5000;
}

.login-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 40px;
  max-width: 440px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  text-align: center;
  border: 1px solid rgba(242,202,110,0.25);
  animation: loginPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes loginPop {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.login-logo {
  font-size: 3rem;
  margin-bottom: 12px;
}

.login-card h2 {
  color: var(--forest-dk);
  font-size: 1.6rem;
  font-weight: 900;
  margin-bottom: 6px;
}

.login-card p {
  color: var(--gray);
  font-size: 0.85rem;
  margin-bottom: 28px;
}

.login-hint {
  background: var(--sage);
  color: var(--forest);
  padding: 10px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 20px;
  border: 1px dashed var(--forest);
}

.login-form .form-group {
  text-align: right;
  margin-bottom: 18px;
}
body.lang-en .login-form .form-group {
  text-align: left;
}

.login-form label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-mid);
  margin-bottom: 6px;
}

.login-form input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid rgba(31,61,43,0.12);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  background: var(--ivory);
  transition: var(--transition);
  text-align: right;
}
body.lang-en .login-form input {
  text-align: left;
}

.login-form input:focus {
  border-color: var(--forest);
  background: var(--white);
  box-shadow: 0 0 0 4px rgba(31,61,43,0.06);
}

.login-btn {
  width: 100%;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dk) 100%);
  color: var(--forest-dk);
  font-weight: 700;
  font-size: 1rem;
  padding: 14px;
  border: none;
  border-radius: 40px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(242,202,110,0.3);
  transition: var(--transition);
  margin-top: 10px;
}

.login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(242,202,110,0.45);
}

/* ============================================================
   ADMIN MAIN LAYOUT
   ============================================================ */
.admin-layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
  overflow-x: hidden;
}

/* Sidebar styling */
.admin-sidebar {
  width: 260px;
  background: var(--forest-dk);
  color: var(--ivory);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  border-left: 1px solid rgba(242,202,110,0.15);
  transition: var(--transition);
  z-index: 100;
}
body.lang-en .admin-sidebar {
  border-left: none;
  border-right: 1px solid rgba(242,202,110,0.15);
}

.sidebar-header {
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo-icon {
  font-size: 2rem;
}

.sidebar-logo-text h1 {
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--gold);
}

.sidebar-logo-text p {
  font-size: 0.7rem;
  color: rgba(245,241,228,0.55);
}

.sidebar-menu {
  list-style: none;
  padding: 20px 12px;
  flex: 1;
}

.menu-item {
  margin-bottom: 6px;
}

.menu-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  color: rgba(245,241,228,0.75);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
}

.menu-link:hover,
.menu-item.active .menu-link {
  background: rgba(242,202,110,0.12);
  color: var(--gold);
}

.menu-item.active .menu-link {
  font-weight: 700;
  background: var(--gold);
  color: var(--forest-dk);
}

.sidebar-footer {
  padding: 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px;
  border-radius: 40px;
  background: rgba(231,76,60,0.15);
  color: #e74c3c;
  border: 1px solid rgba(231,76,60,0.3);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.logout-btn:hover {
  background: #e74c3c;
  color: var(--white);
}

/* Content Area styling */
.admin-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Header bar styling */
.content-header {
  background: var(--white);
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  box-shadow: var(--shadow-sm);
  border-bottom: 1px solid rgba(31,61,43,0.06);
}

.header-title-bar h2 {
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--forest-dk);
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.admin-lang-btn {
  background: var(--sage);
  color: var(--forest);
  border: 1px solid rgba(31,61,43,0.12);
  padding: 6px 14px;
  border-radius: 40px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.admin-lang-btn:hover {
  background: var(--forest);
  color: var(--ivory);
}

.hamburger-admin {
  display: none;
  font-size: 1.5rem;
  cursor: pointer;
  background: none;
  border: none;
  color: var(--forest);
}

/* View panel container */
.view-panel {
  padding: 32px;
  flex: 1;
  overflow-y: auto;
}

.tab-pane {
  display: none;
  animation: paneFade 0.4s ease both;
}

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

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

/* ============================================================
   KPI STATS CARDS
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(31,61,43,0.04);
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: rgba(242,202,110,0.3);
}

.stat-icon-wrapper {
  width: 50px; height: 50px;
  border-radius: 12px;
  background: var(--sage);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.stat-details span {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--gray);
  margin-bottom: 4px;
}

.stat-details h3 {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--forest-dk);
}

/* ============================================================
   DASHBOARD VISUAL CHARTS & METRICS
   ============================================================ */
.dashboard-details-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  align-items: start;
}

.dashboard-card {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(31,61,43,0.04);
  margin-bottom: 24px;
}

.dashboard-card h3 {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--forest-dk);
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--sage);
}

/* Simple visual chart */
.bar-chart-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chart-bar-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.chart-label {
  width: 100px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-mid);
  white-space: nowrap;
}

.chart-bar-outer {
  flex: 1;
  height: 24px;
  background: var(--sage);
  border-radius: 12px;
  overflow: hidden;
  position: relative;
}

.chart-bar-inner {
  height: 100%;
  background: linear-gradient(90deg, var(--forest-lt) 0%, var(--forest) 100%);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 8px;
  padding-left: 8px;
  color: var(--white);
  font-size: 0.72rem;
  font-weight: 700;
  transition: width 0.8s ease-in-out;
}

.chart-value {
  width: 50px;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--forest-dk);
  text-align: left;
}
body.lang-en .chart-value { text-align: right; }

/* ============================================================
   TABLE STYLING
   ============================================================ */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(31,61,43,0.08);
}

.talah-table {
  width: 100%;
  border-collapse: collapse;
  text-align: right;
  font-size: 0.88rem;
}
body.lang-en .talah-table { text-align: left; }

.talah-table th {
  background: var(--forest);
  color: var(--gold);
  font-weight: 700;
  padding: 14px 16px;
  white-space: nowrap;
}

.talah-table td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(31,61,43,0.06);
  background: var(--white);
  color: var(--text-dark);
}

.talah-table tr:hover td {
  background: rgba(31,61,43,0.02);
}

/* Badges */
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 30px;
  font-size: 0.75rem;
  font-weight: 800;
}

.badge.paid {
  background: rgba(46, 204, 113, 0.15);
  color: var(--success);
}

.badge.pending {
  background: rgba(241, 196, 15, 0.15);
  color: #d4ac0d;
}

.badge.cancelled {
  background: rgba(231, 76, 60, 0.15);
  color: var(--danger);
}

/* Action button icons */
.action-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.95rem;
  transition: var(--transition);
  margin: 0 2px;
}

.action-btn.edit {
  background: rgba(242,202,110,0.2);
  color: var(--gold-dk);
}

.action-btn.edit:hover {
  background: var(--gold);
  color: var(--forest-dk);
}

.action-btn.delete {
  background: rgba(231,76,60,0.15);
  color: var(--danger);
}

.action-btn.delete:hover {
  background: var(--danger);
  color: var(--white);
}

.action-btn.confirm {
  background: rgba(46,204,113,0.15);
  color: var(--success);
}

.action-btn.confirm:hover {
  background: var(--success);
  color: var(--white);
}

/* ============================================================
   FILTERS & CONTROLS BAR
   ============================================================ */
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--white);
  padding: 16px 24px;
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
}

.search-wrap {
  display: flex;
  align-items: center;
  background: var(--sage);
  border: 1px solid rgba(31,61,43,0.1);
  padding: 8px 16px;
  border-radius: 40px;
  flex: 1;
  max-width: 360px;
  min-width: 220px;
}

.search-wrap input {
  background: none;
  border: none;
  width: 100%;
  padding-right: 8px;
  font-size: 0.88rem;
  color: var(--text-dark);
}

body.lang-en .search-wrap input {
  padding-right: 0;
  padding-left: 8px;
}

.search-icon-btn {
  font-size: 1rem;
  color: var(--forest);
  background: none;
  border: none;
}

.filter-inputs {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

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

.filter-group label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-mid);
}

.filter-select,
.filter-date {
  padding: 8px 14px;
  border-radius: 30px;
  border: 1px solid rgba(31,61,43,0.15);
  background: var(--ivory);
  font-size: 0.85rem;
  color: var(--text-dark);
  cursor: pointer;
  transition: var(--transition);
}

.filter-select:focus,
.filter-date:focus {
  border-color: var(--forest);
  background: var(--white);
}

/* ============================================================
   FORMS & CONFIG PAGES
   ============================================================ */
.config-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.config-card {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(31,61,43,0.04);
}

.config-card h3 {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--forest-dk);
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--sage);
}

.form-group-admin {
  margin-bottom: 18px;
}

.form-group-admin label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-mid);
  margin-bottom: 6px;
}

.input-admin,
.select-admin {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid rgba(31,61,43,0.15);
  background: var(--ivory);
  font-size: 0.9rem;
  color: var(--text-dark);
  transition: var(--transition);
  text-align: right;
}
body.lang-en .input-admin,
body.lang-en .select-admin {
  text-align: left;
}

.input-admin:focus,
.select-admin:focus {
  border-color: var(--forest);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(31,61,43,0.06);
}

.textarea-admin {
  width: 100%;
  height: 160px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid rgba(31,61,43,0.15);
  background: var(--ivory);
  font-size: 0.85rem;
  color: var(--text-dark);
  resize: vertical;
  transition: var(--transition);
  text-align: right;
  line-height: 1.6;
}
body.lang-en .textarea-admin {
  text-align: left;
}

.textarea-admin:focus {
  border-color: var(--forest);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(31,61,43,0.06);
}

.btn-admin-save {
  background: var(--forest);
  color: var(--gold);
  border: none;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 12px 24px;
  border-radius: 30px;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(31,61,43,0.15);
}

.btn-admin-save:hover {
  transform: translateY(-1px);
  background: var(--forest-lt);
  box-shadow: 0 6px 16px rgba(31,61,43,0.25);
}

/* ============================================================
   DISABLED DATES CONTROLS
   ============================================================ */
.disabled-dates-list {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.disabled-date-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--sage);
  padding: 10px 16px;
  border-radius: 30px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--forest);
}

.remove-disabled-btn {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 1rem;
}

/* ============================================================
   GALLERY / IMAGES MANAGER
   ============================================================ */
.gallery-manager-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.manager-img-card {
  background: var(--white);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(31,61,43,0.08);
  display: flex;
  flex-direction: column;
}

.manager-img-preview {
  height: 140px;
  background: #eee;
  position: relative;
}

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

.manager-img-actions {
  position: absolute;
  top: 8px; left: 8px;
}
body.lang-en .manager-img-actions {
  left: auto; right: 8px;
}

.manager-img-details {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Image Preset Selector */
.preset-selector-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.preset-thumbnail {
  border-radius: var(--radius-sm);
  height: 50px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: var(--transition);
}

.preset-thumbnail img {
  width: 100%; height: 100%;
  object-fit: cover;
}

.preset-thumbnail:hover,
.preset-thumbnail.selected {
  border-color: var(--gold);
  transform: scale(1.05);
}

/* Drag-Drop Zone */
.upload-dropzone {
  border: 2px dashed rgba(31,61,43,0.2);
  background: var(--sage);
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  margin-bottom: 16px;
  transition: var(--transition);
}

.upload-dropzone:hover {
  background: rgba(242,202,110,0.08);
  border-color: var(--gold);
}

.upload-dropzone p {
  font-size: 0.8rem;
  color: var(--text-mid);
  margin-top: 6px;
}

/* ============================================================
   RESPONSIVE LAYOUT FOR ALL BREAKPOINTS
   ============================================================ */

@media (max-width: 1124px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 960px) {
  .dashboard-details-grid {
    grid-template-columns: 1fr;
  }
  .config-container {
    grid-template-columns: 1fr;
  }
  .gallery-manager-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .admin-sidebar {
    position: fixed;
    top: 0; bottom: 0;
    right: -260px; /* Hide offscreen default */
    width: 260px;
    z-index: 1000;
  }
  
  body.lang-en .admin-sidebar {
    right: auto;
    left: -260px;
  }

  .admin-sidebar.open {
    right: 0;
  }
  
  body.lang-en .admin-sidebar.open {
    left: 0;
  }

  .hamburger-admin {
    display: block;
  }

  .content-header {
    padding: 0 16px;
    height: 60px;
  }

  .view-panel {
    padding: 16px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
  }

  .stat-card {
    padding: 16px;
  }

  .stat-icon-wrapper {
    width: 40px; height: 40px;
    font-size: 1.2rem;
  }

  .stat-details h3 {
    font-size: 1.3rem;
  }

  .gallery-manager-grid {
    grid-template-columns: 1fr;
  }

  .preset-selector-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .filter-bar {
    padding: 12px;
    flex-direction: column;
    align-items: stretch;
  }
  .search-wrap {
    max-width: 100%;
  }
  .filter-inputs {
    justify-content: space-between;
  }
  .header-title-bar h2 {
    font-size: 1.05rem;
  }
}
