/* ==========================================================================
   Design System & Styling - Planning Mobile App (Balabar 2026)
   ========================================================================== */

:root {
  /* Color Palette - Vibrant Dark Mode */
  --bg-dark: #0b0f19;
  --bg-card: rgba(22, 30, 49, 0.7);
  --bg-card-hover: rgba(30, 41, 67, 0.85);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-glow: rgba(99, 102, 241, 0.15);

  --primary: #6366f1;
  --primary-light: #818cf8;
  --primary-glow: rgba(99, 102, 241, 0.35);
  --accent-cyan: #06b6d4;
  --accent-pink: #ec4899;
  --accent-green: #10b981;
  --accent-amber: #f59e0b;
  --accent-red: #ef4444;

  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;

  --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-pill: 9999px;

  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Reset & Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 0;
  line-height: 1.5;
}

/* Ambient Background Glow */
.ambient-glow {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.glow-sphere {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.4;
  animation: pulseGlow 12s infinite alternate ease-in-out;
}

.sphere-1 {
  width: 350px;
  height: 350px;
  background: var(--primary);
  top: -100px;
  left: -50px;
}

.sphere-2 {
  width: 400px;
  height: 400px;
  background: var(--accent-cyan);
  bottom: -150px;
  right: -100px;
  animation-delay: -4s;
}

.sphere-3 {
  width: 300px;
  height: 300px;
  background: var(--accent-pink);
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation-delay: -8s;
}

@keyframes pulseGlow {
  0% { transform: scale(1) translate(0, 0); opacity: 0.3; }
  100% { transform: scale(1.2) translate(30px, -20px); opacity: 0.5; }
}

/* Utility Glass Panel */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
}

/* ==========================================================================
   ÉCRAN DE VERROUILLAGE PIN (0000)
   ========================================================================== */
.pin-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  background: rgba(11, 15, 25, 0.92);
  backdrop-filter: blur(20px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-smooth);
}

.pin-screen.active {
  opacity: 1;
  pointer-events: auto;
}

.pin-card {
  width: 100%;
  max-width: 380px;
  padding: 32px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.app-logo {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  overflow: hidden;
  background: transparent;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 auto 8px;
  box-shadow: 0 8px 24px var(--primary-glow);
}

.app-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.pin-header h2 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 1px;
  background: linear-gradient(135deg, #ffffff, var(--primary-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.pin-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.pin-prompt {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--text-main);
}

.pin-dots {
  display: flex;
  gap: 16px;
  margin: 8px 0;
}

.pin-dots .dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--primary-light);
  background: transparent;
  transition: all var(--transition-fast);
}

.pin-dots .dot.filled {
  background: var(--primary-light);
  box-shadow: 0 0 12px var(--primary-light);
  transform: scale(1.15);
}

.pin-dots.shake {
  animation: shake 0.4s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-10px); }
  40%, 80% { transform: translateX(10px); }
}

.pin-error-msg {
  height: 20px;
  font-size: 0.82rem;
  color: var(--accent-red);
  font-weight: 600;
}

/* Pavé numérique */
.numpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  width: 100%;
  max-width: 270px;
  justify-items: center;
  margin: 10px 0;
}

.num-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(10px);
  color: var(--text-main);
  font-size: 1.45rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25), inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.num-btn:hover {
  border-color: var(--primary-light);
  background: rgba(99, 102, 241, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px var(--primary-glow);
}

.num-btn:active {
  background: var(--primary);
  border-color: #ffffff;
  transform: scale(0.92);
  box-shadow: 0 0 20px var(--primary-light);
}

.num-btn.action-btn {
  font-size: 1.1rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
  border: 1.5px dashed rgba(255, 255, 255, 0.2);
}

.num-btn.action-btn:hover {
  color: #ffffff;
  border-style: solid;
  border-color: var(--accent-pink);
  background: rgba(236, 72, 153, 0.15);
}

.pin-footer-hint {
  margin-top: 4px;
  font-size: 0.78rem;
  color: var(--text-dim);
}

.pin-footer-hint code {
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--accent-cyan);
}

/* ==========================================================================
   APPLICATION PRINCIPALE & LAYOUT MOBILE
   ========================================================================== */
.app-wrapper {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-wrapper.hidden {
  display: none !important;
}

.mobile-frame {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px 16px 32px 16px;
}

/* Header */
.app-header {
  padding: 12px 4px 4px 4px;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

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

.brand img {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
}

.brand-badge {
  background: linear-gradient(135deg, var(--primary), var(--accent-cyan));
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.5px;
}

.live-dot {
  width: 8px;
  height: 8px;
  background: var(--accent-green);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-green);
  animation: blink 2s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.icon-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-pill);
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-main);
}

.header-title-section h1 {
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.2;
}

.subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Controls Section (Dropdown, Search, Filters) */
.controls-section {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.select-wrapper {
  position: relative;
  width: 100%;
}

.custom-select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  background: rgba(11, 15, 25, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-main);
  padding: 14px 40px 14px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.custom-select:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.select-arrow {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.7rem;
  color: var(--primary-light);
  pointer-events: none;
}

/* Search box */
.search-box {
  position: relative;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.85rem;
  color: var(--text-muted);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  padding: 10px 36px 10px 36px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-family: inherit;
  transition: all var(--transition-fast);
}

.search-box input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.clear-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
}

.clear-btn.hidden {
  display: none;
}

/* Person Summary Header */
/* Person Summary Header (Structure hiérarchique) */
.person-summary {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.22);
  border-radius: var(--radius-sm);
  animation: fadeIn 0.3s ease;
}

.person-summary.hidden {
  display: none !important;
}

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

.person-profile-header {
  display: flex;
  align-items: center;
  gap: 14px;
}

.avatar {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent-cyan));
  color: #fff;
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.person-main-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.person-main-info h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
}

.badge-role {
  display: inline-block;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(168, 85, 247, 0.25));
  border: 1px solid rgba(168, 85, 247, 0.35);
  color: #e0e7ff;
}

.person-extra-info {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.info-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 500;
}

.phone-pill {
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid rgba(6, 182, 212, 0.25);
  color: var(--accent-cyan);
}

.regime-pill {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.25);
  color: var(--accent-amber);
}

/* Filter Tabs */
.filter-tabs {
  display: flex;
  gap: 6px;
  background: rgba(11, 15, 25, 0.5);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 8px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.tab-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px var(--primary-glow);
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.stat-card {
  padding: 12px 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-value {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--primary-light);
}

.stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Schedule Container & Cards */
.schedule-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 4px 0 4px;
}

.list-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
}

.shift-count-badge {
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
}

/* Schedule Cards */
.schedule-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.shift-card {
  position: relative;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
  transition: transform var(--transition-fast);
}

.shift-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--primary-light);
  border-radius: 4px 0 0 4px;
}

/* Shift Color Variations by Shift Type / Role */
.shift-card.shift-matin::before { background: var(--accent-green); }
.shift-card.shift-aprem::before { background: var(--accent-cyan); }
.shift-card.shift-soir::before { background: var(--primary); }
.shift-card.shift-nuit::before { background: var(--accent-pink); }
.shift-card.shift-bar::before { background: var(--accent-amber); }

.shift-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.shift-date-box {
  display: flex;
  flex-direction: column;
}

.shift-day-name {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--primary-light);
}

.shift-date {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
}

.shift-time-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
}

.shift-time-badge .time-icon {
  font-size: 0.8rem;
}

.shift-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.shift-role-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
}

.shift-info-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.info-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.shift-notes {
  margin-top: 4px;
  font-size: 0.8rem;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.2);
  padding: 8px 10px;
  border-radius: 6px;
  border-left: 2px solid var(--primary);
}

/* Empty State */
.empty-state {
  padding: 40px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 2.5rem;
}

/* Footer */
.app-footer {
  text-align: center;
  padding: 16px 0;
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* Media Queries pour Desktop Preview */
@media (min-width: 600px) {
  body {
    padding: 30px 0;
  }
  
  .mobile-frame {
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    background: rgba(11, 15, 25, 0.7);
    backdrop-filter: blur(20px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  }
}
