/**
 * YahuSante Gateway - Frontend Styles
 * Optimisé pour la Côte d'Ivoire - Mobile First
 */

:root {
    --yahusante-primary: #00A651;
    --yahusante-primary-dark: #008f44;
    --yahusante-primary-light: #33C46F;
    --yahusante-secondary: #FFD700;
    --yahusante-secondary-dark: #E6C200;
    --yahusante-radius: 12px;
    --yahusante-radius-sm: 8px;
    --yahusante-shadow: 0 4px 20px rgba(0, 166, 81, 0.12);
    --yahusante-shadow-hover: 0 8px 30px rgba(0, 166, 81, 0.18);
    --yahusante-transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   CHECKOUT - Mode Manuel (Paiement Mobile Money Direct)
   ========================================================================== */

#yahusante-manual-fields {
    background: linear-gradient(135deg, #f8fff8 0%, #fffef0 100%);
    border: 2px solid var(--yahusante-primary);
    border-radius: var(--yahusante-radius);
    padding: 24px;
    margin: 16px 0;
    box-shadow: var(--yahusante-shadow);
    animation: yahusante-fade-in 0.4s ease-out;
}

@keyframes yahusante-fade-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

#yahusante-manual-fields legend {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--yahusante-primary);
    padding: 0 12px;
    background: white;
    border-radius: 4px;
}

.yahusante-instruction {
    background: linear-gradient(90deg, #e8f5e9 0%, #fff8e1 100%);
    border-left: 4px solid var(--yahusante-primary);
    padding: 16px 20px;
    border-radius: var(--yahusante-radius-sm);
    margin-bottom: 20px;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #333;
}

.yahusante-amount-highlight {
    background: linear-gradient(135deg, var(--yahusante-primary) 0%, var(--yahusante-primary-dark) 100%);
    color: white;
    padding: 18px 24px;
    border-radius: var(--yahusante-radius);
    text-align: center;
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 24px;
    box-shadow: var(--yahusante-shadow);
    letter-spacing: 0.5px;
}

/* Table des opérateurs */
.yahusante-operators-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 16px 0;
    background: white;
    border-radius: var(--yahusante-radius);
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.yahusante-operators-table th {
    background: linear-gradient(90deg, var(--yahusante-primary) 0%, var(--yahusante-primary-dark) 100%);
    color: white;
    padding: 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.yahusante-operators-table td {
    padding: 16px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
    transition: background 0.2s;
}

.yahusante-operators-table tr:last-child td { border-bottom: none; }
.yahusante-operators-table tbody tr:hover td { background: #fafffa; }

.yahusante-operators-table code {
    background: linear-gradient(90deg, #e8f5e9 0%, #fff8e1 100%);
    padding: 10px 16px;
    border-radius: var(--yahusante-radius-sm);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--yahusante-primary);
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    border: 1px solid rgba(0, 166, 81, 0.2);
    display: inline-block;
    min-width: 140px;
    text-align: center;
}

.operator-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 24px;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.op-orange { background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%); color: #e65100; border: 1px solid #ffcc80; }
.op-mtn { background: linear-gradient(135deg, #fce4ec 0%, #f8bbd0 100%); color: #c2185b; border: 1px solid #f48fb1; }
.op-wave { background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%); color: #1565c0; border: 1px solid #90caf9; }
.op-moov { background: linear-gradient(135deg, #f3e5f5 0%, #e1bee7 100%); color: #7b1fa2; border: 1px solid #ce93d8; }

/* Détails virement / espèces */
.yahusante-bank-details,
.yahusante-cash-details {
    margin-top: 16px;
    border: 1px solid #e8e8e8;
    border-radius: var(--yahusante-radius);
    overflow: hidden;
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.yahusante-bank-details summary,
.yahusante-cash-details summary {
    padding: 16px 24px;
    cursor: pointer;
    font-weight: 600;
    color: var(--yahusante-primary);
    background: linear-gradient(90deg, #fafafa 0%, #f5f5f5 100%);
    border-bottom: 1px solid #eee;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background 0.2s;
}

.yahusante-bank-details summary:hover,
.yahusante-cash-details summary:hover { background: #f0f0f0; }

.yahusante-bank-details summary::-webkit-details-marker,
.yahusante-cash-details summary::-webkit-details-marker { display: none; }

.yahusante-bank-details summary::before,
.yahusante-cash-details summary::before {
    content: '+';
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--yahusante-primary);
    color: white;
    border-radius: 50%;
    font-size: 1.1rem;
    font-weight: 700;
    transition: transform 0.3s ease, background 0.2s;
    flex-shrink: 0;
}

.yahusante-bank-details[open] summary::before,
.yahusante-cash-details[open] summary::before {
    transform: rotate(45deg);
    background: var(--yahusante-primary-dark);
}

.yahusante-bank-details pre {
    margin: 0;
    padding: 24px;
    background: #f8f9fa;
    border-radius: 0 0 var(--yahusante-radius) var(--yahusante-radius);
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 0.9rem;
    line-height: 1.8;
    color: #333;
    white-space: pre-wrap;
    word-break: break-word;
}

.yahusante-cash-details p { margin: 0; padding: 24px; color: #555; line-height: 1.7; }

/* Champs validation */
.yahusante-verify-fields {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #e8e8e8;
}

.yahusante-verify-fields h4 {
    margin: 0 0 20px;
    color: var(--yahusante-primary);
    font-size: 1.1rem;
    font-weight: 700;
}

.yahusante-verify-fields .form-row {
    margin-bottom: 20px;
}

.yahusante-verify-fields label {
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
    display: block;
    font-size: 0.95rem;
}

.yahusante-verify-fields .input-text,
.yahusante-verify-fields select {
    width: 100%;
    border: 2px solid #e0e0e0;
    border-radius: var(--yahusante-radius-sm);
    padding: 16px 18px;
    font-size: 1rem;
    font-family: inherit;
    background: white;
    transition: var(--yahusante-transition);
    box-sizing: border-box;
}

.yahusante-verify-fields .input-text:focus,
.yahusante-verify-fields select:focus {
    border-color: var(--yahusante-primary);
    box-shadow: 0 0 0 4px rgba(0, 166, 81, 0.15);
    outline: none;
}

.yahusante-verify-fields select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2300A651' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 20px;
    padding-right: 50px;
}

.yahusante-verify-fields .input-text::placeholder {
    color: #999;
    font-size: 0.9rem;
}

/* États de validation */
.yahusante-verify-fields .input-text.valid,
.yahusante-verify-fields select.valid {
    border-color: var(--yahusante-primary);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2300A651' stroke-width='3'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 22px;
    padding-right: 50px;
}

.yahusante-verify-fields .input-text.invalid {
    border-color: #e53935;
    box-shadow: 0 0 0 4px rgba(229, 57, 53, 0.15);
}

/* Message d'erreur personnalisé */
.yahusante-verify-fields .woocommerce-error {
    background: #fdecea;
    border-color: #e53935;
    color: #c62828;
    border-radius: var(--yahusante-radius-sm);
    padding: 14px 20px;
    margin-top: 12px;
    font-size: 0.9rem;
}

/* ==========================================================================
   ORDER RECEIVED / THANK YOU PAGE
   ========================================================================== */

.woocommerce-order-received .yahusante-manual-summary {
    background: linear-gradient(135deg, #f8fff8 0%, #fffef0 100%);
    border: 2px solid var(--yahusante-primary);
    border-radius: var(--yahusante-radius);
    padding: 24px;
    margin: 24px 0;
    box-shadow: var(--yahusante-shadow);
}

.yahusante-manual-summary h3 {
    margin: 0 0 16px;
    color: var(--yahusante-primary);
    font-size: 1.2rem;
    font-weight: 700;
}

.yahusante-manual-summary .summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.yahusante-manual-summary .summary-item {
    background: white;
    padding: 16px;
    border-radius: var(--yahusante-radius-sm);
    border: 1px solid #e8e8e8;
}

.yahusante-manual-summary .summary-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: #888;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.yahusante-manual-summary .summary-value {
    font-weight: 600;
    color: #333;
    font-size: 1rem;
}

.yahusante-manual-summary .summary-value code {
    background: #e8f5e9;
    color: var(--yahusante-primary);
    padding: 4px 10px;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.95rem;
}

/* ==========================================================================
   ADMIN - Colonnes commandes
   ========================================================================== */

.wp-list-table .column-yahusante_sender,
.wp-list-table .column-yahusante_txn,
.wp-list-table .column-yahusante_op {
    width: 140px;
    min-width: 120px;
}

.wp-list-table .column-yahusante_op .operator-badge {
    font-size: 0.75rem;
    padding: 4px 10px;
}

/* ==========================================================================
   RESPONSIVE - Mobile First
   ========================================================================== */

@media (max-width: 768px) {
    #yahusante-manual-fields { padding: 20px 16px; }

    .yahusante-amount-highlight {
        font-size: 1.2rem;
        padding: 16px;
    }

    .yahusante-operators-table {
        font-size: 0.85rem;
    }

    .yahusante-operators-table th,
    .yahusante-operators-table td {
        padding: 12px;
    }

    .yahusante-operators-table code {
        font-size: 1rem;
        padding: 8px 12px;
        min-width: 120px;
    }

    .operator-badge {
        font-size: 0.75rem;
        padding: 6px 12px;
    }

    .yahusante-verify-fields .input-text,
    .yahusante-verify-fields select {
        padding: 16px;
        font-size: 1rem; /* Évite zoom iOS */
    }

    .yahusante-bank-details summary,
    .yahusante-cash-details summary {
        padding: 14px 16px;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .yahusante-operators-table thead { display: none; }
    .yahusante-operators-table tbody tr {
        display: block;
        margin-bottom: 16px;
        border: 1px solid #e8e8e8;
        border-radius: var(--yahusante-radius);
        background: white;
        box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    }
    .yahusante-operators-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 12px 16px;
        border: none;
        border-bottom: 1px solid #f0f0f0;
    }
    .yahusante-operators-table tbody tr td:last-child { border-bottom: none; }
    .yahusante-operators-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #666;
        font-size: 0.8rem;
        text-transform: uppercase;
    }
    .yahusante-operators-table td:first-child { background: linear-gradient(90deg, var(--yahusante-primary) 0%, var(--yahusante-primary-dark) 100%); color: white; border-radius: var(--yahusante-radius) var(--yahusante-radius) 0 0; }
    .yahusante-operators-table td:first-child::before { color: rgba(255,255,255,0.8); }
}

/* ==========================================================================
   ACCESSIBILITÉ
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    #yahusante-manual-fields,
    .yahusante-operators-table td,
    .yahusante-verify-fields .input-text,
    .yahusante-verify-fields select,
    .operator-badge {
        animation: none !important;
        transition: none !important;
    }
}

.yahusante-verify-fields .input-text:focus-visible,
.yahusante-verify-fields select:focus-visible {
    outline: 3px solid var(--yahusante-secondary);
    outline-offset: 2px;
}

/* ==========================================================================
   IMPRESSION
   ========================================================================== */

@media print {
    #yahusante-manual-fields {
        border: 2px solid #333 !important;
        box-shadow: none !important;
        background: white !important;
    }
    .yahusante-amount-highlight {
        background: #333 !important;
        color: white !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .operator-badge {
        border: 1px solid #333 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}