/* ============================================================
   DREAM TASKS - Feuille de style globale
   Charte : bleu profond + or (Dream Consulting)
   ============================================================ */

:root {
  --color-primary: #1E40AF;
  --color-primary-dark: #1E3A8A;
  --color-primary-light: #3B82F6;
  --color-accent: #D4AF37;
  --color-accent-dark: #B8941F;
  --color-success: #10B981;
  --color-warning: #F59E0B;
  --color-danger: #EF4444;
  --color-info: #06B6D4;
  --color-bg: #F8FAFC;
  --color-bg-alt: #F1F5F9;
  --color-card: #FFFFFF;
  --color-text: #0F172A;
  --color-text-muted: #64748B;
  --color-border: #E2E8F0;
  --color-border-light: #F1F5F9;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.10);
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --header-height: 64px;
}

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

html, body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ============================================================
   BOUTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px; font-size: 14px; font-weight: 600; line-height: 1;
  border-radius: var(--radius); border: 1px solid transparent; cursor: pointer;
  transition: all 0.15s ease; text-decoration: none; white-space: nowrap;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--color-primary); color: white; }
.btn-primary:hover { background: var(--color-primary-dark); }
.btn-outline { background: white; border-color: var(--color-border); color: var(--color-text); }
.btn-outline:hover { border-color: var(--color-primary); color: var(--color-primary); }
.btn-ghost { background: transparent; color: var(--color-text); }
.btn-ghost:hover { background: var(--color-bg-alt); }
.btn-success { background: var(--color-success); color: white; }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--color-danger); color: white; }
.btn-danger:hover { background: #DC2626; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ============================================================
   LANDING PAGE
   ============================================================ */
.landing-header {
  background: white; border-bottom: 1px solid var(--color-border);
  position: sticky; top: 0; z-index: 100;
}
.nav-row { display: flex; justify-content: space-between; align-items: center; height: var(--header-height); }
.brand { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 700; color: var(--color-primary); }
.brand i { font-size: 24px; }
.landing-header nav { display: flex; gap: 12px; align-items: center; }

.hero {
  padding: 80px 0 60px; text-align: center;
  background: linear-gradient(135deg, #EBF4FF 0%, #FFFFFF 100%);
}
.hero h1 { font-size: 44px; font-weight: 800; line-height: 1.15; color: var(--color-text); margin-bottom: 24px; }
.hero .lead { font-size: 19px; color: var(--color-text-muted); max-width: 720px; margin: 0 auto 40px; }
.hero-cta { display: flex; gap: 16px; justify-content: center; margin-bottom: 24px; flex-wrap: wrap; }
.hero-note { color: var(--color-text-muted); font-size: 14px; }
.hero-note i { color: var(--color-success); }

.features { padding: 80px 0; background: white; }
.features h2 { text-align: center; font-size: 36px; margin-bottom: 50px; }
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 28px; }
.feature-card {
  padding: 30px; border: 1px solid var(--color-border); border-radius: var(--radius-lg);
  transition: all 0.2s ease;
}
.feature-card:hover { border-color: var(--color-primary); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.feature-icon {
  width: 56px; height: 56px; border-radius: 12px; background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
  display: flex; align-items: center; justify-content: center; color: white; font-size: 24px; margin-bottom: 18px;
}
.feature-card h3 { font-size: 18px; margin-bottom: 10px; }
.feature-card p { color: var(--color-text-muted); font-size: 14px; }

.pricing { padding: 80px 0; background: var(--color-bg); }
.pricing h2 { text-align: center; font-size: 36px; margin-bottom: 50px; }
.pricing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; max-width: 1000px; margin: 0 auto; }
.price-card {
  background: white; border: 1px solid var(--color-border); border-radius: var(--radius-lg);
  padding: 32px 28px; position: relative;
}
.price-card.featured {
  border-color: var(--color-primary); border-width: 2px; box-shadow: var(--shadow-lg); transform: scale(1.03);
}
.price-card .badge {
  position: absolute; top: -12px; right: 20px;
  background: var(--color-accent); color: white; padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 700;
}
.price-card h3 { font-size: 20px; margin-bottom: 12px; }
.price { font-size: 36px; font-weight: 800; color: var(--color-primary); margin-bottom: 20px; }
.price span { font-size: 14px; font-weight: 400; color: var(--color-text-muted); }
.price-card ul { list-style: none; }
.price-card li { padding: 8px 0; color: var(--color-text-muted); border-bottom: 1px solid var(--color-border-light); font-size: 14px; }
.price-card li::before { content: "✓"; color: var(--color-success); font-weight: 700; margin-right: 8px; }

.landing-footer {
  background: var(--color-text); color: white; padding: 40px 0; text-align: center;
}
.landing-footer p { margin-bottom: 6px; }
.landing-footer small { opacity: 0.7; }

/* ============================================================
   AUTH PAGES (login + register)
   ============================================================ */
.auth-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  padding: 20px;
}
.auth-card {
  background: white; border-radius: var(--radius-xl); padding: 40px;
  box-shadow: var(--shadow-lg); width: 100%; max-width: 440px;
}
.auth-card-large { max-width: 600px; }
.auth-header { text-align: center; margin-bottom: 28px; }
.auth-header .brand { justify-content: center; margin-bottom: 16px; }
.auth-header h1 { font-size: 24px; margin-bottom: 6px; }
.auth-header p { color: var(--color-text-muted); font-size: 14px; }
.auth-form .form-group { margin-bottom: 16px; }
.auth-form label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--color-text); }
.auth-form label small { font-weight: 400; color: var(--color-text-muted); }
.auth-form input, .auth-form select, .auth-form textarea {
  width: 100%; padding: 11px 14px; border: 1px solid var(--color-border); border-radius: var(--radius);
  font-size: 14px; font-family: inherit; transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.auth-form input:focus, .auth-form select:focus, .auth-form textarea:focus {
  outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(30,64,175,0.1);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.auth-link { text-align: center; margin-top: 16px; font-size: 14px; color: var(--color-text-muted); }
.error-msg {
  background: #FEF2F2; color: #B91C1C; padding: 10px 14px; border-radius: var(--radius);
  font-size: 13px; margin-bottom: 14px; border: 1px solid #FECACA;
}
.success-msg {
  background: #F0FDF4; color: #166534; padding: 10px 14px; border-radius: var(--radius);
  font-size: 13px; margin-bottom: 14px; border: 1px solid #BBF7D0;
}
.demo-credentials {
  margin-top: 24px; padding: 14px; background: #F8FAFC; border-radius: var(--radius); font-size: 12px;
  border: 1px dashed var(--color-border);
}
.demo-credentials strong { display: block; margin-bottom: 6px; color: var(--color-primary); }
.demo-credentials ul { list-style: none; }
.demo-credentials li { padding: 2px 0; }
.demo-credentials code { background: white; padding: 2px 6px; border-radius: 4px; font-family: monospace; }

/* ============================================================
   APP SHELL (espace authentifié)
   ============================================================ */
.app-shell { min-height: 100vh; background: var(--color-bg); }
.app-loading {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 100vh; color: var(--color-primary); gap: 14px;
}
.app-loading i { font-size: 36px; }

.app-layout { display: flex; min-height: 100vh; }
.app-sidebar {
  width: 240px; background: white; border-right: 1px solid var(--color-border);
  display: flex; flex-direction: column; flex-shrink: 0;
}
.sidebar-header { padding: 18px 20px; border-bottom: 1px solid var(--color-border); }
.sidebar-header .brand { font-size: 18px; }
.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
.sidebar-section { margin-bottom: 20px; }
.sidebar-section-title {
  font-size: 11px; font-weight: 700; color: var(--color-text-muted); text-transform: uppercase;
  letter-spacing: 0.5px; padding: 0 12px 8px;
}
.sidebar-link {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: var(--radius);
  color: var(--color-text); font-size: 14px; font-weight: 500; cursor: pointer;
  transition: all 0.15s ease; margin-bottom: 2px; text-decoration: none;
}
.sidebar-link:hover { background: var(--color-bg-alt); text-decoration: none; }
.sidebar-link.active { background: var(--color-primary); color: white; }
.sidebar-link i { width: 18px; text-align: center; }
.sidebar-link .badge-count {
  margin-left: auto; background: var(--color-danger); color: white; font-size: 11px;
  padding: 2px 7px; border-radius: 10px; font-weight: 700;
}
.sidebar-link.active .badge-count { background: rgba(255,255,255,0.3); }
.sidebar-footer { padding: 14px; border-top: 1px solid var(--color-border); }
.user-card { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--color-primary);
  color: white; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px;
}
.user-info { flex: 1; min-width: 0; }
.user-info .name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-info .role { font-size: 11px; color: var(--color-text-muted); }
.btn-logout {
  background: transparent; border: none; color: var(--color-text-muted); cursor: pointer; padding: 6px;
}
.btn-logout:hover { color: var(--color-danger); }

.app-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.app-header {
  height: var(--header-height); background: white; border-bottom: 1px solid var(--color-border);
  display: flex; align-items: center; justify-content: space-between; padding: 0 28px;
}
.page-title { font-size: 20px; font-weight: 700; }
.app-header-actions { display: flex; align-items: center; gap: 14px; }
.btn-notif { position: relative; background: transparent; border: none; cursor: pointer; padding: 8px; color: var(--color-text-muted); font-size: 18px; }
.btn-notif:hover { color: var(--color-primary); }
.btn-notif .dot {
  position: absolute; top: 6px; right: 6px; width: 9px; height: 9px;
  background: var(--color-danger); border-radius: 50%; border: 2px solid white;
}

.app-content { flex: 1; padding: 28px; overflow-y: auto; }

/* Cartes & sections */
.section-title { font-size: 18px; font-weight: 700; margin-bottom: 16px; color: var(--color-text); }
.card { background: white; border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 24px; }
.card + .card { margin-top: 20px; }
.cards-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 24px; }

.stat-card {
  background: white; border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 20px;
  display: flex; align-items: center; gap: 16px;
}
.stat-icon {
  width: 48px; height: 48px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: white;
}
.stat-icon.bg-primary { background: var(--color-primary); }
.stat-icon.bg-warning { background: var(--color-warning); }
.stat-icon.bg-success { background: var(--color-success); }
.stat-icon.bg-danger { background: var(--color-danger); }
.stat-icon.bg-info { background: var(--color-info); }
.stat-content .value { font-size: 28px; font-weight: 800; color: var(--color-text); line-height: 1; }
.stat-content .label { font-size: 13px; color: var(--color-text-muted); margin-top: 4px; }

/* Tableau de tickets */
.table-wrapper { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left; font-size: 12px; font-weight: 700; color: var(--color-text-muted);
  text-transform: uppercase; letter-spacing: 0.5px; padding: 12px 14px;
  border-bottom: 1px solid var(--color-border); background: var(--color-bg-alt);
}
.data-table td { padding: 14px; border-bottom: 1px solid var(--color-border-light); font-size: 14px; vertical-align: middle; }
.data-table tr:hover { background: var(--color-bg); cursor: pointer; }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 12px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px;
}
.badge-nouveau { background: #DBEAFE; color: #1E40AF; }
.badge-affecte { background: #FEF3C7; color: #92400E; }
.badge-en_cours { background: #FEDD89; color: #92400E; }
.badge-en_attente_client { background: #E0E7FF; color: #3730A3; }
.badge-termine { background: #D1FAE5; color: #065F46; }
.badge-annule { background: #FEE2E2; color: #991B1B; }
.badge-urgente { background: #FEE2E2; color: #991B1B; }
.badge-normale { background: #DBEAFE; color: #1E40AF; }
.badge-basse { background: #E5E7EB; color: #4B5563; }
.badge-fiscal { background: #DBEAFE; color: #1E40AF; }
.badge-comptable { background: #D1FAE5; color: #065F46; }
.badge-juridique { background: #E0E7FF; color: #3730A3; }
.badge-social { background: #FEF3C7; color: #92400E; }
.badge-audit { background: #FCE7F3; color: #9F1239; }
.badge-rdv { background: #CFFAFE; color: #155E75; }
.badge-administratif { background: #F3F4F6; color: #4B5563; }
.badge-autre { background: #E5E7EB; color: #4B5563; }
.badge-actif { background: #D1FAE5; color: #065F46; }
.badge-en_attente { background: #FEF3C7; color: #92400E; }
.badge-suspendu { background: #FEE2E2; color: #991B1B; }

/* Filtres */
.filter-bar { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; align-items: center; }
.filter-bar select, .filter-bar input {
  padding: 8px 12px; border: 1px solid var(--color-border); border-radius: var(--radius);
  font-size: 14px; background: white;
}
.filter-bar .search-input { flex: 1; min-width: 200px; }

/* État vide */
.empty-state { text-align: center; padding: 60px 20px; color: var(--color-text-muted); }
.empty-state i { font-size: 48px; opacity: 0.3; margin-bottom: 16px; }
.empty-state p { font-size: 15px; }

/* Page détail ticket */
.ticket-detail { display: grid; grid-template-columns: 1fr 320px; gap: 24px; }
.ticket-detail-main { display: flex; flex-direction: column; gap: 20px; }
.ticket-header-card { display: flex; justify-content: space-between; gap: 16px; align-items: start; flex-wrap: wrap; }
.ticket-meta { font-size: 13px; color: var(--color-text-muted); }
.ticket-numero { font-family: monospace; font-size: 13px; background: var(--color-bg-alt); padding: 4px 10px; border-radius: 4px; }
.ticket-title { font-size: 22px; font-weight: 700; margin: 8px 0; }
.ticket-description { background: var(--color-bg-alt); padding: 16px; border-radius: var(--radius); font-size: 14px; white-space: pre-wrap; }
.ticket-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }

.commentaires-list { display: flex; flex-direction: column; gap: 12px; }
.commentaire-item { background: var(--color-bg-alt); padding: 12px 16px; border-radius: var(--radius); border-left: 3px solid var(--color-primary); }
.commentaire-meta { font-size: 12px; color: var(--color-text-muted); margin-bottom: 4px; }

.messages-list { display: flex; flex-direction: column; gap: 12px; max-height: 400px; overflow-y: auto; padding: 4px; }
.message-item { padding: 12px 14px; border-radius: var(--radius); background: var(--color-bg-alt); }
.message-item.mine { background: var(--color-primary); color: white; align-self: flex-end; max-width: 80%; }
.message-item.interne { background: #FEF3C7; border-left: 3px solid var(--color-warning); }
.message-meta { font-size: 11px; opacity: 0.8; margin-bottom: 4px; }

.message-form { display: flex; gap: 10px; margin-top: 12px; align-items: flex-end; }
.message-form textarea {
  flex: 1; padding: 10px; border: 1px solid var(--color-border); border-radius: var(--radius);
  font-family: inherit; font-size: 14px; resize: vertical; min-height: 60px;
}
.message-form-options { display: flex; gap: 12px; align-items: center; font-size: 13px; margin-top: 6px; }

.ticket-side { display: flex; flex-direction: column; gap: 16px; }
.info-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--color-border-light); font-size: 13px; }
.info-row:last-child { border: none; }
.info-row .label { color: var(--color-text-muted); }
.info-row .value { font-weight: 600; }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15,23,42,0.6); z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  backdrop-filter: blur(4px);
}
.modal {
  background: white; border-radius: var(--radius-xl); max-width: 600px; width: 100%;
  max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg);
}
.modal-large { max-width: 800px; }
.modal-header {
  padding: 20px 24px; border-bottom: 1px solid var(--color-border);
  display: flex; justify-content: space-between; align-items: center;
}
.modal-header h2 { font-size: 18px; }
.modal-close { background: transparent; border: none; cursor: pointer; font-size: 20px; color: var(--color-text-muted); }
.modal-close:hover { color: var(--color-danger); }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--color-border); display: flex; gap: 10px; justify-content: flex-end; }

/* Toast */
.toast {
  position: fixed; top: 20px; right: 20px; padding: 14px 18px; border-radius: var(--radius);
  background: var(--color-text); color: white; box-shadow: var(--shadow-lg); z-index: 300;
  display: flex; align-items: center; gap: 10px; font-size: 14px; max-width: 400px;
  animation: slideIn 0.25s ease;
}
.toast-success { background: var(--color-success); }
.toast-error { background: var(--color-danger); }
.toast-info { background: var(--color-info); }
@keyframes slideIn { from { transform: translateX(120%); } to { transform: translateX(0); } }

/* Notifications dropdown */
.notif-dropdown {
  position: absolute; top: 50px; right: 20px; width: 380px; max-height: 500px;
  background: white; border: 1px solid var(--color-border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); z-index: 50; overflow: hidden;
}
.notif-dropdown-header { padding: 14px 16px; border-bottom: 1px solid var(--color-border); display: flex; justify-content: space-between; align-items: center; }
.notif-dropdown-list { max-height: 420px; overflow-y: auto; }
.notif-item { padding: 12px 16px; border-bottom: 1px solid var(--color-border-light); cursor: pointer; }
.notif-item:hover { background: var(--color-bg-alt); }
.notif-item.unread { background: #EBF4FF; }
.notif-item .notif-title { font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.notif-item .notif-text { font-size: 12px; color: var(--color-text-muted); line-height: 1.4; }
.notif-item .notif-time { font-size: 11px; color: var(--color-text-muted); margin-top: 4px; }

/* Programme journalier */
.programme-list { display: flex; flex-direction: column; gap: 10px; }
.programme-item {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: white;
  border: 1px solid var(--color-border); border-radius: var(--radius); transition: all 0.15s ease;
}
.programme-item.accomplie { opacity: 0.55; background: var(--color-bg-alt); }
.programme-item.accomplie .programme-titre { text-decoration: line-through; }
.programme-check {
  width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--color-border);
  cursor: pointer; flex-shrink: 0; transition: all 0.15s; display: flex; align-items: center; justify-content: center;
}
.programme-check.checked { background: var(--color-success); border-color: var(--color-success); color: white; }
.programme-content { flex: 1; min-width: 0; }
.programme-titre { font-weight: 600; font-size: 14px; }
.programme-meta { font-size: 12px; color: var(--color-text-muted); margin-top: 2px; }
.programme-actions { display: flex; gap: 6px; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--color-border); margin-bottom: 20px; }
.tab {
  padding: 10px 18px; cursor: pointer; font-size: 14px; font-weight: 500; color: var(--color-text-muted);
  border-bottom: 2px solid transparent; transition: all 0.15s ease;
}
.tab:hover { color: var(--color-text); }
.tab.active { color: var(--color-primary); border-bottom-color: var(--color-primary); font-weight: 700; }

/* Responsive */
@media (max-width: 900px) {
  .ticket-detail { grid-template-columns: 1fr; }
  .hero h1 { font-size: 32px; }
  .features h2, .pricing h2 { font-size: 28px; }
}
@media (max-width: 720px) {
  .app-sidebar { width: 60px; }
  .sidebar-link span, .sidebar-section-title, .user-info { display: none; }
  .form-row { grid-template-columns: 1fr; }
  .auth-card { padding: 28px 22px; }
  .app-content { padding: 16px; }
}
