/* ============================================
   Raslan Facebook SaaS Tool - Premium Theme
   ============================================ */

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

:root {
  /* ── Brand Colors ── */
  --color-primary: #0066FF;
  --color-primary-light: #3388FF;
  --color-primary-dark: #0044CC;
  --color-cyan: #00D4FF;
  --color-purple: #7B2FBE;
  --color-orange: #FF8C00;
  --color-gold: #FFD700;

  /* ── Neutral Colors ── */
  --color-white: #FFFFFF;
  --color-off-white: #F8F9FC;
  --color-gray-50: #F1F3F8;
  --color-gray-100: #E4E7EF;
  --color-gray-200: #C8CDD9;
  --color-gray-300: #A0A8B9;
  --color-gray-400: #7A8299;
  --color-gray-500: #5A6378;
  --color-gray-600: #3D4558;
  --color-gray-700: #2A3040;
  --color-gray-800: #1A1F2E;
  --color-gray-900: #111827;
  --color-black: #0F1219;

  /* ── Semantic Colors ── */
  --color-success: #10B981;
  --color-error: #EF4444;
  --color-warning: #F59E0B;

  /* ── Gradients ── */
  --gradient-primary: linear-gradient(135deg, var(--color-primary) 0%, var(--color-cyan) 100%);
  --gradient-hero: linear-gradient(135deg, var(--color-primary) 0%, var(--color-purple) 50%, var(--color-cyan) 100%);
  --gradient-card: linear-gradient(180deg, rgba(255,255,255,0.9) 0%, rgba(248,249,252,0.9) 100%);

  /* ── Shadows ── */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.05), 0 2px 4px rgba(0,0,0,0.03);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.04);
  --shadow-glow: 0 0 20px rgba(0,102,255,0.15), 0 0 40px rgba(0,102,255,0.05);

  /* ── UI Elements ── */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-full: 99px;
  
  --font-main: 'Cairo', sans-serif;
  --font-en: 'Inter', sans-serif;
}

/* ============================================
   Base & Resets
   ============================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: var(--font-main);
}

body {
  background-color: var(--color-off-white);
  color: var(--color-gray-800);
  line-height: 1.6;
  direction: rtl;
  overflow-x: hidden;
  background-image: radial-gradient(circle at top right, rgba(0,102,255,0.03), transparent 40%),
                    radial-gradient(circle at bottom left, rgba(123,47,190,0.03), transparent 40%);
}

a {
  text-decoration: none;
  color: var(--color-primary);
  transition: all 0.3s ease;
}

a:hover {
  color: var(--color-primary-dark);
}

/* ============================================
   Animations
   ============================================ */
@keyframes fadeInUp {
  0% { opacity: 0; transform: translateY(30px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
  0% { opacity: 0; transform: translateX(50px); }
  100% { opacity: 1; transform: translateX(0); }
}

@keyframes pulseGlow {
  0% { box-shadow: 0 0 0 0 rgba(0,102,255,0.4); }
  70% { box-shadow: 0 0 0 15px rgba(0,102,255,0); }
  100% { box-shadow: 0 0 0 0 rgba(0,102,255,0); }
}

@keyframes float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
  100% { transform: translateY(0px); }
}

@keyframes slideBg {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.animate-up {
  animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.animate-float {
  animation: float 4s ease-in-out infinite;
}

/* ============================================
   Typography
   ============================================ */
h1, h2, h3, h4, h5 {
  font-weight: 800;
  color: var(--color-gray-900);
  line-height: 1.3;
}

.text-gradient {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

/* ============================================
   Buttons
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  border: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.97);
}

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

.btn-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: var(--shadow-md);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}

.btn-secondary {
  background: var(--color-white);
  color: var(--color-primary);
  border: 2px solid var(--color-primary);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--color-primary-light);
  color: white;
  border-color: var(--color-primary-light);
}

.btn-danger {
  background: var(--color-error);
  color: white;
}

.btn-danger:hover:not(:disabled) {
  background: #DC2626;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* ============================================
   Inputs & Forms
   ============================================ */
.form-group {
  margin-bottom: 1.5rem;
  position: relative;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--color-gray-700);
  font-size: 0.95rem;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
select,
textarea {
  width: 100%;
  padding: 14px 16px;
  background: var(--color-white);
  border: 1px solid var(--color-gray-200);
  border-radius: var(--radius-md);
  color: var(--color-gray-800);
  font-size: 1rem;
  transition: all 0.3s ease;
  font-family: var(--font-main);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(0,102,255,0.1);
  background: var(--color-white);
}

input::placeholder,
textarea::placeholder {
  color: var(--color-gray-400);
}

/* ==========================================================================
   Floating Navbar
   ========================================================================== */
.navbar {
  position: fixed;
  top: 20px;
  left: 0;
  right: 0;
  margin: 0 auto;
  width: 95%;
  max-width: 1200px;
  height: 75px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 1000;
  border-radius: 100px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 30px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}
.logo-img {
  height: 40px;
}
.logo-text {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--color-gray-900);
}

.nav-links {
  display: flex;
  gap: 2rem;
  align-items: center;
}
.nav-links a {
  color: var(--color-gray-700);
  font-weight: 700;
  text-decoration: none;
  font-size: 1.05rem;
  transition: color 0.3s ease;
}
.nav-links a:hover {
  color: var(--color-primary);
}

.nav-auth {
  display: flex;
  gap: 1rem;
  align-items: center;
}

/* ============================================
   Hero Slider
   ============================================ */
.hero-container {
  margin-top: 80px; /* navbar height */
  height: calc(100vh - 80px);
  position: relative;
  overflow: hidden;
  background: var(--color-gray-900);
}

.hero-slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  visibility: hidden;
  transition: opacity 1s ease-in-out, visibility 1s ease-in-out;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 5%;
}

.hero-slide.active {
  opacity: 1;
  visibility: visible;
}

.hero-slide-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  z-index: 1;
  transform: scale(1.05);
  transition: transform 6s ease-out;
}

.hero-slide.active .hero-slide-bg {
  transform: scale(1);
}

.hero-slide-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(0,0,0,0.8) 0%, rgba(15,18,25,0.6) 100%);
  z-index: 2;
}

.hero-content {
  position: relative;
  z-index: 3;
  max-width: 800px;
  color: white;
}

.hero-content h1 {
  font-size: 3.5rem;
  color: white;
  margin-bottom: 1.5rem;
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.3s;
}

.hero-content p {
  font-size: 1.25rem;
  color: var(--color-gray-200);
  margin-bottom: 2.5rem;
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.5s;
}

.hero-content .hero-actions {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.7s;
}

.hero-slide.active .hero-content h1,
.hero-slide.active .hero-content p,
.hero-slide.active .hero-content .hero-actions {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================
   Auth Modal (Login Card)
   ============================================ */
.auth-section {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 100;
  width: 100%;
  max-width: 450px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.5s ease;
}

.auth-section.active {
  opacity: 1;
  pointer-events: auto;
}

.glass-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.5);
  border-radius: var(--radius-xl);
  padding: 40px;
  box-shadow: var(--shadow-xl);
}

.auth-header {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-header h2 {
  font-size: 2rem;
  color: var(--color-gray-900);
  margin-bottom: 0.5rem;
}

.auth-header p {
  color: var(--color-gray-500);
}

/* ============================================
   Dashboard Layout (SaaS Style)
   ============================================ */
.dashboard-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
  background: var(--color-off-white);
}

/* Sidebar */
.sidebar {
  width: 280px;
  background: var(--color-white);
  border-left: 1px solid var(--color-gray-100);
  display: flex;
  flex-direction: column;
  z-index: 10;
  box-shadow: var(--shadow-sm);
}

.sidebar-header {
  height: 80px;
  display: flex;
  align-items: center;
  padding: 0 24px;
  border-bottom: 1px solid var(--color-gray-100);
}

.sidebar-nav {
  padding: 24px 16px;
  flex: 1;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  color: var(--color-gray-600);
  font-weight: 600;
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.nav-item i {
  font-size: 1.25rem;
  transition: transform 0.3s ease;
}

.nav-item:hover {
  background: var(--color-gray-50);
  color: var(--color-primary);
}

.nav-item:hover i {
  transform: translateX(-4px);
}

.nav-item.active {
  background: var(--color-primary-light);
  color: white;
  background: var(--gradient-primary);
  box-shadow: var(--shadow-md);
}

/* Promo Banner in Sidebar */
.sidebar-promo {
  margin: 16px;
  padding: 20px;
  background: linear-gradient(135deg, #0F1219 0%, #1A1F2E 100%);
  border-radius: var(--radius-lg);
  color: white;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.sidebar-promo::before {
  content: '';
  position: absolute;
  top: -50px;
  right: -50px;
  width: 100px;
  height: 100px;
  background: var(--color-primary);
  filter: blur(40px);
  opacity: 0.5;
  border-radius: 50%;
}

.sidebar-promo h4 {
  color: white;
  font-size: 1.1rem;
  margin-bottom: 8px;
}

.sidebar-promo p {
  font-size: 0.85rem;
  color: var(--color-gray-300);
  margin-bottom: 16px;
  line-height: 1.5;
}

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* Topbar */
.topbar {
  height: 80px;
  background: var(--color-white);
  border-bottom: 1px solid var(--color-gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
}

.topbar-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-gray-900);
}

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

/* Content Area */
.content-area {
  flex: 1;
  padding: 32px;
  overflow-y: auto;
}

.panel {
  display: none;
  animation: fadeInUp 0.5s ease;
}

.panel.active {
  display: block;
}

/* ============================================
   Cards & Dashboard UI
   ============================================ */
.dash-card {
  background: var(--color-white);
  border: 1px solid var(--color-gray-100);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.dash-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

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

.dash-card-title {
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.dash-card-title i {
  color: var(--color-primary);
}

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

.stat-box {
  background: var(--color-off-white);
  padding: 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-gray-100);
  display: flex;
  align-items: center;
  gap: 16px;
}

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

.stat-icon.primary { background: rgba(0,102,255,0.1); color: var(--color-primary); }
.stat-icon.success { background: rgba(16,185,129,0.1); color: var(--color-success); }
.stat-icon.warning { background: rgba(245,158,11,0.1); color: var(--color-warning); }

.stat-info h5 {
  font-size: 0.9rem;
  color: var(--color-gray-500);
  font-weight: 600;
}

.stat-info .stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--color-gray-900);
  margin-top: 4px;
}

/* ============================================
   Tables (Light Theme)
   ============================================ */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-gray-100);
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: right;
  background: var(--color-white);
}

th, td {
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-gray-100);
}

th {
  background: var(--color-gray-50);
  font-weight: 700;
  color: var(--color-gray-600);
  font-size: 0.95rem;
}

td {
  color: var(--color-gray-800);
  font-size: 0.95rem;
}

tr:hover td {
  background: rgba(0,102,255,0.02);
}

/* Badges */
.badge {
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.badge-active { background: rgba(16,185,129,0.1); color: var(--color-success); }
.badge-pending { background: rgba(245,158,11,0.1); color: var(--color-warning); }
.badge-error { background: rgba(239,68,68,0.1); color: var(--color-error); }
.badge-primary { background: rgba(0,102,255,0.1); color: var(--color-primary); }

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--color-off-white);
}
::-webkit-scrollbar-thumb {
  background: var(--color-gray-300);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--color-gray-400);
}

/* Specific component overrides for backward compatibility */
#analyzerLogContainer, #posterLogContainer {
  margin-top: 2rem;
}

#statusMsg {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 1000;
  padding: 15px 25px;
  border-radius: var(--radius-md);
  color: white;
  font-weight: bold;
  box-shadow: var(--shadow-lg);
  display: none;
  animation: slideInRight 0.5s ease;
}

.modal-overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(15,18,25,0.6);
  backdrop-filter: blur(5px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
}
.modal-overlay.active {
  opacity: 1; pointer-events: auto;
}
.modal-content {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  padding: 30px;
  width: 90%;
  max-width: 600px;
  box-shadow: var(--shadow-xl);
  transform: translateY(20px);
  transition: transform 0.3s ease;
}
.modal-overlay.active .modal-content {
  transform: translateY(0);
}

/* Tabs */
.tabs-container {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--color-gray-100);
  padding-bottom: 16px;
}

.tab-btn {
  padding: 10px 20px;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--color-gray-500);
  border: 1px solid var(--color-gray-200);
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
}

.tab-btn:hover {
  background: var(--color-gray-50);
  color: var(--color-gray-800);
}

.tab-btn.active {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
  box-shadow: var(--shadow-glow);
}

/* ============================================
   Mobile Responsiveness
   ============================================ */
@media (max-width: 768px) {
  /* Navbar */
  .navbar {
    flex-wrap: wrap;
    padding: 15px 5%;
    gap: 15px;
    justify-content: center;
  }
  .nav-links {
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
  }

  /* Typography */
  h1 { font-size: 2.2rem !important; }
  h2 { font-size: 1.8rem !important; }
  p { font-size: 1rem !important; }

  /* Hero / Header spacing */
  header {
    padding: 120px 5% 60px !important;
  }

  /* Grid Layouts */
  .grid-2,
  main section > div {
    grid-template-columns: 1fr !important;
    gap: 30px !important;
  }
  
  /* Make sure text appears before images on mobile in grid rows if they were reordered */
  .mobile-reverse {
    display: flex;
    flex-direction: column-reverse;
  }

  /* Buttons */
  .btn {
    width: 100%;
    margin-bottom: 10px;
  }
  header .btn {
    width: 100%;
  }
  header div[style*="display: flex"] {
    flex-direction: column;
  }

  /* Mega Footer */
  footer > div {
    grid-template-columns: 1fr !important;
    text-align: center;
  }
  footer ul {
    display: flex;
    flex-direction: column;
    align-items: center;
  }
}

