/* ColisTracker - Design moderne, responsive */
:root {
  --primary: #0f766e;
  --primary-hover: #0d9488;
  --primary-light: #ccfbf1;
  --secondary: #1e293b;
  --surface: #f8fafc;
  --white: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-muted: #64748b;
  --danger: #dc2626;
  --success: #16a34a;
  --warning: #d97706;
  --radius: 12px;
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

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

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--surface);
  min-height: 100vh;
}

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

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Layout backoffice / admin */
.layout-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
}
.layout-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.layout-header .brand {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--primary);
}
.layout-header .brand-with-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}
.layout-header .brand-with-logo:hover {
  text-decoration: none;
}
.layout-header .header-logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
  flex-shrink: 0;
}
.layout-header nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.layout-header nav a {
  color: var(--text);
  font-weight: 500;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
}
.layout-header nav a:hover {
  background: var(--primary-light);
  color: var(--primary);
  text-decoration: none;
}
.layout-header .user {
  color: var(--text-muted);
  font-size: 0.9rem;
}
.text-muted {
  color: var(--text-muted);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-size: 0.9375rem;
  font-weight: 600;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: background 0.2s, transform 0.05s;
}
.btn:active {
  transform: scale(0.98);
}
.btn-primary {
  background: var(--primary);
  color: var(--white);
}
.btn-primary:hover {
  background: var(--primary-hover);
}
.btn-secondary {
  background: var(--secondary);
  color: var(--white);
}
.btn-secondary:hover {
  background: #334155;
}
.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}
.btn-outline:hover {
  background: var(--primary-light);
}
.btn-danger {
  background: var(--danger);
  color: var(--white);
}
.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
}
.btn-block {
  width: 100%;
}

/* Forms */
.form-group {
  margin-bottom: 1.25rem;
}
.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.375rem;
  color: var(--text);
}
.form-control {
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  transition: border-color 0.2s;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15);
}
.form-control::placeholder {
  color: var(--text-muted);
}
input.form-control[readonly] {
  background: var(--surface);
  color: var(--text-muted);
}

/* Cards */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 1.5rem;
}
.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 1.1rem;
}
.card-body {
  padding: 1.25rem;
}

/* Tables */
.table-responsive {
  overflow-x: auto;
}
table.table {
  width: 100%;
  border-collapse: collapse;
}
table.table th,
table.table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
table.table th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
table.table tbody tr:hover {
  background: var(--surface);
}
table.table .actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Alerts */
.alert {
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
}
.alert-success {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
}
.alert-danger {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}
.alert-warning {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}
.alert-info {
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid #99f6e4;
}

/* Auth pages (login, livreur) */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: linear-gradient(135deg, #0f766e 0%, #134e4a 100%);
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--white);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 2rem;
}
.auth-logo {
  display: block;
  margin: 0 auto 1rem;
  width: 56px;
  height: 56px;
  object-fit: contain;
}
.auth-card h1 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--secondary);
}
.auth-card .subtitle {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  font-size: 0.9375rem;
}
.auth-card .form-group:last-of-type {
  margin-bottom: 1.5rem;
}

/* Home */
.hero {
  text-align: center;
  padding: 4rem 1rem;
  background: linear-gradient(135deg, #0f766e 0%, #134e4a 100%);
  color: var(--white);
  border-radius: 0 0 24px 24px;
}
.hero-logo {
  display: block;
  margin: 0 auto 1rem;
  width: 80px;
  height: 80px;
  object-fit: contain;
}
.hero h1 {
  font-size: 2.25rem;
  margin-bottom: 0.5rem;
}
.hero p {
  opacity: 0.9;
  margin-bottom: 2rem;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}
.portals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  max-width: 800px;
  margin: -2rem auto 3rem;
  padding: 0 1rem;
  position: relative;
  z-index: 1;
}
.portal-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 1.5rem;
  text-align: center;
  transition: transform 0.2s, box-shadow 0.2s;
  text-decoration: none;
  color: inherit;
  display: block;
  border: 1px solid var(--border);
}
.portal-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1);
  text-decoration: none;
  color: inherit;
}
.portal-card h2 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  color: var(--primary);
}
.portal-card p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Page title */
.page-title {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  color: var(--secondary);
}

/* Badge status */
.badge {
  display: inline-block;
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 9999px;
}
.badge-en_attente { background: #fef3c7; color: #92400e; }
.badge-pris_en_charge { background: #dbeafe; color: #1e40af; }
.badge-livre { background: #dcfce7; color: #166534; }

/* Copy address */
.copy-btn {
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}
.copy-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary);
}

/* Livreur scan page */
.scan-actions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}
.scan-actions .btn {
  min-height: 48px;
}
.code-input {
  font-size: 1.5rem;
  letter-spacing: 0.5rem;
  text-align: center;
  max-width: 200px;
  margin: 0 auto 1rem;
}

/* Responsive */
@media (max-width: 768px) {
  .layout-header .container {
    flex-direction: column;
    align-items: stretch;
  }
  .layout-header nav {
    justify-content: flex-start;
  }
  .hero h1 {
    font-size: 1.75rem;
  }
  table.table th,
  table.table td {
    padding: 0.5rem;
    font-size: 0.875rem;
  }
}

@media (max-width: 480px) {
  .auth-card {
    padding: 1.5rem;
  }
  .portals {
    margin-top: -1.5rem;
  }
}
