/* ============================================
   P.I.A. Mobile PWA - CSS Mobile-First
   Material Design + Action-Oriented
   ============================================ */

:root {
  /* Couleurs par profil */
  --color-do: #1E40AF;
  --color-artisan: #F59E0B;
  --color-b2c: #10B981;
  --color-expert: #8B5CF6;
  
  /* Couleurs de base */
  --bg: #FFFFFF;
  --bg-secondary: #F3F4F6;
  --text: #111827;
  --text-light: #6B7280;
  --border: #E5E7EB;
  --shadow: rgba(0, 0, 0, 0.1);
  
  /* Accents */
  --primary: #7C5CFF;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  
  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  
  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  
  /* Touch targets (minimum 44x44px) */
  --touch-target: 44px;
  
  /* Bottom nav height */
  --bottom-nav-height: 64px;
}

/* ============================================
   RESET & BASE
   ============================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  /* Fix Safari pointer events */
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

/* Ensure links and buttons are clickable on Safari/iOS */
a, button {
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  pointer-events: auto !important;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding-bottom: var(--bottom-nav-height); /* Espace pour bottom nav */
}

/* Safe area insets pour iPhone X+ */
body {
  padding-top: env(safe-area-inset-top);
  padding-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
}

/* Disable pull-to-refresh on mobile */
body {
  overscroll-behavior-y: contain;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: var(--space-md);
}

h1 { font-size: 28px; }
h2 { font-size: 24px; }
h3 { font-size: 20px; }
h4 { font-size: 18px; }
h5 { font-size: 16px; }
h6 { font-size: 14px; }

p {
  margin-bottom: var(--space-md);
}

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

.text-sm {
  font-size: 14px;
}

.text-xs {
  font-size: 12px;
}

/* ============================================
   LANDING PAGE - 4 PROFILS
   ============================================ */

.landing-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: var(--space-lg);
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.landing-header {
  text-align: center;
  color: white;
  margin-bottom: var(--space-xl);
  padding-top: var(--space-xl);
}

.landing-logo {
  font-size: 48px;
  margin-bottom: var(--space-sm);
}

.landing-title {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: var(--space-xs);
  color: white;
}

.landing-subtitle {
  font-size: 16px;
  opacity: 0.9;
  font-weight: 400;
  color: white;
}

.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
  flex: 1;
  align-content: center;
}

.profile-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 160px;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  color: var(--text);
  -webkit-tap-highlight-color: rgba(0,0,0,0.1);
  touch-action: manipulation;
  /* Safari iOS fixes */
  -webkit-user-select: none;
  user-select: none;
  position: relative;
  z-index: 1;
}

.profile-card:active {
  transform: scale(0.95);
  box-shadow: var(--shadow-md);
}

.profile-icon {
  font-size: 48px;
  margin-bottom: var(--space-sm);
}

.profile-name {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

.profile-desc {
  font-size: 12px;
  color: var(--text-light);
  line-height: 1.4;
}

/* Couleurs par profil */
.profile-card.do {
  border-top: 4px solid var(--color-do);
}

.profile-card.artisan {
  border-top: 4px solid var(--color-artisan);
}

.profile-card.b2c {
  border-top: 4px solid var(--color-b2c);
}

.profile-card.expert {
  border-top: 4px solid var(--color-expert);
}

/* ============================================
   HEADER MOBILE
   ============================================ */

.mobile-header {
  position: sticky;
  top: 0;
  background: white;
  border-bottom: 1px solid var(--border);
  padding: var(--space-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 100;
  min-height: 56px;
}

.header-back {
  width: var(--touch-target);
  height: var(--touch-target);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 24px;
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

.header-back:active {
  background: var(--bg-secondary);
}

.header-title {
  font-size: 18px;
  font-weight: 600;
  flex: 1;
  text-align: center;
}

.header-profile {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.header-profile-icon {
  font-size: 24px;
}

.header-menu {
  width: var(--touch-target);
  height: var(--touch-target);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 24px;
  color: var(--text);
}

/* ============================================
   BOTTOM NAVIGATION
   ============================================ */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background: white;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  text-decoration: none;
  color: var(--text-light);
  font-size: 12px;
  padding: var(--space-sm);
  transition: color 0.2s;
  -webkit-tap-highlight-color: transparent;
  min-height: var(--touch-target);
}

.bottom-nav-item.active {
  color: var(--primary);
}

.bottom-nav-icon {
  font-size: 24px;
}

.bottom-nav-label {
  font-size: 11px;
  font-weight: 500;
}

/* ============================================
   CARDS
   ============================================ */

.card {
  background: white;
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin-bottom: var(--space-md);
  box-shadow: var(--shadow-sm);
}

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

.card-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
}

.card-content {
  line-height: 1.6;
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  min-height: var(--touch-target);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

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

.btn-primary:active {
  background: #6B46E5;
  transform: scale(0.98);
}

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

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

.btn-outline {
  background: transparent;
  border: 2px solid var(--border);
  color: var(--text);
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn-lg {
  padding: 16px 32px;
  font-size: 18px;
  border-radius: var(--radius-lg);
}

/* ============================================
   FAB (Floating Action Button)
   ============================================ */

.fab {
  position: fixed;
  bottom: calc(var(--bottom-nav-height) + var(--space-md));
  right: var(--space-md);
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background: var(--primary);
  color: white;
  border: none;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  cursor: pointer;
  z-index: 90;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.fab:active {
  transform: scale(0.9);
}

/* ============================================
   CONTAINER
   ============================================ */

.container {
  padding: var(--space-md);
  max-width: 100%;
}

/* ============================================
   UTILITIES
   ============================================ */

.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }

.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }

.p-sm { padding: var(--space-sm); }
.p-md { padding: var(--space-md); }
.p-lg { padding: var(--space-lg); }

.text-center { text-align: center; }
.text-right { text-align: right; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }

/* ============================================
   RESPONSIVE
   ============================================ */

@media (min-width: 768px) {
  .landing-container {
    padding: var(--space-xl);
  }
  
  .profile-grid {
    max-width: 600px;
    margin: 0 auto;
  }
  
  .container {
    max-width: 768px;
    margin: 0 auto;
  }
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.3s ease-out;
}

/* ============================================
   DARK MODE (Optionnel)
   ============================================ */

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111827;
    --bg-secondary: #1F2937;
    --text: #F9FAFB;
    --text-light: #9CA3AF;
    --border: #374151;
  }
  
  .landing-container {
    background: linear-gradient(135deg, #1F2937 0%, #111827 100%);
  }
}
