/* --- STYLES COMMUNS ET SÉLECTEUR DE DESIGN --- */
.ktm-actions-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 40px;
}
.ktm-container {
    font-family: 'Poppins', sans-serif;
    padding: 20px 0;
}

.ktm-container h2 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 25px;
    font-size: 2.5em;
    font-weight: 600;
}

.ktm-design-switcher {
    text-align: center;
}

.ktm-design-switcher button {
    font-family: 'Poppins', sans-serif;
    background-color: #f0f0f0;
    border: 2px solid #ddd;
    border-radius: 20px;
    padding: 8px 20px;
    font-size: 1em;
    font-weight: 500;
    cursor: pointer;
    margin: 0 5px;
    transition: all 0.3s ease;
}

.ktm-design-switcher button:hover {
    background-color: #e0e0e0;
    border-color: #ccc;
}

.ktm-design-switcher button.active {
    background-color: #7ED321;
    color: #fff;
    border-color: #579912;
}

/* --- DESIGN 1 : MODERNE (Styles existants) --- */

/* Grille pour les cartes */
.ktm-cards-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
}

/* Design de la carte de tontine */
.ktm-subscription-card {
    background: #ebffd6;
    border-radius: 15px;
    box-shadow: 0 10px 10px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border-bottom: 5px solid #000000;
    border-top: 1px solid #000000;
    border-right: 1px solid #000000;
    border-left: 5px solid #000000; /* Bordure de couleur pour le design */
}

.ktm-subscription-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.12);
}

/* Entête de la carte */
.ktm-card-header {
    padding: 20px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(52, 152, 219, 0.05); /* Arrière-plan léger */
}

.ktm-card-title {
    margin: 0;
    font-size: 1.4em;
    font-weight: 600;
    color: #2c3e50;
}

.ktm-card-periodicity {
    background: #7ED321;
    color: #000;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8em;
    font-weight: 500;
}

/* Corps de la carte */
.ktm-card-body {
    padding: 30px 25px;
    text-align: center;
    flex-grow: 1;
}

.ktm-card-amount {
    font-size: 4em;
    font-weight: 900;
    color: #27ae60; /* Couleur verte pour le montant */
    margin: 0;
}

.ktm-card-label {
    color: #7f8c8d;
    font-size: 0.9em;
    margin-top: -20px;
}

/* Section de la barre de progression */
.ktm-card-progress-section {
    padding: 0 25px 20px 25px;
}

.ktm-progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.9em;
    color: #34495e;
}

.ktm-progress-bar-container {
    width: 100%;
    background-color: #000000;
    border-radius: 10px;
    height: 10px;
}

.ktm-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #27ae60, #2ecc71);
    border-radius: 10px;
    transition: width 0.5s ease-in-out;
}

/* Pied de la carte et bouton */
.ktm-card-footer {
    padding: 15px;
    background: #f9f9f9;
}

.ktm-pay-button {
    width: 100%;
    padding: 15px;
    background: linear-gradient(90deg, #7ED321, #92ff20);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    text-transform: uppercase;
    transition: background 0.3s ease, transform 0.2s ease;
}

.ktm-pay-button:hover {
    background: linear-gradient(90deg, #579912, #6ec018);
    transform: scale(1.02);
}

.ktm-pay-button:disabled {
    background: #30500f;
    cursor: not-allowed;
}

.ktm-payment-complete {
    display: block;
    text-align: center;
    color: #23b91c;
    font-weight: 600;
}

/* Responsive pour les mobiles */
@media (max-width: 900px) {
    .ktm-cards-container {
        grid-template-columns: 1fr;
    }
    
    .ktm-container h2 {
        font-size: 2em;
    }
}

/* Messages pour l'utilisateur */
.ktm-login-prompt, .ktm-no-tontine-message {
    text-align: center;
    padding: 40px;
    background: #f5f5f5;
    border-radius: 10px;
    color: #555;
}

/* --- DESIGN 2 : TRADITION (Nouveaux styles) --- */
.ktm-cards-container-tradition {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
}

.ktm-subscription-card-tradition {
    background: #fff;
    border: 1px solid #86ff03;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.ktm-subscription-card-tradition:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.ktm-card-header-tradition {
    padding: 20px;
    background-color: #e9ffd1;
    border-bottom: 1px solid #e9ecef;
}

.ktm-card-title-tradition {
    margin: 0;
    font-size: 30px;
    font-weight: 600;
    color: #343a40;
}

.ktm-card-amount-tradition {
    font-size: 1em;
    color: #6c757d;
    margin-top: 5px;
}

.ktm-card-body-tradition {
    padding: 25px 20px;
    flex-grow: 1;
}

.ktm-progress-circles {
    display: flex;
    flex-wrap: wrap; /* Permet aux cercles de passer à la ligne */
    gap: 10px; /* Espace entre les cercles */
    margin-bottom: 15px;
}

.ktm-circle {
    width: 25px;
    height: 25px;
    border-radius: 50%;
    transition: background-color 0.4s ease;
}

.ktm-circle-empty {
    background-color: #fff;
    border: 2px solid #000;
}

.ktm-circle-filled {
    background-color: #7ED321;
    border: 2px solid #579912;
}

.ktm-progress-text-tradition {
    text-align: center;
    font-size: 0.9em;
    color: #6c757d;
    font-weight: 500;
}

.ktm-card-footer-tradition {
    padding: 15px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

/* Le bouton de paiement est partagé, on s'assure qu'il est stylé correctement */
.ktm-pay-button {
    width: 100%;
    padding: 15px;
    background: linear-gradient(90deg, #7ED321, #92ff20);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    text-transform: uppercase;
    transition: background 0.3s ease, transform 0.2s ease;
}

.ktm-pay-button:hover {
    background: linear-gradient(90deg, #579912, #6ec018);
    transform: scale(1.02);
}

.ktm-pay-button:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
}

.ktm-payment-complete {
    display: block;
    text-align: center;
    color: #27ae60;
    font-weight: 600;
}

/* --- RESPONSIVE DESIGN --- */
@media (max-width: 900px) {
    .ktm-cards-container,
    .ktm-cards-container-tradition {
        grid-template-columns: 1fr; /* 1 carte par ligne sur mobile */
    }
    
    .ktm-container h2 {
        font-size: 2em;
    }
}

#ktm-pdf-download-btn {
    background-color: #c0392b;
    color: #fff;
    border-color: #a93226;
    border-radius: 20px;
    padding: 8px 20px;
    font-size: 1em;
    font-weight: 500;
    text-decoration: none;
    transition: background-color 0.3s;
}

#ktm-pdf-download-btn:hover {
    background-color: #a93226;
    color: #fff;
}


/* --- STYLE POUR L'HISTORIQUE DES TRANSACTIONS --- */
.ktm-history-container h2 {
    font-size: 2em;
    margin-bottom: 25px;
    text-align: left;
}

.ktm-history-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.07);
}

.ktm-history-table th,
.ktm-history-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

.ktm-history-table thead tr {
    background-color: #f8f9fa;
}

.ktm-history-table th {
    font-weight: 600;
    color: #495057;
}

.ktm-history-table tbody tr:hover {
    background-color: #f1f3f5;
}

/* Responsive pour mobile */
@media screen and (max-width: 768px) {
    .ktm-history-table thead {
        display: none;
    }
    .ktm-history-table, .ktm-history-table tbody, .ktm-history-table tr, .ktm-history-table td {
        display: block;
        width: 100%;
    }
    .ktm-history-table tr {
        margin-bottom: 15px;
        border: 1px solid #e9ecef;
        border-radius: 8px;
    }
    .ktm-history-table td {
        text-align: right;
        padding-left: 50%;
        position: relative;
        border-bottom: 0;
    }
    .ktm-history-table td:before {
        content: attr(data-label);
        position: absolute;
        left: 15px;
        width: calc(50% - 30px);
        text-align: left;
        font-weight: 600;
        color: #495057;
    }
    .ktm-history-table tr td:last-child {
       border-bottom: 0;
    }
}

.ktm-early-delivery-wrapper {
    margin-top: 10px;
}

.ktm-early-delivery-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(90deg, #ff8c00, #ffa500); /* Orange gradient */
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
    text-transform: uppercase;
    transition: background 0.3s ease, transform 0.2s ease;
}

.ktm-early-delivery-btn:hover {
    background: linear-gradient(90deg, #e67e00, #f39c12);
    transform: scale(1.02);
}

.ktm-delivery-status {
    display: block;
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    font-size: 0.9em;
    font-weight: 600;
    cursor: not-allowed;
}

.ktm-delivery-processing {
    background-color: #e0e0e0;
    color: #555;
    border: 1px solid #ccc;
}

.ktm-delivery-complete {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* --- Styles pour le Popup de livraison --- */
#ktm-delivery-popup-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 20000;
    display: flex;
    align-items: center;
    justify-content: center;
}

#ktm-delivery-popup-content {
    background: #fff;
    padding: 30px 40px;
    border-radius: 10px;
    width: 90%;
    max-width: 450px;
    position: relative;
    box-shadow: 0 5px 25px rgba(0,0,0,0.2);
    text-align: center;
}

#ktm-delivery-close-popup-btn {
    position: absolute;
    top: 5px; right: 10px;
    background: none; border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
}

#ktm-delivery-popup-actions {
    margin-top: 25px;
    display: flex;
    justify-content: center;
    gap: 15px;
}

#ktm-delivery-confirm-btn {
    background-color: #27ae60 !important;
}
#ktm-delivery-confirm-btn:hover {
    background-color: #229954 !important;
}

/* --- Style pour l'étiquette de pénalité --- */
.ktm-penalty-tag {
    font-size: 0.5em; /* Plus petit que le montant principal */
    font-weight: 500;
    color: #c0392b; /* Rouge */
    background-color: #f8d7da;
    padding: 3px 8px;
    border-radius: 10px;
    vertical-align: middle;
}

/* --- Style pour le détail du montant de la tontine --- */
.ktm-amount-breakdown {
    font-size: 0.4em; /* Beaucoup plus petit */
    font-weight: 400;
    color: #7f8c8d; /* Gris neutre */
    margin-top: 5px;
    display: block;
}

/* Ajustement pour le design Tradition */
.ktm-card-amount-tradition .ktm-amount-breakdown {
    font-size: 0.8em; /* Un peu plus grand pour la lisibilité dans l'en-tête */
    color: #6c757d;
}

/* ===================================================== */
/* === JAUGE DE SCORE DE CONFIANCE (shortcode [ktm_trust_score]) === */
/* ===================================================== */

.ktm-trust-gauge-wrapper {
    font-family: 'Poppins', sans-serif;
    max-width: 420px;
    margin: 20px auto;
    padding: 10px 0;
}

.ktm-trust-gauge-title {
    text-align: center;
    color: #2c3e50;
    font-size: 1.6em;
    font-weight: 600;
    margin-bottom: 20px;
}

.ktm-trust-gauge-card {
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
    padding: 25px 25px 30px;
    text-align: center;
    border: 1px solid #f0f0f0;
}

/* --- Cadran semi-circulaire --- */
.ktm-trust-gauge-dial {
    position: relative;
    width: 100%;
    max-width: 280px;
    margin: 0 auto;
}

.ktm-trust-gauge-svg {
    width: 100%;
    display: block;
}

.ktm-gauge-track {
    fill: none;
    stroke-width: 18;
    stroke-linecap: round;
}

.ktm-gauge-tick {
    stroke: #fff;
    stroke-width: 2;
}

.ktm-gauge-needle {
    transform-origin: 120px 120px;
    transform: rotate(-90deg);
    transition: transform 1.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ktm-gauge-needle polygon {
    fill: #2c3e50;
}

.ktm-gauge-hub {
    fill: #2c3e50;
    stroke: #fff;
    stroke-width: 2;
}

/* --- Affichage du score au centre du cadran --- */
.ktm-trust-gauge-readout {
    position: relative;
    margin-top: -18px;
    text-align: center;
    pointer-events: none;
}

.ktm-trust-gauge-points {
    display: inline-block;
    font-size: 1.7em;
    font-weight: 700;
    color: #2c3e50;
}

.ktm-trust-gauge-points-label {
    display: block;
    font-size: 0.75em;
    color: #95a5a6;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: -2px;
}

/* --- Libellés des bornes (rang actuel / rang suivant) --- */
.ktm-trust-gauge-bounds {
    display: flex;
    justify-content: space-between;
    font-size: 0.78em;
    font-weight: 500;
    margin-top: -30px;
    padding: 0 10px;
}

.ktm-trust-gauge-bounds span:first-child {
    color: #e74c3c;
}

.ktm-trust-gauge-bounds span:last-child {
    color: #27ae60;
}

/* --- Badge du rang actuel --- */
.ktm-trust-gauge-rank-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #ebffd6;
    border: 1px solid #7ED321;
    border-radius: 30px;
    padding: 8px 18px;
    margin-top: 22px;
}

.ktm-trust-gauge-rank-chip img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}

.ktm-trust-gauge-rank-chip span {
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.95em;
}

.ktm-trust-gauge-rank-description {
    margin-top: 10px;
    font-size: 0.85em;
    font-style: italic;
    color: #7f8c8d;
    line-height: 1.4;
}

/* --- Messages sous la jauge --- */
.ktm-trust-gauge-next-info {
    margin-top: 14px;
    font-size: 0.9em;
    color: #7f8c8d;
}

.ktm-trust-gauge-next-info strong {
    color: #2c3e50;
}

.ktm-trust-gauge-caption {
    margin-top: 4px;
    font-size: 0.75em;
    color: #b0b0b0;
}

/* --- État : rang maximum atteint --- */
.ktm-trust-gauge-max .ktm-trust-gauge-card {
    border: 1px solid #f1c40f;
    box-shadow: 0 8px 25px rgba(241, 196, 15, 0.18);
}

.ktm-trust-gauge-max .ktm-trust-gauge-rank-chip {
    background: #fff8e1;
    border-color: #f1c40f;
}

.ktm-trust-gauge-max-banner {
    margin-top: 14px;
    font-weight: 600;
    color: #b8860b;
    font-size: 0.95em;
}

/* --- Responsive mobile --- */
@media (max-width: 480px) {
    .ktm-trust-gauge-card {
        padding: 20px 15px 25px;
    }
    .ktm-trust-gauge-points {
        font-size: 1.4em;
    }
    .ktm-trust-gauge-bounds {
        font-size: 0.72em;
    }
}