/* =====================================================
   TinyToolWeb - index.css (Standalone Homepage Styles)
   Version nettoyée et corrigée
   ===================================================== */

/* =====================================================
   1) Design Tokens
   ===================================================== */

:root {
  /* Brand */
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #3b82f6;

  /* Status */
  --success: #10b981;
  --success-hover: #059669;
  --warning: #f59e0b;
  --error: #ef4444;
  --info: #3b82f6;

  /* Text (Light) */
  --text-dark: #1f2937;
  --text-medium: #4b5563;
  --text-light: #6b7280;
  --text-lighter: #9ca3af;

  /* Surfaces (Light) */
  --bg-body: #ffffff;
  --bg-surface: #ffffff;
  --bg-surface-hover: #f9fafb;
  --bg-light: #f9fafb;
  --bg-lighter: #f3f4f6;

  /* Borders */
  --border: #e5e7eb;
  --border-dark: #d1d5db;
  --border-focus: #2563eb;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.05);
  --shadow: 0 1px 3px 0 rgba(0,0,0,0.1), 0 1px 2px 0 rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);

  /* Gradient */
  --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);

  /* Spacing */
  --spacing-xs: 0.5rem;
  --spacing-sm: 0.75rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-xxl: 3rem;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* Transitions */
  --transition-fast: 150ms ease-in-out;
  --transition-base: 200ms ease-in-out;
  --transition-slow: 300ms ease-in-out;
}

/* Utility classes */
.hidden {
  display: none !important;
}

/* Dark Mode Variables */
.dark,
[data-theme="dark"] {
  --text-dark: #ffffff;
  --text-medium: #e5e7eb;
  --text-light: #a1a1aa;
  --text-lighter: #71717a;

  --bg-body: #000000;
  --bg-surface: #0a0a0a;
  --bg-surface-hover: #171717;
  --bg-light: #0a0a0a;
  --bg-lighter: #171717;

  --border: #262626;
  --border-dark: #404040;
  --border-focus: #3b82f6;

  --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.5);
  --shadow: 0 2px 4px 0 rgba(0,0,0,0.6), 0 1px 2px 0 rgba(0,0,0,0.4);
  --shadow-md: 0 4px 8px -1px rgba(0,0,0,0.6), 0 2px 4px -1px rgba(0,0,0,0.4);
  --shadow-lg: 0 10px 20px -3px rgba(0,0,0,0.7), 0 4px 6px -2px rgba(0,0,0,0.5);

  --gradient-primary: linear-gradient(135deg, #4c51bf 0%, #6b46c1 100%);
}

/* =====================================================
   2) Reset & Base
   ===================================================== */

* { 
  margin: 0; 
  padding: 0; 
  box-sizing: border-box; 
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  color: var(--text-dark);
  background-color: var(--bg-body);
  transition: background-color var(--transition-base), color var(--transition-base);
}

/* =====================================================
   3) Layout
   ===================================================== */

.container { 
  max-width: 1200px; 
  margin: 0 auto; 
  padding: 0 var(--spacing-md); 
  width: 100%; 
}

/* =====================================================
   4) Header
   ===================================================== */

header {
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: var(--spacing-md) 0;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow-sm);
  transition: background-color var(--transition-base), border-color var(--transition-base);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--spacing-md);
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition-base);
}

.logo:hover { 
  color: var(--primary-hover); 
}

.theme-toggle {
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-medium);
  transition: all var(--transition-base);
}

.theme-toggle:hover { 
  background: var(--bg-surface-hover); 
  border-color: var(--border-dark); 
}

.theme-toggle svg { 
  width: 18px; 
  height: 18px; 
}

/* =====================================================
   5) Hero Section (Ultra Compact)
   ===================================================== */

.hero {
  background: var(--gradient-primary);
  color: white;
  padding: 1.2rem 1rem;
  text-align: center;
}

.hero h1 {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.hero p,
.hero-description {
  font-size: 0.875rem;
  margin-bottom: 1rem;
  opacity: 0.9;
}

/* =====================================================
   6) Search
   ===================================================== */

.search-container {
  max-width: 500px;
  margin: 0 auto 0.8rem;
}

.search-input {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-lg);
  border: none;
  font-size: 0.95rem;
  box-shadow: 0 6px 15px rgba(0,0,0,0.15);
  transition: all var(--transition-base);
}

.search-input:focus {
  outline: none;
  box-shadow: 0 10px 20px rgba(0,0,0,0.2);
  transform: translateY(-1px);
}

.search-input::placeholder {
  color: #9ca3af;
  opacity: 1;
}

.dark .search-input,
[data-theme="dark"] .search-input {
  background: var(--bg-surface);
  color: var(--text-dark);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.dark .search-input::placeholder,
[data-theme="dark"] .search-input::placeholder {
  color: var(--text-light);
  opacity: 1;
}

.dark .search-input:focus,
[data-theme="dark"] .search-input:focus {
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.7);
}

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border-radius: var(--radius-lg);
  margin-top: var(--spacing-sm);
  box-shadow: var(--shadow-lg);
  max-height: 400px;
  overflow-y: auto;
  display: none;
  z-index: 10;
}

.dark .search-results,
[data-theme="dark"] .search-results {
  background: var(--bg-surface);
  border: 1px solid var(--border);
}

/* =====================================================
   7) Category Navigation
   ===================================================== */

.category-nav {
  margin-top: 0.5rem;
}

.category-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
}

.category-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.35rem 0.65rem;
  background: rgba(255,255,255,0.15);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: white;
  font-weight: 600;
  font-size: 0.8rem;
  transition: all var(--transition-base);
}

.category-link:hover {
  background: rgba(255,255,255,0.3);
  transform: translateY(-1px);
}

/* =====================================================
   8) Main Content
   ===================================================== */

main { 
  padding: var(--spacing-xl) 0 3rem; 
}

/* =====================================================
   9) Category Sections
   ===================================================== */

.category {
  margin-bottom: var(--spacing-xxl);
}

.category-title {
  font-size: 1.75rem;
  margin-bottom: var(--spacing-lg);
  color: var(--text-dark);
  font-weight: 700;
  border-bottom: 3px solid var(--primary);
  padding-bottom: var(--spacing-sm);
}

/* =====================================================
   10) Tools Grid
   ===================================================== */

.tools-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--spacing-md);
}

.tool-card {
  background: var(--bg-surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  text-decoration: none;
  color: var(--text-dark);
  transition: all var(--transition-base);
  display: block;
  min-width: 0;
  min-height: 140px;
  position: relative;
}

.tool-card:hover {
  border-color: var(--primary);
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.tool-card h3 {
  font-size: 1rem;
  margin-bottom: var(--spacing-sm);
  color: var(--primary);
  font-weight: 700;
}

.tool-card p {
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--text-medium);
  margin: 0;
}

/* =====================================================
   11) Favorites System
   ===================================================== */

.favorites-section {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  padding: var(--spacing-xl) 0;
  margin-bottom: var(--spacing-lg);
}

[data-theme="dark"] .favorites-section {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
}

.favorites-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-lg);
}

.favorites-header h2 {
  margin: 0;
  color: white;
  font-size: 1.75rem;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.btn-clear-favorites {
  padding: var(--spacing-xs) var(--spacing-md);
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-sm);
  color: white;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-base);
  backdrop-filter: blur(10px);
}

.btn-clear-favorites:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.favorite-btn {
  position: absolute;
  top: var(--spacing-sm);
  right: var(--spacing-sm);
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid var(--border);
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all var(--transition-base);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  filter: grayscale(100%);
  opacity: 0.6;
}

.favorite-btn:hover {
  transform: scale(1.15);
  filter: grayscale(0%);
  opacity: 1;
  background: white;
  box-shadow: 0 4px 12px rgba(251, 191, 36, 0.4);
}

.favorite-btn.active {
  filter: grayscale(0%);
  opacity: 1;
  background: #fbbf24;
  border-color: #f59e0b;
  animation: favorite-pulse 0.3s ease-out;
}

.favorite-btn.active:hover {
  background: #f59e0b;
}

@keyframes favorite-pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.3);
  }
  100% {
    transform: scale(1);
  }
}

[data-theme="dark"] .favorite-btn {
  background: rgba(30, 41, 59, 0.9);
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .favorite-btn.active {
  background: #d97706;
  border-color: #b45309;
}

[data-theme="dark"] .favorite-btn:hover {
  background: rgba(30, 41, 59, 1);
}

.favorites-empty {
  text-align: center;
  padding: var(--spacing-xl);
  color: white;
  font-size: 1rem;
  opacity: 0.9;
}

.favorites-empty-icon {
  font-size: 3rem;
  margin-bottom: var(--spacing-sm);
  opacity: 0.7;
}

/* =====================================================
   12) No Results
   ===================================================== */

.no-results {
  text-align: center;
  padding: var(--spacing-xxl);
  background: var(--bg-surface);
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  margin: var(--spacing-xl) 0;
  display: none;
}

.no-results p {
  font-size: 1.125rem;
  color: var(--text-medium);
  margin-bottom: var(--spacing-sm);
}

/* =====================================================
   13) Support Section
   ===================================================== */

.support-section {
  background: var(--gradient-primary);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: var(--spacing-xl);
  text-align: center;
  margin-bottom: var(--spacing-xl);
  box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3);
}

.support-section h2 {
  margin-bottom: var(--spacing-md);
  font-size: 1.5rem;
}

.support-section p {
  margin-bottom: var(--spacing-lg);
  opacity: 0.9;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-xs);
  padding: 0.625rem 1.25rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
}

.donate-btn {
  background: white;
  color: var(--primary);
  font-weight: 600;
  padding: 0.75rem 2rem;
  font-size: 1rem;
  border-radius: var(--radius-md);
}

.donate-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
}

/* =====================================================
   14) Footer
   ===================================================== */

footer {
  background-color: var(--bg-surface);
  border-top: 1px solid var(--border);
  margin-top: 3rem;
  transition: background-color var(--transition-base), border-color var(--transition-base);
}

/* Footer Top Section */
.footer-top {
  padding: var(--spacing-xxl) 0;
  border-bottom: 1px solid var(--border);
}

.footer-brand {
  max-width: 600px;
  margin: 0 auto;
  text-align: center;
}

.footer-logo {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0 0 var(--spacing-md) 0;
}

.footer-tagline {
  font-size: 1rem;
  color: var(--text-light);
  line-height: 1.6;
  margin: 0 0 var(--spacing-lg) 0;
}

.footer-social {
  display: flex;
  gap: var(--spacing-md);
  justify-content: center;
}

.social-link {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-light);
  transition: all var(--transition-base);
}

.social-link:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* Footer Content */
.footer-content {
  padding: var(--spacing-xxl) 0;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--spacing-lg);
}

.footer-column h3 {
  font-size: 0.9375rem;
  margin-bottom: var(--spacing-md);
  color: var(--text-dark);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.footer-column ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-column li {
  margin-bottom: var(--spacing-xs);
}

.footer-column a {
  color: var(--text-light);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color var(--transition-base);
}

.footer-column a:hover {
  color: var(--primary);
}

/* Footer Bottom */
.footer-bottom {
  padding: var(--spacing-lg) 0;
  border-top: 1px solid var(--border);
  background: var(--bg-light);
}

.footer-bottom-content {
  display: flex;
  justify-content: center;
  align-items: center;
}

.footer-bottom-content p {
  margin: 0;
  color: var(--text-light);
  font-size: 0.9rem;
}

.footer-links {
  display: flex;
  gap: var(--spacing-sm);
  align-items: center;
}

.footer-links a {
  color: var(--text-light);
  font-size: 0.9rem;
  text-decoration: none;
  transition: color var(--transition-base);
}

.footer-links a:hover {
  color: var(--primary);
}

.footer-links span {
  color: var(--text-lighter);
}

/* Security Badge */
.security-badge {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-xs) var(--spacing-sm);
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
  color: white;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: all var(--transition-base);
  border: 2px solid transparent;
  box-shadow: var(--shadow-sm);
}

.security-badge:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: rgba(255, 255, 255, 0.3);
}

.security-badge svg {
  width: 20px;
  height: 20px;
  stroke: white;
  flex-shrink: 0;
}

.badge-content {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.badge-content strong {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.badge-label {
  font-size: 0.65rem;
  opacity: 0.9;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* =====================================================
   15) Responsive Design
   ===================================================== */

/* Desktop large (4 colonnes) - default */

/* Tablette (3 colonnes) */
@media (max-width: 1024px) {
  .tools-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .footer-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Tablette portrait (2 colonnes) */
@media (max-width: 768px) {
  .hero h1 {
    font-size: 1.3rem;
  }
  
  .hero p,
  .hero-description {
    font-size: 0.8rem;
  }
  
  .search-input {
    font-size: 0.9rem;
    padding: 0.65rem 0.8rem;
  }
  
  .category-links {
    gap: var(--spacing-sm);
  }
  
  .category-link {
    font-size: 0.75rem;
    padding: 0.3rem 0.55rem;
  }
  
  .tools-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .footer-top {
    padding: var(--spacing-xl) 0;
  }
  
  .footer-content {
    padding: var(--spacing-xl) 0;
  }
  
  .footer-bottom-content {
    flex-direction: column;
    gap: var(--spacing-sm);
    text-align: center;
  }

  .footer-links {
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .security-badge {
    margin-top: var(--spacing-xs);
  }

  .favorites-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-sm);
  }

  .btn-clear-favorites {
    width: 100%;
  }

  .favorite-btn {
    width: 32px;
    height: 32px;
    font-size: 1rem;
  }
}

/* Mobile (1 colonne) */
@media (max-width: 480px) {
  .hero {
    padding: 1rem 0.8rem;
  }

  .hero h1 {
    font-size: 1.15rem;
  }

  .hero p,
  .hero-description {
    font-size: 0.75rem;
  }

  .search-input {
    font-size: 0.85rem;
    padding: 0.6rem 0.75rem;
  }

  .category-link {
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
  }

  .tools-grid {
    grid-template-columns: 1fr;
  }
  
  .footer-grid {
    grid-template-columns: 1fr;
  }
  
  .tool-card {
    min-height: 120px;
  }
}

/* ============================================
   LANGUAGE SWITCHER
   ============================================ */
.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.lang-switcher {
    display: flex;
    align-items: center;
    gap: 8px;
}

.lang-btn {
    background: none;
    border: none;
    color: #64748b;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.lang-btn:hover {
    color: #2563eb;
    background: rgba(37, 99, 235, 0.1);
}

.lang-btn.active {
    color: #2563eb;
    background: rgba(37, 99, 235, 0.15);
}

.lang-separator {
    color: #cbd5e1;
    font-size: 14px;
}

/* Responsive */
@media (max-width: 640px) {
    .lang-switcher {
        gap: 6px;
    }
    
    .lang-btn {
        font-size: 13px;
        padding: 4px 8px;
    }
}