/**
 * styles.css - Simulateur de Paie Maroc - Version responsive et optimisée
 * Auteur : Tony-Web / Kamal Tony
 * Date : Juillet 2025
 */

/* ------------------ RESET ------------------ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
  font-size: 16px;
}
body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #f3f4f6, #e4e9f0);
  color: #1a1a1a;
  line-height: 1.6;
  overflow-x: hidden;
}
a {
  text-decoration: none;
  color: inherit;
}
ul {
  list-style: none;
}

/* ------------------ STRUCTURE ------------------ */
header {
  background: linear-gradient(to right, #1e3a8a, #3b82f6);
  color: white;
  padding: 1rem 2rem;
  text-align: center;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

h1, h2, h3 {
  margin-bottom: 0.5rem;
  font-weight: bold;
}
.container {
  max-width: 1100px;
  margin: auto;
  padding: 1rem 2rem;
}

section {
  margin: 2rem 0;
  background: white;
  border-radius: 10px;
  padding: 2rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* ------------------ TABLEAUX ------------------ */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  background: #ffffff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
th, td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
}
th {
  background: #1e40af;
  color: white;
  font-weight: 600;
}
tr:hover {
  background-color: #f1f5f9;
}

/* ------------------ FORMULAIRE ------------------ */
form {
  display: grid;
  gap: 1rem;
}
label {
  font-weight: 500;
  color: #1e293b;
}
input, select, button {
  padding: 0.75rem;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  font-size: 1rem;
  transition: all 0.3s ease;
}
input:focus, select:focus {
  border-color: #facc15;
  outline: none;
  box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.3);
}
button {
  background-color: #1d4ed8;
  color: white;
  border: none;
  cursor: pointer;
  font-weight: bold;
}
button:hover {
  background-color: #2563eb;
}

/* ------------------ FOOTER ------------------ */
footer {
  background-color: #1e293b;
  color: white;
  text-align: center;
  padding: 1rem 2rem;
  margin-top: 4rem;
  font-size: 0.875rem;
}

/* ------------------ BOUTONS ET BADGES ------------------ */
.badge {
  display: inline-block;
  background-color: #fde68a;
  color: #78350f;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  border-radius: 4px;
  font-weight: 600;
}

/* ------------------ RESPONSIVE ------------------ */
@media screen and (max-width: 768px) {
  html {
    font-size: 15px;
  }
  header, section, footer {
    padding: 1rem;
  }
  table, thead, tbody, th, td, tr {
    display: block;
  }
  th {
    position: absolute;
    top: -9999px;
    left: -9999px;
  }
  td {
    position: relative;
    padding-left: 50%;
    border: none;
    border-bottom: 1px solid #ccc;
  }
  td::before {
    content: attr(data-label);
    position: absolute;
    left: 1rem;
    top: 0.75rem;
    font-weight: bold;
    color: #1f2937;
  }
  .container {
    padding: 1rem;
  }
}

/* ------------------ FONDS AVANCÉS ------------------ */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-image: url('https://www.transparenttextures.com/patterns/symphony.png');
  opacity: 0.05;
  z-index: -1;
}

/* ------------------ ANIMATIONS ------------------ */
.fade-in {
  animation: fadeIn 1s ease-in;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}


/* ------------------ AJOUTS SPÉCIFIQUES À index.html ------------------ */

/* ✅ Redimensionnement du drapeau */
.flag {
  max-width: 80px;
  height: auto;
  display: block;
  margin: 1rem auto 0;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* ✅ Mise en forme du formulaire */
#form-section form {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

fieldset {
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 1.5rem;
  background-color: #f9fafb;
}

legend {
  font-size: 1.2rem;
  font-weight: bold;
  color: #1f2937;
  padding: 0 0.5rem;
}

fieldset label {
  display: block;
  margin-bottom: 0.25rem;
  margin-top: 1rem;
  color: #374151;
}

fieldset input,
fieldset select {
  width: 100%;
  padding: 0.65rem;
  font-size: 1rem;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background-color: white;
}

/* ✅ Boutons formulaire */
#payForm button {
  margin-top: 1.5rem;
  width: fit-content;
  align-self: start;
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  background-color: #1d4ed8;
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.3s;
  border: none;
}
#payForm button:hover {
  background-color: #2563eb;
}

/* ✅ Responsive formulaire */
@media screen and (max-width: 768px) {
  #form-section form {
    gap: 1rem;
  }
  fieldset {
    padding: 1rem;
  }
  .flag {
    max-width: 60px;
  }
  #payForm button {
    width: 100%;
  }
}

/* ✅ Résultat et logo watermark */
.watermark-logo {
  max-width: 120px;
  opacity: 0.1;
  position: absolute;
  right: 10px;
  top: 10px;
}

#resultat {
  position: relative;
  padding: 2rem;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.06);
  margin-top: 2rem;
}

/* ✅ Publicités */
.pub-container {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  justify-content: center;
  margin-top: 1.5rem;
}
.pub-item {
  flex: 1 1 200px;
  max-width: 220px;
  background: #f1f5f9;
  padding: 1rem;
  border-radius: 10px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.pub-item img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}
.pub-placeholder {
  font-style: italic;
  color: #6b7280;
}


/* ===== Styles généraux ===== */
body {
  margin: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #f9f9fb, #eef1f5);
  color: #333;
  line-height: 1.6;
}

.container {
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

h1, h2, h3 {
  color: #2c3e50;
  margin-top: 0;
}

p {
  margin: 10px 0;
}

/* ===== Navigation ===== */
nav {
  background: #4a69bd;
  padding: 15px 0;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

nav ul {
  list-style: none;
  display: flex;
  justify-content: center;
  padding: 0;
  margin: 0;
  flex-wrap: wrap;
}

nav li {
  margin: 0 15px;
}

nav a {
  color: #fff;
  text-decoration: none;
  font-weight: bold;
  font-size: 16px;
  position: relative;
  transition: color 0.3s ease;
}

nav a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -5px;
  width: 100%;
  height: 2px;
  background-color: #feca57;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.3s ease;
}

nav a:hover {
  color: #feca57;
}

nav a:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* ===== Tableaux ===== */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  box-shadow: 0 0 10px rgba(0,0,0,0.05);
}

table th, table td {
  padding: 12px 15px;
  border: 1px solid #ddd;
  text-align: left;
}

table th {
  background: #4a69bd;
  color: #fff;
}

table tr:nth-child(even) {
  background: #f2f2f2;
}

/* ===== Boutons ===== */
button, .btn {
  background-color: #4a69bd;
  color: #fff;
  border: none;
  padding: 10px 20px;
  font-size: 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.3s ease;
}

button:hover, .btn:hover {
  background-color: #3b5998;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  nav ul {
    flex-direction: column;
    align-items: center;
  }

  table, thead, tbody, th, td, tr {
    display: block;
  }

  table tr {
    margin-bottom: 15px;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  }

  table td {
    text-align: right;
    padding-left: 50%;
    position: relative;
  }

  table td::before {
    content: attr(data-label);
    position: absolute;
    left: 15px;
    top: 12px;
    font-weight: bold;
    text-align: left;
  }
}

/* ===== Footer ===== */
footer {
  background: #2c3e50;
  color: #fff;
  text-align: center;
  padding: 15px 0;
  margin-top: 40px;
  font-size: 14px;
}

footer a {
  color: #feca57;
  text-decoration: none;
  margin: 0 10px;
}

footer a:hover {
  text-decoration: underline;
}
