:root {
  --primary: #FF4757;
  --primary-hover: #FF6B81;
  --secondary: #10B981;
  --accent: #F59E0B;
  --light-bg: #F8FAFC;
  --card-bg: #FFFFFF;
  --glass-bg: rgba(255, 255, 255, 0.9);
  --border-color: rgba(226, 232, 240, 0.8);
  --text-main: #0F172A;
  --text-muted: #64748B;
  --shadow-glow: 0 10px 30px rgba(255, 71, 87, 0.35);
  --radius-lg: 24px;
  --radius-md: 14px;
  --radius-sm: 8px;
  --font-family: 'Cairo', system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family);
  background: #F1F5F9;
  background-image: 
    radial-gradient(at 10% 10%, rgba(255, 71, 87, 0.1) 0px, transparent 40%),
    radial-gradient(at 90% 90%, rgba(245, 158, 11, 0.1) 0px, transparent 40%),
    radial-gradient(at 50% 50%, rgba(16, 185, 129, 0.05) 0px, transparent 50%);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  direction: rtl;
  overflow-x: hidden;
}

/* App Wrapper for Mobile-first framing */
.app-wrapper {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px;
  position: relative;
}

/* Header styling */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.04);
}

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

.app-logo {
  font-size: 26px;
  animation: pulseLogo 2s infinite alternate;
}

@keyframes pulseLogo {
  0% { transform: scale(1); }
  100% { transform: scale(1.15) rotate(10deg); }
}

.app-title {
  font-size: 22px;
  font-weight: 900;
  background: linear-gradient(135deg, #FF4757, #F59E0B);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

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

.btn-icon {
  background: #F1F5F9;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 18px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: #E2E8F0;
  transform: translateY(-2px);
}

.btn-action-text {
  background: linear-gradient(135deg, #FFF7ED, #FEF2F2);
  border: 1px solid #FDBA74;
  color: #C2410C;
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 800;
  padding: 8px 14px;
  border-radius: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(249, 115, 22, 0.12);
}

.btn-action-text:hover {
  background: linear-gradient(135deg, #FFEDD5, #FEE2E2);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.25);
}

/* Category Filter Slider */
.category-section {
  margin: 16px 0 8px 0;
}

.category-scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 6px 4px;
  scrollbar-width: none;
}

.category-scroll::-webkit-scrollbar {
  display: none;
}

.cat-pill {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  border-radius: 30px;
  color: var(--text-muted);
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.cat-pill:hover {
  color: var(--text-main);
  background: #F8FAFC;
}

.cat-pill.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: #FFF;
  border-color: transparent;
  box-shadow: 0 6px 18px rgba(255, 71, 87, 0.35);
}

.cat-icon {
  font-size: 16px;
}

/* Wheel Section */
.wheel-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 10px 0;
  flex: 1;
}

.wheel-outer-ring {
  position: relative;
  padding: 14px;
  background: #FFFFFF;
  border-radius: 50%;
  border: 4px solid var(--border-color);
  box-shadow: 0 15px 45px rgba(0, 0, 0, 0.08), inset 0 0 15px rgba(0, 0, 0, 0.02);
}

.wheel-pointer {
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 36px;
  z-index: 10;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.15));
  animation: bouncePointer 1.5s infinite ease-in-out;
}

@keyframes bouncePointer {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(6px); }
}

.canvas-wrapper {
  position: relative;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: inset 0 0 10px rgba(0,0,0,0.1);
}

#wheelCanvas {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: block;
}

.wheel-center-cap {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 58px;
  height: 58px;
  background: #FFFFFF;
  border: 4px solid #FF4757;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.15);
  z-index: 5;
}

/* Action Button */
.action-container {
  width: 100%;
  display: flex;
  justify-content: center;
  margin-top: 24px;
}

.btn-spin {
  width: 85%;
  padding: 16px 28px;
  font-family: var(--font-family);
  font-size: 20px;
  font-weight: 800;
  color: #FFF;
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  border: none;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: var(--shadow-glow);
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-spin:hover {
  transform: scale(1.04);
  box-shadow: 0 14px 35px rgba(255, 71, 87, 0.45);
}

.btn-spin:active {
  transform: scale(0.96);
}

.btn-spin:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none !important;
}

/* Modals General */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
  transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
  display: none;
}

.modal-card {
  width: 100%;
  max-width: 440px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.12);
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

.animate-pop {
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}

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

.modal-header h3 {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-main);
}

.close-modal, .close-submodal {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  padding: 0 6px;
}

.close-modal:hover, .close-submodal:hover {
  color: var(--primary);
}

/* Result Modal Special Styling */
.modal-result-card {
  text-align: center;
  padding: 32px 24px;
}

.result-badge {
  display: inline-block;
  background: #FEF2F2;
  color: var(--primary);
  border: 1px solid #FECACA;
  padding: 6px 18px;
  border-radius: 30px;
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 16px;
}

.result-icon-large {
  font-size: 72px;
  margin: 12px 0;
  animation: bounceIcon 0.8s ease infinite alternate;
}

@keyframes bounceIcon {
  from { transform: translateY(0); }
  to { transform: translateY(-10px); }
}

.result-title {
  font-size: 32px;
  font-weight: 900;
  color: var(--text-main);
  margin-bottom: 4px;
}

.result-category {
  color: var(--text-muted);
  font-size: 15px;
  margin-bottom: 24px;
  font-weight: 600;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Forms */
.modal-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
}

.required {
  color: var(--primary);
}

.form-group input, .form-group textarea, .form-group select {
  width: 100%;
  padding: 12px 14px;
  background: #F8FAFC;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255, 71, 87, 0.15);
  background: #FFFFFF;
}

.checkbox-group label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  color: var(--text-main);
  font-weight: 600;
}

.checkbox-group input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

/* Buttons */
.btn-primary {
  padding: 14px 20px;
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: #FFF;
  font-family: var(--font-family);
  font-weight: 800;
  font-size: 16px;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 15px rgba(255, 71, 87, 0.25);
}

.btn-primary:hover {
  opacity: 0.95;
  transform: translateY(-1px);
}

.btn-secondary {
  padding: 12px 20px;
  background: #F1F5F9;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-family: var(--font-family);
  font-weight: 700;
  font-size: 15px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.2s;
}

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

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
  border-radius: var(--radius-sm);
}

.btn-danger {
  background: #EF4444;
  color: white;
  border: none;
}

.btn-success {
  background: var(--secondary);
  color: white;
  border: none;
}

.error-msg {
  color: #EF4444;
  font-size: 13px;
  padding: 8px;
  background: #FEF2F2;
  border-radius: var(--radius-sm);
}

/* Admin Dashboard Styling */
.modal-admin-card {
  max-width: 720px;
}

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

.admin-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 16px;
}

.tab-btn {
  padding: 10px 14px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--text-muted);
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

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

.tab-content {
  display: none;
}

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

.tab-header-action {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.badge {
  background: var(--primary);
  color: white;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
}

/* Admin Tables */
.table-responsive {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-size: 14px;
}

.admin-table th, .admin-table td {
  padding: 10px 12px;
  text-align: right;
  border-bottom: 1px solid var(--border-color);
}

.admin-table th {
  background: #F8FAFC;
  color: var(--text-muted);
}

.admin-table tr:hover {
  background: #F8FAFC;
}

.action-btns {
  display: flex;
  gap: 6px;
}

.status-tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
}

.status-tag.visible {
  background: #D1FAE5;
  color: #065F46;
}

.status-tag.hidden {
  background: #E2E8F0;
  color: #475569;
}

.status-tag.pending {
  background: #FEF3C7;
  color: #92400E;
}

.status-tag.approved {
  background: #D1FAE5;
  color: #065F46;
}

.status-tag.rejected {
  background: #FEE2E2;
  color: #991B1B;
}

/* Footer */
.app-footer {
  text-align: center;
  padding: 12px 0;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

/* Utility */
.font-bold { font-weight: bold; }
.text-lg { font-size: 18px; }
.color-primary { color: var(--primary); }
