/* --- Variables CSS pour la cohérence des couleurs (Kinema+ Dark Theme) --- */
:root {
    /* Couleurs de base Kinema+ */
    --kinema-green-dark: #2E8B57; /* Vert Kinema+ foncé pour les accents profonds */
    --kinema-green-light: #3BCC7A; /* Vert Kinema+ clair pour les accents vifs */
    --kinema-blue: #2196F3; /* Bleu pour les éléments secondaires ou neutres */
    --kinema-red: #CC3B3B; /* Rouge pour les erreurs/retraits */
    --kinema-orange: #F59E0B; /* Orange pour les avertissements */

    /* Couleurs du texte */
    --text-primary-dark: #FFFFFF; /* Texte principal blanc sur fond sombre */
    --text-secondary-dark: #A0A0A0; /* Texte secondaire gris clair */
    --text-tertiary-dark: #B0B0B0; /* Texte de description/notes */

    /* Couleurs de fond */
    --bg-dark-primary: #1C1C1E; /* Fond principal des sections/cards */
    --bg-dark-secondary: #0F0F0F; /* Fond plus sombre pour les éléments internes */
    --bg-dark-body: linear-gradient(160deg, #0A0A0A 0%, #1A1A1A 100%); /* Fond du body */

    /* Bordures et ombres */
    --border-dark: #282828; /* Bordure subtile */
    --shadow-dark: rgba(0, 0, 0, 0.7); /* Ombre profonde */
    --shadow-light-impact: rgba(0, 0, 0, 0.5); /* Ombre pour effets de hover/focus */
}

/* --- Reset et styles de base --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; /* Police moderne et lisible */
    background: var(--bg-dark-body);
    min-height: 100vh;
    color: var(--text-primary-dark);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Header --- */
header {
    background: linear-gradient(135deg, #2A2A2E 0%, #1E1E22 100%); /* Fond sombre pour le header */
    padding: 1.25rem 2.5rem; /* Plus de padding */
    box-shadow: 0 5px 20px var(--shadow-light-impact); /* Ombre plus douce */
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-dark);
    position: sticky; /* Rendre le header collant */
    top: 0;
    z-index: 1000; /* Assurer qu'il est au-dessus des autres éléments */
}

header h1 {
    color: var(--kinema-green-light); /* Titre Kinema+ vert */
    font-size: 1.8rem; /* Plus grand */
    font-weight: 800; /* Plus gras */
    letter-spacing: -0.8px; /* Un peu resserré */
}

.header-user-info {
    display: flex;
    align-items: center;
    gap: 1rem; /* Plus d'espace */
}

.header-user-info span {
    font-weight: 600; /* Plus gras */
    color: var(--text-primary-dark);
    font-size: 1.05rem; /* Légèrement plus grand */
}

.header-user-info img {
    width: 45px; /* Plus grande */
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--kinema-green-light); /* Bordure verte Kinema+ */
    box-shadow: 0 0 0 2px rgba(255,255,255,0.05);
}

/* --- Container principal --- */
.transaction-container {
    max-width: 1200px;
    margin: 2.5rem auto; /* Plus de marge */
    padding: 0 1.5rem; /* Plus de padding horizontal */
    display: grid;
    gap: 2.5rem; /* Plus d'espace entre les sections */
    grid-template-columns: 1fr; /* Une seule colonne par défaut */
}

/* --- Section Carte Virtuelle --- */
.virtual-card-section {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem; /* Plus d'espace */
}

.virtual-card {
    width: 420px; /* Plus large */
    height: 260px; /* Plus haut */
    background: linear-gradient(135deg, #1A1A1A 0%, #0A0A0A 100%); /* Dégradé très sombre */
    border-radius: 25px; /* Plus arrondi */
    padding: 2.5rem; /* Plus de padding */
    color: white;
    position: relative;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.8); /* Ombre plus profonde */
    transform: perspective(1000px) rotateX(8deg) rotateY(-3deg); /* Légère inclinaison plus moderne */
    transition: transform 0.4s ease, box-shadow 0.4s ease;
    border: 1px solid var(--border-dark); /* Bordure subtile */
}

.virtual-card::before { /* Ajout d'un effet holographique subtil */
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 10% 20%, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0) 60%);
    border-radius: 25px;
    pointer-events: none;
    z-index: 1;
}

.virtual-card:hover {
    transform: perspective(1000px) rotateX(0deg) rotateY(0deg) scale(1.03); /* Effet de zoom plus marqué */
    box-shadow: 0 35px 60px rgba(0, 0, 0, 0.9);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem; /* Plus d'espace */
}

.card-logo {
    font-size: 1.8rem; /* Plus grand */
    font-weight: 800;
    letter-spacing: 3px;
    text-shadow: 0 2px 5px rgba(0,0,0,0.3); /* Ombre sur le texte */
    color: var(--kinema-green-light); /* Logo Kinema+ vert */
}

.card-icon {
    font-size: 2.5rem; /* Plus grande */
    opacity: 0.7; /* Légèrement moins opaque */
    color: var(--text-secondary-dark); /* Icône en gris clair */
}

.card-number {
    margin-bottom: 2.5rem; /* Plus d'espace */
    font-size: 1.5rem; /* Plus grand */
    font-family: 'Space Mono', monospace; /* Police monospace plus moderne */
    letter-spacing: 4px; /* Plus d'espacement entre les chiffres */
    text-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.card-details {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.card-holder .label,
.card-balance .label {
    display: block;
    font-size: 0.8rem; /* Légèrement plus grand */
    opacity: 0.7;
    margin-bottom: 0.35rem; /* Plus d'espace */
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-secondary-dark);
}

.card-holder span:last-child {
    font-size: 1.15rem; /* Plus grand */
    font-weight: 700;
    color: var(--text-primary-dark);
}

.card-balance span:last-child {
    font-size: 1.4rem; /* Plus grand et plus proéminent */
    font-weight: 700;
    color: var(--kinema-green-light); /* Balance en vert Kinema+ */
}

/* --- Sections communes --- */
section {
    background: var(--bg-dark-primary); /* Fond sombre pour les sections */
    border-radius: 20px; /* Plus arrondi */
    padding: 2.5rem; /* Plus de padding */
    box-shadow: 0 10px 30px var(--shadow-dark); /* Ombre plus profonde */
    border: 1px solid var(--border-dark); /* Bordure subtile */
}

section h2 {
    color: var(--text-primary-dark);
    font-size: 1.5rem; /* Plus grand */
    font-weight: 700;
    margin-bottom: 1.5rem; /* Plus d'espace */
    display: flex;
    align-items: center;
    gap: 0.75rem; /* Plus d'espace */
    border-bottom: 2px solid var(--border-dark); /* Séparateur subtil */
    padding-bottom: 0.75rem;
}

section h2 i {
    color: var(--kinema-green-light); /* Icônes en vert Kinema+ */
    font-size: 1.8rem; /* Plus grande */
}

.info-message {
    color: var(--text-secondary-dark);
    font-size: 0.95rem; /* Légèrement plus grand */
    margin-bottom: 2rem; /* Plus d'espace */
    padding: 1.25rem; /* Plus de padding */
    background: rgba(46, 139, 87, 0.1); /* Fond vert Kinema+ translucide */
    border-radius: 10px;
    border-left: 5px solid var(--kinema-green-light); /* Bordure plus épaisse */
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* --- Formulaires de paiement/retrait/transaction --- */
.payment-form,
.withdrawal-form,
.transaction-form {
    display: grid;
    gap: 1.75rem; /* Plus d'espace */
}

.amount-input-group,
.form-group {
    position: relative;
    display: flex;
    align-items: center;
}

input[type="number"],
input[type="text"],
select {
    flex: 1;
    padding: 1.15rem 1.75rem; /* Plus de padding */
    border: 2px solid var(--border-dark);
    border-radius: 15px; /* Plus arrondi */
    font-size: 1rem;
    transition: all 0.3s ease;
    background: var(--bg-dark-secondary); /* Fond sombre pour les inputs */
    color: var(--text-primary-dark);
    font-weight: 500;
}

input[type="number"]:focus,
input[type="text"]:focus,
select:focus {
    outline: none;
    border-color: var(--kinema-green-light); /* Bordure verte Kinema+ au focus */
    box-shadow: 0 0 0 4px rgba(59, 204, 122, 0.2); /* Halo plus prononcé */
}

.currency {
    position: absolute;
    right: 1.25rem; /* Ajusté */
    color: var(--text-secondary-dark);
    font-weight: 600; /* Plus gras */
    pointer-events: none;
    font-size: 1.05rem;
}

/* --- Méthodes de paiement --- */
.payment-methods h3 {
    font-size: 1.15rem; /* Plus grand */
    color: var(--text-primary-dark);
    margin-bottom: 1.25rem;
    font-weight: 600;
}

.payment-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); /* S'adapte mieux */
    gap: 1.5rem; /* Plus d'espace */
}

.payment-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.8rem; /* Plus de padding */
    border: 2px solid var(--border-dark);
    border-radius: 15px;
    background: var(--bg-dark-secondary); /* Fond sombre */
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    color: var(--text-primary-dark);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.payment-btn:hover {
    transform: translateY(-4px); /* Effet de soulèvement plus marqué */
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    border-color: var(--kinema-green-light); /* Bordure verte Kinema+ */
}

.kkiapay-btn {
    border-color: #00d4aa; /* Couleur Kkiapay */
    color: #00d4aa;
}

.kkiapay-btn:hover {
    background: #00d4aa;
    color: white;
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(0, 212, 170, 0.4);
}

.fedapay-btn {
    border-color: #ff6b35; /* Couleur Fedapay */
    color: #ff6b35;
}

.fedapay-btn:hover {
    background: #ff6b35;
    color: white;
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(255, 107, 53, 0.4);
}

.payment-btn i {
    font-size: 2.2rem; /* Plus grand */
    margin-bottom: 0.75rem; /* Plus d'espace */
}

.payment-btn small {
    font-size: 0.85rem; /* Légèrement plus grand */
    opacity: 0.9;
    margin-top: 0.5rem; /* Plus d'espace */
    color: var(--text-secondary-dark);
}

/* --- Boutons d'action --- */
#withdrawBtn,
#performTransactionBtn {
    background: linear-gradient(135deg, var(--kinema-green-dark), var(--kinema-green-light)); /* Dégradé vert Kinema+ */
    color: white;
    border: none;
    padding: 1.15rem 2.5rem; /* Plus de padding */
    border-radius: 15px; /* Plus arrondi */
    font-size: 1.1rem; /* Plus grand */
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem; /* Plus d'espace */
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 8px 20px rgba(46, 139, 87, 0.4); /* Ombre verte */
}

#withdrawBtn:hover,
#performTransactionBtn:hover {
    transform: translateY(-3px); /* Effet de soulèvement plus marqué */
    box-shadow: 0 12px 28px rgba(46, 139, 87, 0.5);
}

#withdrawBtn:disabled,
#performTransactionBtn:disabled {
    background: linear-gradient(135deg, #444444, #555555); /* Gris désactivé */
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    color: #BBBBBB;
}

/* Style spécifique pour le bouton de retrait (Orange) */
.withdrawal-btn {
    background: linear-gradient(135deg, var(--kinema-orange), #d97706); /* Dégradé orange */
    box-shadow: 0 8px 20px rgba(245, 158, 11, 0.4);
}
.withdrawal-btn:hover {
    box-shadow: 0 12px 28px rgba(245, 158, 11, 0.5);
}


/* --- Messages (Success/Error/Warning) --- */
.message {
    padding: 1.25rem; /* Plus de padding */
    border-radius: 12px;
    font-weight: 600;
    margin-top: 1.5rem; /* Plus d'espace */
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    animation: fadeInScale 0.4s ease-out forwards; /* Animation d'apparition */
}

.message.success {
    background: rgba(46, 139, 87, 0.15);
    color: var(--kinema-green-light);
    border: 1px solid var(--kinema-green-dark);
}

.message.error {
    background: rgba(204, 59, 59, 0.15);
    color: var(--kinema-red);
    border: 1px solid var(--kinema-red);
}

.message.warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--kinema-orange);
    border: 1px solid var(--kinema-orange);
}

.hidden {
    display: none !important;
    opacity: 0;
    transform: scale(0.9);
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* --- Notes --- */
.withdrawal-note,
.api-note {
    font-size: 0.9rem; /* Plus grand */
    color: var(--text-secondary-dark);
    font-style: italic;
    margin-top: 1.5rem;
    text-align: center;
    line-height: 1.5;
}

/* --- Historique des transactions --- */
.transactions-list {
    max-height: 450px; /* Plus haut */
    overflow-y: auto;
    background: var(--bg-dark-secondary); /* Fond sombre pour la liste */
    border-radius: 12px;
    border: 1px solid var(--border-dark);
    padding: 0.5rem 0; /* Padding interne */
}

.transactions-list::-webkit-scrollbar {
    width: 8px; /* Largeur du scrollbar */
}

.transactions-list::-webkit-scrollbar-track {
    background: #1A1A1A; /* Fond du scrollbar */
    border-radius: 10px;
}

.transactions-list::-webkit-scrollbar-thumb {
    background: #444444; /* Couleur de la poignée du scrollbar */
    border-radius: 10px;
}

.transactions-list::-webkit-scrollbar-thumb:hover {
    background: #555555; /* Couleur de la poignée au survol */
}

.transaction-item {
    display: flex; /* Utiliser flexbox pour plus de flexibilité */
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem; /* Plus d'espace */
    padding: 1.25rem 1.5rem; /* Plus de padding */
    border-bottom: 1px solid rgba(var(--border-dark), 0.7); /* Bordure plus subtile */
    transition: background-color 0.2s ease;
}

.transaction-item:hover {
    background: rgba(46, 139, 87, 0.05); /* Légère surbrillance verte au survol */
}

.transaction-item:last-child {
    border-bottom: none;
}

.transaction-details {
    flex-grow: 1; /* Permet aux détails de prendre l'espace restant */
}

.transaction-item .description {
    font-weight: 600; /* Plus gras */
    color: var(--text-primary-dark);
    font-size: 1.05rem;
    margin-bottom: 0.25rem;
}

.transaction-item .date {
    color: var(--text-secondary-dark);
    font-size: 0.9rem; /* Légèrement plus grand */
}

.transaction-item .amount {
    font-size: 1.15rem; /* Plus grand */
    font-weight: 700;
    text-align: right;
    min-width: 80px; /* Pour aligner les montants */
}

.transaction-item.deposit .amount {
    color: var(--kinema-green-light); /* Dépôt en vert Kinema+ */
}

.transaction-item.withdrawal .amount {
    color: var(--kinema-red); /* Retrait en rouge Kinema+ */
}

.no-content-message {
    text-align: center;
    color: var(--text-secondary-dark);
    font-style: italic;
    padding: 2.5rem;
    font-size: 1rem;
}

/* --- Balance (au sein des sections) --- */
.balance-amount {
    font-size: 1.8rem; /* Plus grand et très proéminent */
    font-weight: 800;
    color: var(--kinema-green-light); /* Balance en vert Kinema+ */
    text-align: center;
    margin-top: 1.5rem;
    padding: 1rem;
    background: rgba(46, 139, 87, 0.08); /* Léger fond vert */
    border-radius: 10px;
    border: 1px solid rgba(46, 139, 87, 0.3);
}

/* --- Responsive Design --- */
@media (min-width: 769px) and (max-width: 1200px) {
    .transaction-container {
        grid-template-columns: 1fr; /* Une seule colonne pour les tablettes en paysage */
    }
}

@media (max-width: 768px) {
    .transaction-container {
        padding: 0 1rem; /* Moins de padding */
        gap: 1.5rem;
    }

    header {
        padding: 1rem 1.5rem;
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    header h1 {
        font-size: 1.6rem;
    }
    .header-user-info span {
        font-size: 0.95rem;
    }
    .header-user-info img {
        width: 40px;
        height: 40px;
    }

    .virtual-card-section {
        margin-bottom: 1rem;
    }
    .virtual-card {
        width: 100%;
        max-width: 350px;
        height: 220px;
        padding: 1.8rem;
        transform: none; /* Supprime l'inclinaison sur mobile */
        box-shadow: 0 15px 30px rgba(0,0,0,0.6);
        border-radius: 20px;
    }
    .virtual-card:hover {
        transform: scale(1.02); /* Simple zoom au survol */
        box-shadow: 0 20px 40px rgba(0,0,0,0.7);
    }
    .card-header {
        margin-bottom: 2rem;
    }
    .card-logo {
        font-size: 1.6rem;
    }
    .card-icon {
        font-size: 2.2rem;
    }
    .card-number {
        font-size: 1.3rem;
        letter-spacing: 3px;
        margin-bottom: 2rem;
    }
    .card-holder .label, .card-balance .label {
        font-size: 0.7rem;
    }
    .card-holder span:last-child, .card-balance span:last-child {
        font-size: 1.05rem;
    }
    .card-balance span:last-child {
        font-size: 1.25rem;
    }

    section {
        padding: 1.8rem;
        border-radius: 18px;
    }
    section h2 {
        font-size: 1.3rem;
        margin-bottom: 1.2rem;
    }
    section h2 i {
        font-size: 1.5rem;
    }
    .info-message {
        padding: 1rem;
        font-size: 0.9rem;
        margin-bottom: 1.5rem;
    }

    input[type="number"],
    input[type="text"],
    select {
        padding: 1rem 1.5rem;
        border-radius: 12px;
        font-size: 0.95rem;
    }
    .currency {
        right: 1rem;
        font-size: 1rem;
    }

    .payment-buttons {
        grid-template-columns: 1fr; /* Une seule colonne sur mobile */
        gap: 1.25rem;
    }
    .payment-btn {
        padding: 1.5rem;
        border-radius: 12px;
    }
    .payment-btn i {
        font-size: 2rem;
    }
    .payment-btn small {
        font-size: 0.8rem;
    }

    #withdrawBtn,
    #performTransactionBtn {
        padding: 1rem 2rem;
        font-size: 1rem;
        border-radius: 12px;
    }

    .message {
        padding: 1rem;
        font-size: 0.9rem;
        gap: 0.5rem;
    }

    .withdrawal-note, .api-note {
        font-size: 0.8rem;
        margin-top: 1rem;
    }

    .transactions-list {
        max-height: 350px;
    }
    .transaction-item {
        flex-direction: column; /* Les éléments de transaction s'empilent */
        align-items: flex-start;
        gap: 0.5rem;
        padding: 1rem 1.25rem;
    }
    .transaction-item .description {
        font-size: 1rem;
        margin-bottom: 0;
    }
    .transaction-item .amount {
        font-size: 1.05rem;
        width: 100%; /* Prend toute la largeur */
        text-align: left; /* Aligné à gauche */
    }
    .transaction-item .date {
        font-size: 0.85rem;
        width: 100%;
        text-align: left;
    }

    .no-content-message {
        padding: 1.5rem;
        font-size: 0.9rem;
    }
    .balance-amount {
        font-size: 1.5rem;
        padding: 0.8rem;
    }
}

@media (max-width: 480px) {
    .transaction-container {
        padding: 0 0.8rem;
    }
    header {
        padding: 0.8rem;
    }
    header h1 {
        font-size: 1.4rem;
    }
    .header-user-info span {
        display: none; /* Cache le nom d'utilisateur sur très petit écran */
    }
    .header-user-info img {
        width: 35px;
        height: 35px;
    }

    .virtual-card {
        padding: 1.5rem;
        height: 200px;
        border-radius: 18px;
    }
    .card-header {
        margin-bottom: 1.5rem;
    }
    .card-logo {
        font-size: 1.4rem;
    }
    .card-icon {
        font-size: 2rem;
    }
    .card-number {
        font-size: 1.1rem;
        letter-spacing: 2px;
        margin-bottom: 1.5rem;
    }
    .card-holder .label, .card-balance .label {
        font-size: 0.65rem;
        margin-bottom: 0.2rem;
    }
    .card-holder span:last-child, .card-balance span:last-child {
        font-size: 0.95rem;
    }
    .card-balance span:last-child {
        font-size: 1.1rem;
    }

    section {
        padding: 1.5rem;
        border-radius: 15px;
    }
    section h2 {
        font-size: 1.2rem;
        margin-bottom: 1rem;
    }
    section h2 i {
        font-size: 1.4rem;
    }

    input[type="number"],
    input[type="text"],
    select {
        padding: 0.8rem 1.2rem;
        border-radius: 10px;
        font-size: 0.9rem;
    }
    .currency {
        right: 0.8rem;
        font-size: 0.9rem;
    }

    .payment-btn {
        padding: 1.2rem;
    }
    .payment-btn i {
        font-size: 1.8rem;
    }
    .payment-btn small {
        font-size: 0.75rem;
    }

    #withdrawBtn, #performTransactionBtn {
        padding: 0.8rem 1.5rem;
        font-size: 0.9rem;
        border-radius: 10px;
    }

    .balance-amount {
        font-size: 1.3rem;
        padding: 0.7rem;
    }
}
