/* =============================================================================
   HelloAsso Membership — Frontend CSS
   ============================================================================= */

/* ── Bouton checkout ─────────────────────────────────────────────────────────── */

.ham-checkout-wrap {
    display: inline-block;
    margin: 1em 0;
}

.ham-checkout-label {
    margin-bottom: 0.5em;
    font-size: 1rem;
}

.ham-checkout-btn {
    display: inline-block;
    padding: 12px 28px;
    background-color: #e84e1b; /* Couleur HelloAsso */
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.2s ease;
}

.ham-checkout-btn:hover,
.ham-checkout-btn:focus {
    background-color: #c43e13;
    color: #fff;
    outline: 2px solid #c43e13;
    outline-offset: 2px;
}

.ham-checkout-btn:disabled {
    background-color: #aaa;
    cursor: not-allowed;
}

.ham-checkout-loading {
    margin-top: 0.5em;
    font-style: italic;
    color: #555;
}

.ham-checkout-error {
    margin-top: 0.5em;
    color: #c0392b;
    font-weight: 600;
}

/* ── Contenu réservé (ham_members_only) ────────────────────────────────────── */

.ham-members-only-msg {
    padding: 12px 16px;
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    color: #856404;
    border-radius: 3px;
    margin: 1em 0;
}

/* ── Mon adhésion (ham_my_membership) ───────────────────────────────────────── */

.ham-my-membership {
    padding: 1.5rem;
    border-radius: 6px;
    margin: 1em 0;
    border: 1px solid #dee2e6;
    background: #f8f9fa;
}

.ham-my-membership h3 {
    margin-top: 0;
    margin-bottom: 1rem;
}

.ham-membership-details {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem;
}

.ham-membership-details li {
    padding: 4px 0;
}

/* Badges */
.ham-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.ham-badge-active {
    background: #d4edda;
    color: #155724;
}

.ham-badge-inactive,
.ham-badge-expired {
    background: #f8d7da;
    color: #721c24;
}

.ham-renewal-notice {
    color: #856404;
    font-weight: 600;
    margin-bottom: 0.5em;
}

/* Bouton renouvellement */
.ham-btn {
    display: inline-block;
    padding: 10px 22px;
    border-radius: 4px;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.2s ease;
}

.ham-btn-renew {
    background-color: #e84e1b;
    color: #fff !important;
}

.ham-btn-renew:hover,
.ham-btn-renew:focus {
    background-color: #c43e13;
    color: #fff !important;
}

/* Connexion requise */
.ham-login-required {
    padding: 12px 16px;
    background: #d1ecf1;
    border-left: 4px solid #bee5eb;
    color: #0c5460;
    border-radius: 3px;
}

/* ── Formulaire de connexion [ham_login_form] ────────────────────────────────── */

.ham-login-wrap {
    max-width: 420px;
    margin: 0 auto;
}

.ham-login-error {
    padding: 10px 14px;
    background: #fdf2f2;
    border-left: 4px solid #e53935;
    color: #b71c1c;
    border-radius: 3px;
    margin-bottom: 18px;
    font-size: 0.9rem;
}

.ham-login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ham-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.ham-field label {
    font-size: 0.88rem;
    font-weight: 600;
    color: #3c434a;
}

.ham-field input[type="text"],
.ham-field input[type="email"],
.ham-field input[type="password"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    font-size: 1rem;
    line-height: 1.5;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
    background: #fff;
    color: #1d2327;
}

.ham-field input:focus {
    border-color: #e84e1b;
    box-shadow: 0 0 0 2px rgba(232, 78, 27, 0.15);
    outline: none;
}

.ham-password-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.ham-password-wrap input {
    padding-right: 42px;
    flex: 1;
}

.ham-toggle-pwd {
    position: absolute;
    right: 2px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px 10px;
    font-size: 15px;
    line-height: 1;
    color: #787c82;
    opacity: 0.7;
}

.ham-toggle-pwd:hover { opacity: 1; }

.ham-remember label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-weight: 400;
    font-size: 0.9rem;
    cursor: pointer;
}

.ham-btn-login {
    padding: 12px;
    background: #e84e1b;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.3px;
    transition: background 0.2s;
}

.ham-btn-login:hover,
.ham-btn-login:focus {
    background: #c43e13;
    outline: none;
}

.ham-login-links {
    text-align: center;
    font-size: 0.88rem;
    color: #787c82;
    margin: 0;
}

.ham-login-links a {
    color: #e84e1b;
    text-decoration: none;
}

.ham-login-links a:hover { text-decoration: underline; }

.ham-sep {
    margin: 0 6px;
    color: #c3c4c7;
}

/* ── Widget HelloAsso [ham_widget] ───────────────────────────────────────────── */

.ham-widget-wrap {
    width: 100%;
    margin: 0 auto;
}

.ham-already-member {
    padding: 20px 24px;
    background: #eaf7ef;
    border: 1px solid #a8ddb5;
    border-radius: 6px;
    color: #1a7a3c;
    text-align: center;
}

.ham-already-member .ham-btn {
    background: #1a7a3c;
    margin-top: 8px;
}

.ham-already-member .ham-btn:hover {
    background: #145e2e;
}

/* ── Espace membre [ham_my_account] ──────────────────────────────────────────── */

.ham-account-wrap {
    max-width: 860px;
    margin: 0 auto;
    font-size: 0.95rem;
}

/* Navigation onglets */
.ham-account-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    border-bottom: 2px solid #e84e1b;
    margin-bottom: 24px;
}

.ham-account-tab {
    padding: 9px 18px;
    border-radius: 4px 4px 0 0;
    text-decoration: none;
    color: #50575e;
    font-weight: 500;
    font-size: 0.9rem;
    transition: background 0.15s, color 0.15s;
    border: 1px solid transparent;
    border-bottom: none;
    margin-bottom: -2px;
}

.ham-account-tab:hover {
    background: #fff5f2;
    color: #e84e1b;
}

.ham-account-tab.active {
    background: #fff;
    color: #e84e1b;
    border-color: #e84e1b;
    font-weight: 700;
}

.ham-tab-logout {
    margin-left: auto;
    color: #787c82;
}

.ham-tab-logout:hover {
    color: #c0392b;
    background: #fdf2f2;
}

/* Panneaux */
.ham-account-panel {
    background: #fff;
    border: 1px solid #e2e4e7;
    border-radius: 0 0 6px 6px;
    padding: 28px 32px;
}

.ham-account-panel h2 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.25rem;
    color: #1d2327;
    letter-spacing: 0;
}

/* Notices flash */
.ham-notice {
    padding: 10px 16px;
    border-radius: 4px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.ham-notice-success {
    background: #eaf7ef;
    border-left: 4px solid #1a7a3c;
    color: #1a7a3c;
}

.ham-notice-error {
    background: #fdf2f2;
    border-left: 4px solid #c0392b;
    color: #c0392b;
}

/* Dashboard grid */
.ham-dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 640px) {
    .ham-dashboard-grid { grid-template-columns: 1fr; }
    .ham-account-panel  { padding: 20px 16px; }
    .ham-account-tab    { padding: 8px 12px; font-size: 0.82rem; }
}

/* Cartes */
.ham-card {
    border: 1px solid #e2e4e7;
    border-radius: 6px;
    padding: 20px;
    background: #fafafa;
}

.ham-card-title {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #787c82;
    margin-bottom: 12px;
}

.ham-info-list {
    list-style: none;
    margin: 12px 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ham-info-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    gap: 8px;
}

.ham-info-list li span {
    color: #787c82;
    flex-shrink: 0;
}

.ham-info-list li strong {
    text-align: right;
}

.ham-soon {
    color: #e84e1b;
    font-weight: 700;
}

.ham-link-edit {
    display: inline-block;
    margin-top: 12px;
    font-size: 0.88rem;
    color: #2271b1;
    text-decoration: none;
}

.ham-link-edit:hover { text-decoration: underline; }

/* Formulaire profil */
.ham-profile-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.ham-fieldset {
    border: 1px solid #e2e4e7;
    border-radius: 6px;
    padding: 18px 20px;
}

.ham-fieldset legend {
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0 8px;
    color: #1d2327;
}

.ham-fieldset legend small {
    font-weight: 400;
    color: #787c82;
}

.ham-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-top: 12px;
}

@media (max-width: 580px) {
    .ham-form-grid { grid-template-columns: 1fr; }
}

.ham-btn-save {
    align-self: flex-start;
    padding: 11px 28px;
    background: #e84e1b;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
}

.ham-btn-save:hover { background: #c43e13; }

/* Tableau historique */
.ham-history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.ham-history-table th,
.ham-history-table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid #f0f0f1;
}

.ham-history-table th {
    background: #f6f7f7;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #50575e;
}

.ham-history-table tbody tr:hover td {
    background: #fafafa;
}


/* ── Photo de profil ─────────────────────────────────────── */
.ham-dashboard-header {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 24px;
}
.ham-dashboard-header h2 {
    margin: 0;
}
/* ── Avatars (dashboard + profil + listing participants) ─────── */

/* Image avatar ronde — neutralise les règles globales d'Elementor */
.ham-avatar-img,
.ham-avatar-preview,
.treco-avatars span img,
.treco-avatar-img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;      /* était: auto — fixe l'aspect 1:1 */
    max-width: 100% !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    aspect-ratio: 1 / 1;
}

/* Initiales avatar (fallback sans photo) */
.treco-avatar-initials {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    height: 100% !important;
    border-radius: 50% !important;
    font-weight: 700;
    letter-spacing: .5px;
    user-select: none;
    line-height: 1;
    flex-shrink: 0;
}

/* Taille fixe du conteneur dans le dashboard header */
.ham-dashboard-avatar .ham-avatar-img,
.ham-dashboard-avatar .treco-avatar-initials {
    width: 80px !important;
    height: 80px !important;
    border: 3px solid #e0e0e0;
    flex-shrink: 0;
}

/* Section upload photo (onglet Profil) */
.ham-fieldset-avatar .ham-avatar-upload-wrap {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.ham-fieldset-avatar .ham-avatar-preview {
    width: 80px !important;
    height: 80px !important;
    border: 3px solid #e0e0e0;
    border-radius: 50% !important;
    flex-shrink: 0;
    object-fit: cover;
    aspect-ratio: 1 / 1;
}

.ham-avatar-upload-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ham-btn-upload {
    display: inline-block;
    cursor: pointer;
    padding: 8px 18px;
    background: #f0f0f0;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: .88rem;
    font-weight: 600;
    color: #333;
    transition: background .15s;
}

.ham-btn-upload:hover {
    background: #e0e0e0;
}

.ham-avatar-hint {
    font-size: .78rem;
    color: #999;
}

/* Couleur de fond initiales (color picker profil) */
.ham-avatar-color-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 2px;
}

.ham-avatar-color-label {
    font-size: .82rem;
    color: #666;
}

#ham_avatar_color {
    width: 36px;
    height: 36px;
    padding: 2px;
    border: 1px solid #ccc;
    border-radius: 6px;
    cursor: pointer;
    background: none;
}
