/* ==================== CSS VARIABLES ==================== */
:root {
  /* Premium Light Mode - Italian Flag Colors */
  --bg-primary: #fafbfc;
  --bg-secondary: #f3f4f6;
  --bg-tertiary: #ecf0f5;
  --text-primary: #0f472d;
  --text-secondary: #166534;
  --text-tertiary: #4b7561;
  --border-color: #d1e7dd;
  --accent-primary: #00a550;
  --accent-secondary: #c41e3a;
  --accent-hover: #10b981;
  --accent-red-hover: #dc2626;
  --shadow: 0 2px 12px rgba(0, 165, 80, 0.12);
  --shadow-lg: 0 10px 40px rgba(0, 165, 80, 0.16);
  --shadow-hover: 0 8px 24px rgba(0, 165, 80, 0.2);
  --gradient-primary: linear-gradient(135deg, #00a550 0%, #10b981 100%);
  --gradient-secondary: linear-gradient(135deg, #c41e3a 0%, #dc2626 100%);
  --gradient-accent: linear-gradient(90deg, #00a550 0%, #ffffff 50%, #c41e3a 100%);
}

[data-theme="dark"] {
  /* Premium Dark Mode Colors */
  --bg-primary: #0a0815;
  --bg-secondary: #0f0d1f;
  --bg-tertiary: #14111e;
  --text-primary: #f2f0ff;
  --text-secondary: #c4b5fd;
  --text-tertiary: #a78bfa;
  --border-color: rgba(124, 58, 237, 0.25);
  --accent-primary: #7c3aed;
  --accent-secondary: #d946ef;
  --accent-hover: #8b5cf6;
  --accent-red-hover: #f472b6;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 40px rgba(124, 58, 237, 0.2);
  --shadow-hover: 0 8px 24px rgba(124, 58, 237, 0.25);
  --gradient-primary: linear-gradient(135deg, #7c3aed 0%, #8b5cf6 100%);
  --gradient-secondary: linear-gradient(135deg, #d946ef 0%, #f472b6 100%);
  --gradient-accent: linear-gradient(90deg, #7c3aed 0%, rgba(255,255,255,0.1) 50%, #d946ef 100%);
}

/* ==================== RESET & BASE ==================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  transition: background 0.3s ease, color 0.3s ease;
}

/* Arabic Font */
html[lang="ar"],
html[lang="ar"] body,
html[lang="ar"] * {
  font-family: 'Noto Kufi Arabic', -apple-system, BlinkMacSystemFont, sans-serif;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ==================== HEADER ==================== */
.header {
  background: rgba(243, 244, 246, 0.7);
  backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
}

[data-theme="dark"] .header {
  background: rgba(15, 13, 31, 0.6);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.5rem;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-decoration: none;
  transition: transform 0.3s ease;
}

.logo:hover {
  transform: scale(1.05);
}

[data-theme="dark"] .logo {
  background: linear-gradient(135deg, #7c3aed 0%, #8b5cf6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.theme-toggle:hover {
  background: var(--accent-primary);
  color: white;
  transform: scale(1.1);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
}

.sun-icon {
  display: none;
}

[data-theme="dark"] .sun-icon {
  display: block;
}

[data-theme="dark"] .moon-icon {
  display: none;
}

.btn-back {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-radius: 8px;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s ease;
}

.btn-back:hover {
  background: var(--accent-primary);
  color: white;
  transform: translateX(-4px);
}

.lang-selector {
  padding: 0.5rem 0.75rem;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.875rem;
}

.lang-selector:hover {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}

.lang-selector:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 146, 70, 0.1);
}

[data-theme="dark"] .lang-selector:focus {
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* RTL Support for Arabic */
html[dir="rtl"] {
  direction: rtl;
}

html[dir="rtl"] .header-actions {
  flex-direction: row-reverse;
}

html[dir="rtl"] .btn-back svg {
  order: 2;
  margin-left: 0.5rem;
  margin-right: 0;
}

html[dir="rtl"] .btn-back span {
  order: 1;
}

/* ==================== HERO SECTION ==================== */
.hero {
  padding: 3rem 0;
  text-align: center;
}

.hero h1 {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 0.75rem;
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary, #8b5cf6) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 1.125rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
}

/* ==================== LIQUID GLASS WARNING ==================== */
.glass-warning {
  margin: 2rem auto 0;
  max-width: 800px;
  padding: 1.75rem 2rem;
  background: linear-gradient(
    135deg,
    rgba(0, 146, 70, 0.08),
    rgba(206, 43, 55, 0.05),
    rgba(255, 255, 255, 0.1)
  );
  backdrop-filter: blur(24px) saturate(200%);
  -webkit-backdrop-filter: blur(24px) saturate(200%);
  border-radius: 24px;
  border: 1.5px solid rgba(0, 146, 70, 0.2);
  box-shadow: 
    0 12px 48px rgba(0, 146, 70, 0.12),
    0 4px 16px rgba(206, 43, 55, 0.08),
    inset 0 2px 0 rgba(255, 255, 255, 0.4),
    inset 0 -2px 0 rgba(0, 146, 70, 0.1);
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  position: relative;
  overflow: hidden;
  animation: glassGlow 4s ease-in-out infinite;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-warning:hover {
  transform: translateY(-2px);
  box-shadow: 
    0 16px 56px rgba(0, 146, 70, 0.18),
    0 6px 20px rgba(206, 43, 55, 0.12),
    inset 0 2px 0 rgba(255, 255, 255, 0.5),
    inset 0 -2px 0 rgba(0, 146, 70, 0.15);
  border-color: rgba(0, 146, 70, 0.3);
}

[data-theme="dark"] .glass-warning {
  background: linear-gradient(
    135deg,
    rgba(99, 102, 241, 0.12),
    rgba(139, 92, 246, 0.08),
    rgba(124, 58, 237, 0.06)
  );
  border: 1.5px solid rgba(99, 102, 241, 0.35);
  box-shadow: 
    0 12px 48px rgba(99, 102, 241, 0.25),
    0 4px 16px rgba(139, 92, 246, 0.15),
    inset 0 2px 0 rgba(99, 102, 241, 0.25),
    inset 0 -2px 0 rgba(139, 92, 246, 0.15);
}

[data-theme="dark"] .glass-warning:hover {
  box-shadow: 
    0 16px 56px rgba(99, 102, 241, 0.35),
    0 6px 20px rgba(139, 92, 246, 0.2),
    inset 0 2px 0 rgba(99, 102, 241, 0.3),
    inset 0 -2px 0 rgba(139, 92, 246, 0.2);
  border-color: rgba(99, 102, 241, 0.45);
}

/* Animated gradient background */
.glass-warning::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    circle at center,
    rgba(255, 255, 255, 0.15) 0%,
    transparent 50%
  );
  animation: glassShine 6s linear infinite;
  pointer-events: none;
}

[data-theme="dark"] .glass-warning::before {
  background: radial-gradient(
    circle at center,
    rgba(99, 102, 241, 0.2) 0%,
    transparent 50%
  );
}

/* Shimmer effect */
.glass-warning::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  animation: shimmer 3s ease-in-out infinite;
  pointer-events: none;
}

[data-theme="dark"] .glass-warning::after {
  background: linear-gradient(
    90deg,
    transparent,
    rgba(99, 102, 241, 0.15),
    transparent
  );
}

.glass-warning-icon {
  font-size: 2.25rem;
  flex-shrink: 0;
  animation: iconPulse 2.5s ease-in-out infinite;
  filter: drop-shadow(0 0 12px rgba(255, 193, 7, 0.6)) 
          drop-shadow(0 4px 8px rgba(255, 152, 0, 0.3));
  position: relative;
  z-index: 2;
}

.glass-warning-content {
  flex: 1;
  position: relative;
  z-index: 2;
}

.glass-warning-content h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.625rem;
  background: linear-gradient(135deg, #009246 0%, #ce2b37 50%, #009246 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 4s ease infinite;
  letter-spacing: 0.3px;
  text-shadow: 0 2px 8px rgba(0, 146, 70, 0.1);
}

[data-theme="dark"] .glass-warning-content h3 {
  background: linear-gradient(135deg, #818cf8 0%, #c084fc 50%, #818cf8 100%);
  background-size: 200% 100%;
  animation: gradientShift 4s ease infinite;
  text-shadow: 0 2px 8px rgba(99, 102, 241, 0.2);
}

.glass-warning-content p {
  font-size: 0.925rem;
  line-height: 1.65;
  color: var(--text-secondary);
  margin: 0;
  font-weight: 500;
  opacity: 0.95;
}

/* Enhanced Animations */
@keyframes glassGlow {
  0%, 100% {
    box-shadow: 
      0 12px 48px rgba(0, 146, 70, 0.12),
      0 4px 16px rgba(206, 43, 55, 0.08),
      inset 0 2px 0 rgba(255, 255, 255, 0.4),
      inset 0 -2px 0 rgba(0, 146, 70, 0.1);
  }
  50% {
    box-shadow: 
      0 16px 56px rgba(0, 146, 70, 0.18),
      0 6px 20px rgba(206, 43, 55, 0.12),
      inset 0 2px 0 rgba(255, 255, 255, 0.5),
      inset 0 -2px 0 rgba(0, 146, 70, 0.15);
  }
}

[data-theme="dark"] .glass-warning {
  animation: glassGlowDark 4s ease-in-out infinite;
}

@keyframes glassGlowDark {
  0%, 100% {
    box-shadow: 
      0 12px 48px rgba(99, 102, 241, 0.25),
      0 4px 16px rgba(139, 92, 246, 0.15),
      inset 0 2px 0 rgba(99, 102, 241, 0.25),
      inset 0 -2px 0 rgba(139, 92, 246, 0.15);
  }
  50% {
    box-shadow: 
      0 16px 56px rgba(99, 102, 241, 0.35),
      0 6px 20px rgba(139, 92, 246, 0.2),
      inset 0 2px 0 rgba(99, 102, 241, 0.3),
      inset 0 -2px 0 rgba(139, 92, 246, 0.2);
  }
}

@keyframes glassShine {
  0% {
    transform: translate(-100%, -100%) rotate(45deg);
  }
  100% {
    transform: translate(100%, 100%) rotate(45deg);
  }
}

@keyframes shimmer {
  0%, 100% {
    left: -100%;
    opacity: 0;
  }
  50% {
    left: 100%;
    opacity: 1;
  }
}

@keyframes iconPulse {
  0%, 100% {
    transform: scale(1) rotate(0deg);
  }
  25% {
    transform: scale(1.08) rotate(-3deg);
  }
  50% {
    transform: scale(1.12) rotate(0deg);
  }
  75% {
    transform: scale(1.08) rotate(3deg);
  }
}

@keyframes gradientShift {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

/* RTL Support */
html[dir="rtl"] .glass-warning {
  flex-direction: row-reverse;
}

html[dir="rtl"] .glass-warning::after {
  animation: shimmerRTL 3s ease-in-out infinite;
}

@keyframes shimmerRTL {
  0%, 100% {
    right: -100%;
    left: auto;
    opacity: 0;
  }
  50% {
    right: 100%;
    left: auto;
    opacity: 1;
  }
}

/* ==================== FILTERS ==================== */
.filters-section {
  margin-bottom: 2rem;
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  padding: 1.5rem;
  background: var(--bg-secondary);
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.filter-input,
.filter-select {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: inherit;
  transition: all 0.3s ease;
}

.filter-input:focus,
.filter-select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(0, 146, 70, 0.1);
}

[data-theme="dark"] .filter-input:focus,
[data-theme="dark"] .filter-select:focus {
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.filter-range {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.filter-range label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.filter-range input[type="range"] {
  width: 100%;
  accent-color: var(--accent-primary);
}

.filter-checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.filter-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--accent-primary);
}

.btn-reset {
  padding: 0.75rem 1.5rem;
  background: var(--accent-primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-reset:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 146, 70, 0.3);
}

[data-theme="dark"] .btn-reset:hover {
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* ==================== TABLE ==================== */
.table-section {
  margin-bottom: 3rem;
}

.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.table-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
}

.table-container {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.table-container::-webkit-scrollbar {
  height: 8px;
}

.table-container::-webkit-scrollbar-track {
  background: var(--bg-tertiary);
}

.table-container::-webkit-scrollbar-thumb {
  background: var(--accent-primary);
  border-radius: 4px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 800px;
}

thead {
  background: var(--bg-tertiary);
  position: sticky;
  top: 0;
}

th {
  padding: 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: all 0.3s ease;
}

th:hover {
  background: var(--accent-primary);
  color: white;
}

tbody tr {
  border-bottom: 1px solid var(--border-color);
  transition: all 0.3s ease;
}

tbody tr:hover {
  background: var(--bg-tertiary);
  transform: scale(1.01);
}

td {
  padding: 1rem;
  font-size: 0.875rem;
  color: var(--text-primary);
}

td a {
  color: var(--accent-primary);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s ease;
}

td a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* ==================== PAGINATION ==================== */
.pagination {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.pagination button {
  min-width: 40px;
  height: 40px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.pagination button:hover:not(.active) {
  background: var(--bg-tertiary);
  transform: translateY(-2px);
}

.pagination button.active {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1024px) {
  .container {
    padding: 0 1rem;
  }
  
  .hero h1 {
    font-size: 2rem;
  }
  
  .filters-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }
}

@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }
  
  .hero {
    padding: 2rem 0;
  }
  
  .hero h1 {
    font-size: 1.75rem;
  }
  
  .hero p {
    font-size: 1rem;
  }
  
  .glass-warning {
    flex-direction: column;
    gap: 1rem;
    padding: 1.25rem;
  }
  
  .glass-warning-icon {
    font-size: 1.75rem;
  }
  
  .glass-warning-content h3 {
    font-size: 1rem;
  }
  
  .glass-warning-content p {
    font-size: 0.85rem;
  }
  
  .filters-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
    padding: 1rem;
  }
  
  .table-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  th, td {
    padding: 0.75rem;
    font-size: 0.8rem;
  }
}

@media (max-width: 480px) {
  .logo {
    font-size: 1.25rem;
  }
  
  .header-actions {
    flex-direction: row;
    width: 100%;
    justify-content: space-between;
  }
  
  .hero h1 {
    font-size: 1.5rem;
  }
  
  .hero p {
    font-size: 0.875rem;
  }
  
  .glass-warning {
    padding: 1rem;
    border-radius: 16px;
  }
  
  .glass-warning-icon {
    font-size: 1.5rem;
  }
  
  .glass-warning-content h3 {
    font-size: 0.95rem;
  }
  
  .glass-warning-content p {
    font-size: 0.8rem;
  }
  
  th, td {
    padding: 0.5rem;
    font-size: 0.75rem;
  }
  
  .pagination button {
    min-width: 32px;
    height: 32px;
    font-size: 0.875rem;
  }
}

/* ==================== LOADING STATE ==================== */
.loading {
  text-align: center;
  padding: 3rem;
  color: var(--text-secondary);
}

.loading::after {
  content: '...';
  animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
  0%, 20% { content: '.'; }
  40% { content: '..'; }
  60%, 100% { content: '...'; }
}

/* ==================== LIGHT MODE ENHANCEMENTS ==================== */
[data-theme="light"] .table-container {
  box-shadow: 0 10px 40px rgba(0, 146, 70, 0.08);
}

[data-theme="light"] tbody tr:hover {
  background: rgba(0, 146, 70, 0.05);
}

[data-theme="light"] th:hover {
  background: var(--accent-primary);
  color: white;
}

[data-theme="light"] .pagination button.active {
  background: var(--accent-primary);
  color: white;
}

[data-theme="light"] td a {
  color: var(--accent-primary);
}

[data-theme="light"] td a:hover {
  color: var(--accent-hover);
}
