/* ========================================
   Sirr - Main CSS
   Dark Mobile-First Theme with RTL Arabic
   ======================================== */

/* --- CSS Variables --- */
:root {
  --bg: #0D0D0D;
  --card: #1A1A2E;
  --surface: #16213E;
  --primary: #6C5CE7;
  --secondary: #a29bfe;
  --accent: #E84393;
  --text: #FFFFFF;
  --muted: #888888;
  --border: #2D2D2D;
  --radius: 14px;
  --font: 'Tajawal', sans-serif;
  --header-h: 56px;
  --tabs-h: 46px;
  --nav-h: 64px;
}

/* --- Reset --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* --- Base --- */
html, body {
  height: 100%;
  background: var(--bg);
  font-family: var(--font);
  color: var(--text);
  direction: rtl;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

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

img {
  max-width: 100%;
  display: block;
}

button {
  font-family: var(--font);
  border: none;
  outline: none;
  cursor: pointer;
  background: none;
  color: inherit;
}

input, textarea, select {
  font-family: var(--font);
  outline: none;
  border: none;
  background: none;
  color: var(--text);
}

ul, ol {
  list-style: none;
}

/* --- Scrollbar Hiding --- */
.hide-scrollbar::-webkit-scrollbar {
  display: none;
}
.hide-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

#content::-webkit-scrollbar {
  display: none;
}
#content {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* --- Fixed Header --- */
#header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-h);
  background: rgba(13, 13, 13, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 100;
  padding: 0 16px;
}

.logo {
  font-size: 24px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

.header-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
}

.header-icon:active {
  background: var(--surface);
}

.notif-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 16px;
  height: 16px;
  background: var(--accent);
  border-radius: 50%;
  font-size: 9px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pulse 2s infinite;
  border: 2px solid var(--bg);
}

/* --- Top Tabs --- */
#top-tabs {
  position: absolute;
  top: var(--header-h);
  left: 0;
  right: 0;
  height: var(--tabs-h);
  background: var(--bg);
  display: flex;
  overflow-x: auto;
  z-index: 99;
  border-bottom: 1px solid var(--border);
  transition: opacity 0.3s, transform 0.3s;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

#top-tabs::-webkit-scrollbar {
  display: none;
}

#top-tabs.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-10px);
}

.tab-btn {
  flex-shrink: 0;
  padding: 0 18px;
  height: 100%;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  background: none;
  border: none;
  position: relative;
  cursor: pointer;
  transition: color 0.3s;
  white-space: nowrap;
}

.tab-btn::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 60%;
  height: 3px;
  background: var(--primary);
  border-radius: 3px 3px 0 0;
  transition: transform 0.3s;
}

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

.tab-btn.active::after {
  transform: translateX(-50%) scaleX(1);
}

/* --- Content Area --- */
#content {
  position: absolute;
  top: var(--header-h);
  bottom: var(--nav-h);
  left: 0;
  right: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

#content.with-tabs {
  top: calc(var(--header-h) + var(--tabs-h));
}

/* --- Bottom Navigation --- */
#bottom-nav {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-h);
  background: rgba(13, 13, 13, 0.97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 100;
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

.nav-icon {
  font-size: 22px;
  color: var(--muted);
  transition: color 0.3s;
}

.nav-label {
  font-size: 10px;
  color: var(--muted);
  transition: color 0.3s;
}

.nav-btn.active .nav-icon,
.nav-btn.active .nav-label {
  color: var(--primary);
}

#btn-create .nav-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 22px;
  margin-top: -12px;
  box-shadow: 0 4px 15px rgba(108, 92, 231, 0.4);
}

/* --- Pages --- */
.page {
  display: none;
}

.page.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

/* --- Gradient Helpers --- */
.g1 { background: linear-gradient(135deg, #6C5CE7, #a29bfe); }
.g2 { background: linear-gradient(135deg, #E84393, #fd79a8); }
.g3 { background: linear-gradient(135deg, #00b894, #55efc4); }
.g4 { background: linear-gradient(135deg, #fdcb6e, #e17055); }
.g5 { background: linear-gradient(135deg, #0984e3, #74b9ff); }
.g6 { background: linear-gradient(135deg, #6c5ce7, #e84393); }
.g7 { background: linear-gradient(135deg, #00cec9, #81ecec); }
.g8 { background: linear-gradient(135deg, #fd79a8, #fdcb6e); }

/* --- Animations --- */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@keyframes pulse {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.7; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* --- Utility --- */
.divider {
  height: 1px;
  background: var(--border);
  margin: 12px 0;
}

.text-accent {
  color: var(--accent);
}

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

.text-muted {
  color: var(--muted);
}

/* --- Create Modal --- */
#create-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 200;
  display: none;
  align-items: flex-end;
  justify-content: center;
}

#create-modal.active {
  display: flex;
}

#create-modal .modal-sheet {
  width: 100%;
  max-width: 500px;
  background: var(--card);
  border-radius: 20px 20px 0 0;
  padding: 20px;
  animation: slideUp 0.3s ease;
  max-height: 80vh;
  overflow-y: auto;
}

#create-modal .modal-sheet .modal-handle {
  width: 40px;
  height: 4px;
  background: var(--border);
  border-radius: 4px;
  margin: 0 auto 16px;
}

/* --- Back Header --- */
.back-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.back-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.2s;
}

.back-btn:active {
  background: var(--surface);
}

.back-header h2 {
  font-size: 18px;
  font-weight: 700;
}

/* --- Toggle Switch --- */
.toggle-switch {
  width: 44px;
  height: 24px;
  background: var(--border);
  border-radius: 12px;
  position: relative;
  cursor: pointer;
  transition: background 0.3s;
  flex-shrink: 0;
}

.toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.3s;
}

.toggle-switch.on {
  background: var(--primary);
}

.toggle-switch.on::after {
  transform: translateX(-20px);
}

/* --- Skeleton Loading --- */
.skeleton {
  background: linear-gradient(90deg, var(--card) 25%, var(--surface) 50%, var(--card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius);
}

.skeleton-circle {
  border-radius: 50%;
}

.skeleton-text {
  height: 14px;
  border-radius: 7px;
  margin-bottom: 8px;
}

.skeleton-text.short {
  width: 60%;
}

/* --- Toast Notifications --- */
.toast {
  position: fixed;
  bottom: calc(var(--nav-h) + 20px);
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--card);
  color: var(--text);
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--border);
  z-index: 300;
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  white-space: nowrap;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

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

.toast.success {
  border-color: #00b894;
}

.toast.error {
  border-color: var(--accent);
}

/* --- Avatar --- */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.avatar-sm {
  width: 32px;
  height: 32px;
}

.avatar-lg {
  width: 56px;
  height: 56px;
}

.avatar-xl {
  width: 80px;
  height: 80px;
}
