/* Container centré */
.container {
    padding: 15px;
}

/* Carte */
.card {
    background: #fff;
    padding: 20px;
    border-radius: 14px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* Groupe champ */
.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 15px;
}

/* Labels */
.form-group label {
    margin-bottom: 5px;
    font-weight: 500;
}

/* Inputs */
.form-group input {
    padding: 12px;
    border-radius: 10px;
    border: 1px solid #ddd;
    font-size: 16px;
}

/* Boutons */
.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

/* Bouton principal */
.btn-primary {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 10px;
    background: #007bff;
    color: white;
    font-size: 16px;
}

/* Bouton annuler */
.btn-cancel {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 10px;
    background: #ccc;
}

/* Responsive iPhone */
@media (max-width: 600px) {
    .form-actions {
        flex-direction: column;
    }
}


/* =======================
   1. Variables / palette
======================= */
:root {
    --bg-page: #f4f7ff;
    --bg-card: #ffffff;
    --border-light: #dbe6ff;

    --text-main: #1f2a44;
    --text-muted: #6b7280;

    --blue: #1a73e8;
    --blue-dark: #1669c1;
    --blue-light: #e9f2ff;

    --red: #ff3b30;
    --red-dark: #d92c23;

    --gray-btn: #e0e0e0;
    --gray-btn-dark: #d5d5d5;
    --gray-soft: #eef1f5;

    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --radius: 12px;
    --radius-sm: 8px;
}

/* =======================
   2. Reset / base
======================= */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    font-size: 16px;
    line-height: 1.4;
    background: var(--bg-page);
    color: var(--text-main);
}

.header-user-block {
    position: absolute;
    top: 10px;
    right: 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    z-index: 1001;
}

.header-user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
    text-decoration: none;
}

.header-user-name:hover {
    color: var(--blue);
    text-decoration: underline;
}

.header-logout-link {
    font-size: 13px;
    color: var(--blue);
    text-decoration: none;
}

.header-logout-link:hover {
    text-decoration: underline;
}

.container {
    max-width: 95%;
    margin: 20px auto 90px auto;
    padding: 0 10px;
}

p,
li {
    margin: 6px 0;
    font-size: 1em;
}

h1,
h2,
h3,
h4 {
    margin: 0 0 10px;
    color: var(--text-main);
}

h1 { font-size: 24px; }
h2 { font-size: 20px; }
h3,
h4 { font-size: 18px; }

a {
    text-decoration: none;
}

/* =======================
   3. Cartes
======================= */
.card {
    background: var(--bg-card);
    padding: 18px;
    margin-bottom: 15px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card p:last-child {
    margin-bottom: 0;
}

.card-header,
.card h2 {
    display: flex;
    align-items: center;
    gap: 12px;         /* espace entre éléments */
}

/* =======================
   4. Boutons généraux
======================= */
button,
.add-button,
.form-inline button,
.btn-primary,
.btn-cancel {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    font-size: 14px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease, opacity 0.2s ease;
}

/* Bouton par défaut */
button {
    background: var(--blue);
    color: #fff;
}

button:hover {
    background: var(--blue-dark);
}

/* Bouton principal */
.btn-primary {
    background: var(--blue);
    color: #fff;
}

.btn-primary:hover {
    background: var(--blue-dark);
}

/* Bouton annuler */
.btn-cancel {
    background: var(--gray-btn);
    color: #333;
    margin-left: 8px;
}

.btn-cancel:hover {
    background: var(--gray-btn-dark);
}

/* =======================
   5. Boutons d’action
======================= */
.card-actions {
    display: flex;
    justify-content: flex-start;
}

.card-actions-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.card-actions.back-fixed {
    margin-bottom: 12px;
}

.add-button {
    flex-direction: column;
    min-width: 110px;
    padding: 12px 18px;
    background: var(--blue);
    color: #fff;
    box-shadow: var(--shadow);
}

.add-button:hover {
    background: var(--blue-dark);
}

.add-button .icon {
    font-size: 24px;
    margin-bottom: 4px;
}

.add-button .label {
    font-size: 14px;
    font-weight: bold;
}

/*.btn-add {
    padding: 14px 16px;
    font-size: 18px;
}*/

.btn-add {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(145deg, #3B82F6, #1E40AF);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 20px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.25);
}

.btn-add:active {
  transform: scale(0.95);
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    background: #111827;
    color: #fff;
    border-radius: 8px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
}

.btn-back:hover {
    background: #000;
    color: #fff;
}

.user-action-link {
    margin: 2px 4px 2px 0;
    padding: 6px 8px;
    font-size: 13px;
}

.user-action-danger {
    background: var(--red);
}

.user-action-danger:hover {
    background: var(--red-dark);
}

.user-row {
    cursor: pointer;
}

.user-row:hover {
    background: var(--blue-light);
}

/* =======================
   6. Formulaires
======================= */
.form-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.form-inline input,
.form-inline select,
.form-group select,
.form-inline button,
.login-card input {
    padding: 10px 12px;
    font-size: 16px;
    border: 1px solid #cfd8e3;
    border-radius: var(--radius-sm);
}

.form-inline input,
.form-inline select {
    background: #fff;
    color: var(--text-main);
}

/* =======================
   7. Login
======================= */
.login-page {
    padding: 20px;
}

.login-container {
    max-width: 95%;
    margin: 20px auto 90px auto;
    padding: 0 10px;
}
.login-card {
    max-width: 400px;
    margin: 60px auto;
    padding: 24px 28px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

.login-logo {
    display: block;
    margin: 0 auto 16px;
       height: auto;
}

.login-title {
    display: block;
    width: 100%;
    margin: 0 0 8px 0;
    text-align: center;
    font-size: 22px;
    font-weight: 600;
    color: var(--text-main);
}

.login-subtitle {
    margin: 0 0 20px 0;
    font-size: 14px;
    color: var(--text-muted);
    text-align: center;
}

.login-form-group {
    margin-bottom: 14px;
}

.login-label {
    display: block;
    margin: 0 0 5px 0;
    font-weight: bold;
    text-align: left;
    color: var(--text-main);
}

.login-input {
    display: block;
    width: 100%;
    box-sizing: border-box;
}

.login-button {
    width: 100%;
    margin-top: 20px;
}

.login-error {
    margin-bottom: 15px;
    padding: 10px;
    font-size: 14px;
    color: #fff;
    background: var(--red);
    border-radius: 8px;
    text-align: center;
}

.success-message {
    margin-bottom: 15px;
    padding: 10px;
    font-size: 14px;
    color: #155724;
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 8px;
    text-align: center;
}
.login-card .login-title {
    text-align: center;
}
/* =======================
   8. Tableaux
======================= */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 16px;
}

th,
td {
    padding: 10px;
    text-align: left;
}

.table-depenses {
    margin-top: 10px;
    font-family: Arial, sans-serif;
}

.table-depenses th,
.table-depenses td {
    border: 1px solid #d6deea;
}

.table-depenses thead th {
    background: var(--blue-dark);
    color: #fff;
}

.table-depenses tbody tr:nth-child(even) {
    background: #f7faff;
}

.table-depenses tbody tr:last-child {
    font-weight: bold;
    color: #fff;
    background: #1f2a44;
}

.table-depenses tbody .user-row:last-child {
    font-weight: normal;
    color: var(--text-main);
    background: transparent;
}

.table-depenses tbody .user-row:nth-child(even):last-child {
    background: #f7faff;
}

.table-depenses tbody .user-row:hover,
.table-depenses tbody .user-row:nth-child(even):last-child:hover {
    background: var(--blue-light);
}

.table-depenses th:first-child,
.table-depenses td:first-child {
    width: 52%;
    max-width: 320px;
    white-space: normal;
    word-break: break-word;
}

.table-depenses th:nth-child(2),
.table-depenses td:nth-child(2) {
    width: 18%;
    white-space: nowrap;
}

.table-etapes {
    margin-top: 10px;
    font-family: Arial, sans-serif;
}

.table-etapes th,
.table-etapes td {
    border: 1px solid #d6deea;
}

.table-etapes thead th {
    background: var(--blue-dark);
    color: #fff;
}

.table-etapes tbody tr:nth-child(even) {
    background: #f7faff;
}

.table-scroll {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-scroll table {
    min-width: 100%;
}

.remboursement-action-col {
    width: 12%;
    white-space: nowrap;
}

.table-etapes th:nth-child(4),
.table-etapes td:nth-child(4) {
    width: 7%;
    white-space: nowrap;
    text-align: center;
}

.remboursement-action-col .add-button {
    min-width: 120px;
    padding: 8px 12px;
    white-space: normal;
}

.remboursement-action-col a[href*="remboursement_paye"] {
    min-width: 78px;
}

.remboursement-action-col a[href*="remboursement_impaye"] {
    min-width: 40px;
    width: 40px;
    padding: 8px;
    font-size: 0;
}

.remboursement-action-col a[href*="remboursement_impaye"]::before {
    content: "↺";
    font-size: 18px;
    line-height: 1;
}



/* =======================
   9. Participants (compact)
======================= */

.participants-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Ligne */
.participant-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0;              /* ↓ réduit */
    border-bottom: none;
}

/* Texte */
.participant-text {
    display: inline-flex;
    align-items: center;
    gap: 4px;                   /* ↓ réduit */
    font-size: 15px;
}

/* Nom */
.participant-nom {
    font-weight: 500;
}

/* alias */
.participant-alias {
    color: var(--text-muted);
    font-size: 13px;
}

/* Surnom */
.participant-surnom {
    font-weight: 600;
}

.participant-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: none;

    background: #e7f0ff;      /* bleu très clair */
    color: #1a73e8;           /* bleu doux */
    font-size: 18px;
  margin-left: 10px; /* espace spécifique */
    cursor: pointer;
     box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.participant-action:hover {
    background: #d6e6ff;
}
/* =======================
   10. Toggle
======================= */
.toggle-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin-left: 8px;
    padding: 0;
    border: 1px solid #cfd8e3;
    border-radius: 6px;
    background: #f3f4f6;
    color: #1f2a44;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    vertical-align: middle;
}

.toggle-button:hover {
    background: #e5e7eb;
}
/* =======================
   11. Popup
======================= */
.popup-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1000;
}

.popup-box {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    max-width: 300px;
    padding: 20px;
    text-align: center;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.popup-box h3 {
    margin-bottom: 8px;
}

.popup-box button {
    width: 100%;
    padding: 10px 12px;
    font-size: 15px;
}

.popup-box .edit {
    background: var(--blue);
    color: #fff;
}

.popup-box .edit:hover {
    background: var(--blue-dark);
}

.popup-box .delete {
    background: var(--red);
    color: #fff;
}

.popup-box .delete:hover {
    background: var(--red-dark);
}

.popup-box .cancel {
    background: var(--gray-btn);
    color: var(--text-main);
}

.popup-box .cancel:hover {
    background: var(--gray-btn-dark);
}

/* =======================
   12. Menu fixe bas
======================= */
.menu-container {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 4px 0;
    background: #0f172a;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.15);
    z-index: 1000;
}

.menu {
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin: 0;
    padding: 0;
}

.menu a {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 60px;
    padding: 6px 0;
    font-size: 14px;
    font-weight: bold;
    color: #fff;
}

.menu a i {
    margin-bottom: 4px;
    font-size: 24px;
}

.menu a img,
.menu-icon {
    width: 30px;
    height: 30px;
    max-width: 30px;
    max-height: 30px;
    margin-bottom: 4px;
    object-fit: contain;
    display: block;
    flex: 0 0 30px;
}

.menu-icon-invitations,
.menu-icon-account {
    width: 30px;
    height: 30px;
}

.menu a:hover {
    color: #cfe2ff;
}

/* =======================
   13. Responsive
======================= */
@media (max-width: 600px) {
    body {
        font-size: 17px;
        overflow-x: hidden;
    }

    .header-user-block {
        top: 8px;
        right: 12px;
    }

    .header-user-name,
    .header-logout-link {
        font-size: 12px;
    }

    .container {
        max-width: 100%;
        padding: 0 8px;
    }

    .card {
        padding: 16px;
    }

    h1 { font-size: 22px; }
    h2 { font-size: 19px; }

    .form-inline {
        flex-direction: column;
    }

    .form-inline input,
    .form-inline select,
    .form-inline button,
    button {
        width: 100%;
    }

    .login-card {
        margin: 40px 20px;
        padding: 20px;
    }

    .menu a {
        min-width: 48px;
        font-size: 12px;
        white-space: nowrap;
    }

    .menu a[href*="route=participants"] span {
        font-size: 0;
    }

    .menu a[href*="route=participants"] span::after {
        content: "Pers.";
        font-size: 12px;
    }

    .menu a i {
        font-size: 22px;
    }

    .menu a img,
    .menu-icon {
        width: 30px;
        height: 30px;
        max-width: 30px;
        max-height: 30px;
    }

    .menu-icon-invitations,
    .menu-icon-account {
        width: 30px;
        height: 30px;
    }

    .btn-cancel {
        margin-left: 0;
    }

    .table-scroll {
        margin-top: 10px;
    }

    .table-etapes,
    .table-depenses {
        min-width: 0;
    }

    .table-etapes th,
    .table-etapes td,
    .table-depenses th,
    .table-depenses td {
        padding: 8px 6px;
        font-size: 14px;
        white-space: normal;
        word-break: break-word;
    }

    .table-depenses th:first-child,
    .table-depenses td:first-child {
        width: 46%;
        max-width: 180px;
    }

    .table-depenses th:nth-child(2),
    .table-depenses td:nth-child(2) {
        width: 16%;
    }

    .table-etapes td .add-button,
    .table-depenses td .add-button,
    .card-actions-container .add-button,
    .card > .add-button {
        width: 100%;
        min-width: 0;
        padding: 10px 12px;
        line-height: 1.2;
    }

    .remboursement-action-col .add-button {
        width: auto;
        min-width: 112px;
        padding: 8px 12px;
    }

    .table-etapes th:nth-child(4),
    .table-etapes td:nth-child(4) {
        width: 6%;
        padding-left: 4px;
        padding-right: 4px;
    }

    .remboursement-action-col a[href*="remboursement_paye"] {
        min-width: 72px;
    }

    .remboursement-action-col a[href*="remboursement_impaye"] {
        min-width: 36px;
        width: 36px;
        padding: 8px;
    }

    .card h2 {
        align-items: flex-start;
        flex-wrap: wrap;
    }
}

.lock-icon {
    color: #666;
    font-size: 0.9em;
    margin-left: 6px;
}

.users-table tbody tr:last-child,
.users-table tbody tr:nth-child(odd):last-child,
.users-table tbody tr:nth-child(even):last-child {
    font-weight: normal;
    color: var(--text-main);
    background: transparent;
    border-top: none;
}

.users-table tbody tr:nth-child(even):last-child {
    background: #f7faff;
}

.users-table tbody tr:hover,
.users-table tbody tr:nth-child(even):last-child:hover {
    background: var(--blue-light);
}
