/* ===================================
   WEBAMAX HANDHELD SYSTEM
   Mobile-First Terminal Experience < 768px
   =================================== */

@media (max-width: 768px) {
  
  /* === SKIP LINK HIDDEN ON MOBILE === */
  .skip-link {
    display: none !important;
  }
  
  /* === BOTTOM TAB BAR NAVIGATION === */
  /* NOTE: Ces styles sont overridden par mobile-navbar-fix.css pour garantir la cohérence multi-pages */
  .nb-header {
    position: fixed !important;
    top: auto !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    border-bottom: none !important;
    border-top: 1px solid rgba(148, 163, 184, 0.2) !important;
    background: rgba(248, 250, 252, 0.98) !important;
    backdrop-filter: blur(20px) !important;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05) !important;
    height: auto !important;
  }
  
  .nb-container {
    padding: 0 !important;
    height: auto !important;
    max-width: 100% !important;
  }
  
  .nb-logo {
    position: fixed !important;
    top: var(--wb-space-md) !important;
    left: var(--wb-space-lg) !important;
    bottom: auto !important;
    z-index: 1001 !important;
    font-size: 1rem !important;
    gap: var(--wb-space-sm) !important;
  }
  
  .nb-logo-photo {
    display: none !important;
  }
  
  .nb-logo span {
    display: none !important;
  }
  
  .nb-status {
    display: none !important;
  }
  
  .nb-toggle,
  .nb-action {
    display: none !important;
  }
  
  .nb-nav {
    display: flex !important;
    position: static !important;
    flex-direction: row !important;
    justify-content: space-around !important;
    align-items: center !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    width: 100% !important;
    max-height: none !important;
    height: auto !important;
  }
  
  .nb-nav li {
    flex: 1 !important;
    border: none !important;
    margin: 0 !important;
  }
  
  .nb-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: var(--wb-space-sm) var(--wb-space-xs);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--wb-text-muted);
    transition: var(--wb-transition);
    position: relative;
  }
  
  .nb-link::before {
    content: attr(data-index);
    font-size: 0.5rem;
    color: var(--wb-primary);
    opacity: 0.5;
  }
  
  .nb-link.active,
  .nb-link:hover {
    color: var(--wb-primary);
  }
  
  .nb-link.active::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 2px;
    background: var(--wb-gradient-primary);
  }
  
  /* === BODY PADDING FOR BOTTOM NAV === */
  /* Note: Le padding-bottom est géré par le footer lui-même */
  body {
    scroll-padding-top: 0;
  }
  
  html {
    scroll-behavior: smooth;
  }
  
  /* Scroll margin for all sections with IDs */
  section[id],
  div[id] {
    scroll-margin-top: 0;
  }
  
  .wb-hero {
    padding-top: 0;
    min-height: calc(100vh - 64px);
  }
  
  /* === CARD-SYSTEM MODULES === */
  .wb-card,
  .kpi-card,
  .solution-module,
  .case-study,
  .wb-testimonial {
    position: relative;
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: var(--wb-radius-md);
    background: var(--wb-surface);
  }
  
  .wb-card::before,
  .kpi-card::before,
  .solution-module::before,
  .case-study::before {
    content: 'REF_' attr(data-module-id);
    position: absolute;
    top: var(--wb-space-sm);
    right: var(--wb-space-sm);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.5rem;
    font-weight: 700;
    color: rgba(79, 70, 229, 0.3);
    letter-spacing: 0.1em;
    text-transform: uppercase;
  }
  
  /* Brackets decoration */
  .wb-card-body::before,
  .wb-card-body::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    border: 1px solid rgba(79, 70, 229, 0.2);
  }
  
  .wb-card-body::before {
    top: var(--wb-space-md);
    left: var(--wb-space-md);
    border-right: none;
    border-bottom: none;
  }
  
  .wb-card-body::after {
    bottom: var(--wb-space-md);
    right: var(--wb-space-md);
    border-left: none;
    border-top: none;
  }
  
  /* === TYPOGRAPHY DENSITY === */
  .wb-text-body,
  .wb-text-body-lg {
    font-size: 0.9375rem;
    line-height: 1.7;
  }
  
  .wb-text-caption {
    font-size: 0.75rem;
    line-height: 1.6;
  }
  
  /* === STATUS INDICATORS === */
  .system-status,
  .status-indicator {
    display: inline-flex;
    align-items: center;
    gap: var(--wb-space-xs);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--wb-primary);
  }
  
  .system-status::before,
  .status-indicator::before {
    content: '●';
    color: #10b981;
    animation: pulse-status 2s ease-in-out infinite;
  }
  
  /* === BUTTON BRACKETS === */
  .wb-btn {
    position: relative;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8125rem;
    letter-spacing: 0.05em;
  }
  
  .wb-btn::before {
    content: '[';
    margin-right: var(--wb-space-xs);
    opacity: 0.5;
  }
  
  .wb-btn::after {
    content: ']';
    margin-left: var(--wb-space-xs);
    opacity: 0.5;
  }
  
  /* === IDE FOCUS MODE === */
  .ide-container {
    position: relative;
    border-radius: var(--wb-radius-lg);
    overflow: hidden;
    min-height: 80vh;
  }
  
  .ide-sidebar {
    display: none;
  }
  
  .ide-main {
    grid-column: 1;
  }
  
  .ide-tabs {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -ms-overflow-style: none;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  }
  
  .ide-tabs::-webkit-scrollbar {
    display: none;
  }
  
  .ide-tab {
    scroll-snap-align: start;
    flex-shrink: 0;
    min-width: 140px;
    padding: var(--wb-space-md) var(--wb-space-lg);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    border-right: 1px solid rgba(148, 163, 184, 0.1);
    position: relative;
  }
  
  .ide-tab::before {
    content: '//';
    margin-right: var(--wb-space-xs);
    color: var(--wb-primary);
    opacity: 0.5;
  }
  
  .ide-tab.active {
    background: rgba(79, 70, 229, 0.05);
    border-bottom: 2px solid var(--wb-primary);
  }
  
  /* Swipe indicator */
  .ide-tabs::after {
    content: '← swipe →';
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.625rem;
    color: var(--wb-text-muted);
    opacity: 0.5;
    pointer-events: none;
  }
  
  .tab-content {
    padding: var(--wb-space-lg);
    min-height: 60vh;
  }
  
  /* Project navigation */
  .project-nav {
    display: flex;
    justify-content: space-between;
    padding: var(--wb-space-md);
    border-top: 1px solid rgba(148, 163, 184, 0.1);
    background: rgba(248, 250, 252, 0.5);
  }
  
  .project-nav-btn {
    display: flex;
    align-items: center;
    gap: var(--wb-space-xs);
    padding: var(--wb-space-sm) var(--wb-space-md);
    background: transparent;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: var(--wb-radius-md);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: var(--wb-text-secondary);
    cursor: pointer;
    transition: var(--wb-transition);
  }
  
  .project-nav-btn:active {
    background: rgba(79, 70, 229, 0.05);
    border-color: var(--wb-primary);
    color: var(--wb-primary);
  }
  
  /* === SECTION HEADERS WITH BRACKETS === */
  .wb-text-h1,
  .wb-text-h2,
  .wb-text-h3 {
    position: relative;
    padding-left: var(--wb-space-md);
  }
  
  .wb-text-h1::before,
  .wb-text-h2::before,
  .wb-text-h3::before {
    content: '[';
    position: absolute;
    left: 0;
    color: var(--wb-primary);
    opacity: 0.3;
  }
  
  .wb-text-h1::after,
  .wb-text-h2::after,
  .wb-text-h3::after {
    content: ']';
    margin-left: var(--wb-space-xs);
    color: var(--wb-primary);
    opacity: 0.3;
  }
  
  /* === TERMINAL AESTHETIC === */
  .code-block {
    background: rgba(2, 6, 23, 0.95);
    border: 1px solid rgba(79, 70, 229, 0.2);
    border-radius: var(--wb-radius-md);
    padding: var(--wb-space-lg);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    line-height: 1.6;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .terminal-dots {
    display: flex;
    gap: var(--wb-space-xs);
  }
  
  .terminal-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--wb-text-muted);
    opacity: 0.3;
  }
  
  /* === SMOOTH TRANSITIONS === */
  .page-transition {
    animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  @keyframes slideIn {
    from {
      opacity: 0;
      transform: translateX(20px);
    }
    to {
      opacity: 1;
      transform: translateX(0);
    }
  }
  
  .fade-transition {
    animation: fadeIn 0.2s ease-out;
  }
  
  @keyframes fadeIn {
    from {
      opacity: 0;
    }
    to {
      opacity: 1;
    }
  }
  
  /* === GRID SYSTEM === */
  .wb-grid-2,
  .wb-grid-3 {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--wb-space-lg);
  }
  
  /* === HERO ADJUSTMENTS === */
  .wb-hero-container {
    padding: var(--wb-space-lg);
    text-align: left;
  }
  
  .wb-hero-badge {
    font-size: 0.75rem;
    padding: var(--wb-space-xs) var(--wb-space-md);
  }
  
  .wb-hero-badge::before {
    content: '//';
    margin-right: var(--wb-space-xs);
    color: var(--wb-primary);
  }
  
  /* === FOOTER COMPACT === */
  .wb-footer {
    /* Padding pour laisser de l'espace pour la nav-bar en bas */
    padding-bottom: calc(var(--wb-space-xl) + 64px);
    margin-bottom: 0;
  }
  
  .wb-footer-content {
    grid-template-columns: 1fr;
    gap: var(--wb-space-2xl);
  }
  
  .wb-footer-label {
    font-size: 0.625rem;
  }
  
  /* === WHATSAPP BUTTON === */
  .wb-whatsapp-btn {
    /* Position fixe pour rester visible en permanence */
    position: fixed !important;
    bottom: 84px !important; /* 64px nav-bar + 20px marge */
    right: var(--wb-space-lg) !important;
    
    /* Style Architecte - Carré arrondi */
    width: 48px !important;
    height: 48px !important;
    border-radius: var(--wb-radius-sm) !important; /* Coins légèrement arrondis */
    
    /* Fond sombre avec bordure primaire */
    background: rgba(2, 6, 23, 0.95) !important;
    border: 1px solid var(--wb-primary) !important;
    
    /* Z-index sous la nav-bar */
    z-index: 999 !important;
    
    /* Suppression de l'ombre verte par défaut */
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.2) !important;
    
    /* Transition fluide */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  }
  
  .wb-whatsapp-btn svg {
    width: 24px !important;
    height: 24px !important;
    fill: var(--wb-primary) !important; /* Icône en couleur primaire */
  }
  
  /* Animation pulse sur la bordure */
  .wb-whatsapp-btn::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: var(--wb-radius-sm);
    border: 2px solid var(--wb-primary);
    opacity: 0;
    animation: whatsapp-pulse 3s ease-in-out infinite;
    pointer-events: none;
  }
  
  @keyframes whatsapp-pulse {
    0%, 100% {
      opacity: 0;
      transform: scale(1);
    }
    50% {
      opacity: 0.4;
      transform: scale(1.08);
    }
  }
  
  /* État active pour mobile */
  .wb-whatsapp-btn:active {
    transform: scale(0.95) !important;
    background: rgba(2, 6, 23, 1) !important;
    border-color: var(--wb-secondary) !important;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4) !important;
  }
  
  .wb-whatsapp-btn:active svg {
    fill: var(--wb-secondary) !important;
  }
  
  /* === CATALOG SECTIONS === */
  .catalog-item {
    position: relative;
    padding: var(--wb-space-lg);
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: var(--wb-radius-md);
    background: var(--wb-surface);
    margin-bottom: var(--wb-space-lg);
  }
  
  .catalog-item::before {
    content: 'MODULE_' attr(data-id);
    position: absolute;
    top: var(--wb-space-sm);
    right: var(--wb-space-sm);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.5rem;
    font-weight: 700;
    color: rgba(79, 70, 229, 0.3);
    letter-spacing: 0.1em;
  }
  
  /* === TESTIMONIALS === */
  .wb-testimonial {
    padding: var(--wb-space-lg);
    border-left: 3px solid var(--wb-primary);
  }
  
  .wb-testimonial::before {
    content: '//';
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.5rem;
    color: var(--wb-primary);
    opacity: 0.3;
    display: block;
    margin-bottom: var(--wb-space-sm);
  }
  
  /* === STATS GRID === */
  .wb-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--wb-space-md);
  }
  
  .wb-stat {
    padding: var(--wb-space-md);
    border: 1px solid rgba(148, 163, 184, 0.15);
  }
  
  .wb-stat::before {
    content: '[';
    position: absolute;
    top: var(--wb-space-sm);
    left: var(--wb-space-sm);
    font-family: 'JetBrains Mono', monospace;
    color: var(--wb-primary);
    opacity: 0.3;
  }
  
  .wb-stat::after {
    content: ']';
    position: absolute;
    bottom: var(--wb-space-sm);
    right: var(--wb-space-sm);
    font-family: 'JetBrains Mono', monospace;
    color: var(--wb-primary);
    opacity: 0.3;
  }
  
  /* === DISABLE HOVER EFFECTS === */
  .wb-btn:hover,
  .wb-card:hover,
  .kpi-card:hover,
  .solution-module:hover,
  .wb-tech-badge:hover {
    transform: none;
  }
  
  /* === ACTIVE STATES FOR TOUCH === */
  .wb-btn:active {
    transform: scale(0.98);
    opacity: 0.9;
  }
  
  .wb-card:active {
    border-color: var(--wb-primary);
  }
  
  /* === ENHANCED TERMINAL AESTHETICS === */
  
  /* Module brackets decoration */
  .wb-card-body {
    position: relative;
  }
  
  .wb-card-body::before,
  .wb-card-body::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(79, 70, 229, 0.25);
    pointer-events: none;
  }
  
  .wb-card-body::before {
    top: var(--wb-space-md);
    left: var(--wb-space-md);
    border-right: none;
    border-bottom: none;
  }
  
  .wb-card-body::after {
    bottom: var(--wb-space-md);
    right: var(--wb-space-md);
    border-left: none;
    border-top: none;
  }
  
  /* Terminal prompt style for lists */
  .wb-list li::before {
    content: '>';
    color: var(--wb-primary);
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
  }
  
  /* Code-style badges */
  .wb-badge,
  .wb-tech-badge {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6875rem;
    letter-spacing: 0.05em;
    border: 1px solid rgba(148, 163, 184, 0.2);
  }
  
  .wb-badge::before {
    content: '<';
    margin-right: 2px;
    opacity: 0.5;
  }
  
  .wb-badge::after {
    content: '/>';
    margin-left: 2px;
    opacity: 0.5;
  }
  
  /* Section dividers */
  .wb-section::before {
    content: '';
    display: block;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(79, 70, 229, 0.2), transparent);
    margin-bottom: var(--wb-space-2xl);
  }
  
  /* Terminal-style inputs */
  .wb-input,
  .wb-textarea,
  .wb-select {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    background: rgba(2, 6, 23, 0.02);
    border: 1px solid rgba(148, 163, 184, 0.2);
    color: var(--wb-text-primary);
  }
  
  .wb-input::placeholder,
  .wb-textarea::placeholder {
    font-family: 'JetBrains Mono', monospace;
    opacity: 0.5;
  }
  
  .wb-input:focus,
  .wb-textarea:focus,
  .wb-select:focus {
    border-color: var(--wb-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    outline: none;
  }
  
  /* Glitch effect on hover for titles */
  .wb-text-h1,
  .wb-text-h2 {
    position: relative;
  }
  
  /* System grid background */
  body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
      linear-gradient(rgba(79, 70, 229, 0.08) 1px, transparent 1px),
      linear-gradient(90deg, rgba(79, 70, 229, 0.08) 1px, transparent 1px);
    background-size: 20px 20px;
    pointer-events: none;
    z-index: 0;
    opacity: 0.8;
  }
  
  /* Enhanced status bar */
  .status-bar {
    background: rgba(2, 6, 23, 0.02);
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: var(--wb-radius-md);
    padding: var(--wb-space-md);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
  }
  
  /* Loading animation for modules */
  @keyframes moduleLoad {
    0% {
      opacity: 0;
      transform: translateY(10px);
    }
    100% {
      opacity: 1;
      transform: translateY(0);
    }
  }
  
  .wb-card {
    animation: moduleLoad 0.4s cubic-bezier(0.4, 0, 0.2, 1) backwards;
  }
  
  .wb-card:nth-child(1) { animation-delay: 0.05s; }
  .wb-card:nth-child(2) { animation-delay: 0.1s; }
  .wb-card:nth-child(3) { animation-delay: 0.15s; }
  .wb-card:nth-child(4) { animation-delay: 0.2s; }
  .wb-card:nth-child(5) { animation-delay: 0.25s; }
  .wb-card:nth-child(6) { animation-delay: 0.3s; }
  
  /* Command-line style links */
  a:not(.wb-btn):not(.nb-link):not(.nb-logo) {
    color: var(--wb-primary);
    text-decoration: none;
    position: relative;
    font-family: 'JetBrains Mono', monospace;
  }
  
  a:not(.wb-btn):not(.nb-link):not(.nb-logo)::before {
    content: '$';
    margin-right: 4px;
    opacity: 0.5;
  }
  
  /* Scan line effect */
  @keyframes scanline {
    0% {
      transform: translateY(-100%);
    }
    100% {
      transform: translateY(100vh);
    }
  }
  
  body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(79, 70, 229, 0.3), transparent);
    pointer-events: none;
    z-index: 9999;
    animation: scanline 8s linear infinite;
    opacity: 0.3;
  }
  .wb-section {
    padding: var(--wb-space-2xl) 0;
  }
  
  .wb-container {
    padding: 0 var(--wb-space-lg);
  }
}

/* === VERY SMALL SCREENS === */
@media (max-width: 374px) {
  .nb-link {
    font-size: 0.5625rem;
    padding: var(--wb-space-xs);
  }
  
  .wb-stats {
    grid-template-columns: 1fr;
  }
  
  .terminal-body,
  .code-block {
    font-size: 0.6875rem;
    padding: var(--wb-space-md);
  }
}
