/* ===================================
   DASHBOARD FIXES
   Override floating labels in dashboard forms
   =================================== */

/* Fix: labels inside dashboard forms must be ABOVE inputs, not floating */
.dashboard-form .form-group {
    position: relative;
}

.dashboard-form .form-group label {
    position: static !important;
    display: block !important;
    margin-bottom: 0.5rem !important;
    font-weight: 600 !important;
    color: #5A5A5A !important;
    font-size: 0.95rem !important;
    pointer-events: auto !important;
    background: none !important;
    padding: 0 !important;
    top: auto !important;
    left: auto !important;
    transform: none !important;
}

.dashboard-form .form-group input:focus + label,
.dashboard-form .form-group input:not(:placeholder-shown) + label,
.dashboard-form .form-group textarea:focus + label,
.dashboard-form .form-group textarea:not(:placeholder-shown) + label {
    position: static !important;
    top: auto !important;
    left: auto !important;
    font-size: 0.95rem !important;
    color: #5A5A5A !important;
    transform: none !important;
}

/* Also fix modals in dashboard */
.modal .form-group label {
    position: static !important;
    display: block !important;
    margin-bottom: 0.5rem !important;
    font-weight: 600 !important;
    color: #5A5A5A !important;
    font-size: 0.95rem !important;
    pointer-events: auto !important;
    background: none !important;
    padding: 0 !important;
    top: auto !important;
    left: auto !important;
    transform: none !important;
}

/* ===================================
   EMPTY STATES — centered, compact
   =================================== */
.empty-state.compact {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1.5rem;
    text-align: center;
}

.empty-state.compact i {
    font-size: 2.2rem;
    color: #ccc;
    margin-bottom: 0.75rem;
    display: block;
}

.empty-state.compact p {
    color: #999;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.empty-state-hint {
    font-size: 0.85rem !important;
    color: #bbb !important;
    font-style: italic;
    margin-bottom: 1rem !important;
}

.empty-state.compact .btn {
    margin-top: 0.5rem;
}

/* ===================================
   SELECT / DROPDOWN ARROWS
   =================================== */
#registerPhoneCountry,
.form-select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23999' 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 10px center;
    background-size: 16px;
    padding-right: 34px !important;
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #E0E0E0;
    border-radius: 10px;
    font-size: 1rem;
    font-family: inherit;
    background-color: #fff;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

#registerPhoneCountry:focus,
.form-select:focus {
    border-color: #7FB069;
    outline: none;
}

/* Fix profile section - remove icons from labels */
.profile-form .form-group label i {
    display: none;
}

/* ===================================
   SETTINGS BUTTONS — wider, more spacing
   =================================== */
.settings-item {
    border: 1px solid #e8e8e8 !important;
    border-radius: 12px !important;
    padding: 1.15rem 1.5rem !important;
    background: #fff !important;
    transition: all 0.2s ease !important;
    width: 100% !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    margin-bottom: 0.75rem !important;
}

.settings-item:hover {
    border-color: #7FB069 !important;
    box-shadow: 0 2px 8px rgba(127, 176, 105, 0.1) !important;
}

.settings-item.danger:hover {
    border-color: #ef4444 !important;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.1) !important;
}

.settings-item-info {
    gap: 0.75rem !important;
}

.settings-item-info div {
    line-height: 1.4 !important;
}

.settings-item-info strong {
    margin-bottom: 0.15rem !important;
    display: block !important;
    font-size: 0.95rem !important;
}

.settings-item-info span {
    font-size: 0.85rem !important;
    color: #999 !important;
    line-height: 1.3 !important;
}

/* Fix form-row inside modals */
.modal .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 768px) {
    .modal .form-row {
        grid-template-columns: 1fr;
    }
}

/* Ajout d'espacement dans le modal d'ajout d'adresse */
.modal .form-group {
    margin-bottom: 1.25rem;
}

.modal .form-group:last-of-type {
    margin-bottom: 0.75rem;
}

.modal .checkbox-label {
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.modal h3 {
    margin-bottom: 1.5rem;
}

.modal form {
    margin-top: 1rem;
}

/* Espacement pour la checkbox "Définir comme adresse par défaut" */
#addressDefault {
    margin-top: 0.5rem;
}

/* ===================================
   FAVORITE BUTTON (on product cards)
   =================================== */
.product-card {
    position: relative;
}

.fav-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 10;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: #ccc;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.fav-btn:hover {
    transform: scale(1.1);
    color: #ef4444;
}

.fav-btn.active {
    color: #ef4444;
}

.fav-btn.active i {
    animation: heartPop 0.3s ease;
}

@keyframes heartPop {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* ===================================
   FAVORITES GRID in dashboard
   =================================== */
.fav-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.fav-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.fav-info {
    padding: 1rem;
}

.fav-info h4 {
    margin: 0 0 0.4rem;
    font-size: 1rem;
    color: #333;
}

.fav-price {
    color: #7FB069;
    font-weight: 700;
    margin: 0 0 0.75rem;
}

#favoritesList {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

#favoritesList .empty-state.compact {
    grid-column: 1 / -1;
}

/* ===================================
   USER MENU DROPDOWN
   =================================== */
/* Gestion de l'affichage du menu utilisateur */
#loginLink.hidden {
    display: none !important;
}

#userMenuContainer.visible {
    display: block !important;
}

.user-menu {
    position: relative;
}

.user-menu-nav-item {
    list-style: none;
}

/* Style pour le lien Mon Compte quand l'utilisateur n'est pas connecté */
.user-menu-nav-item > .nav-link {
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
}

.user-menu-nav-item > .nav-link i.fa-user-circle {
    font-size: 1rem !important;
    line-height: 1 !important;
}

.user-menu-trigger {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    color: #2D3142;
    transition: all 0.3s ease;
    border-radius: 8px;
}

.user-menu-trigger:hover {
    background: rgba(122, 24, 33, 0.1);
}

.user-menu-trigger i.fa-chevron-down {
    font-size: 0.75rem;
    transition: transform 0.3s ease;
}

.user-menu.active .user-menu-trigger i.fa-chevron-down {
    transform: rotate(180deg);
}

.user-menu-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    min-width: 220px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
}

.user-menu.active .user-menu-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    color: #4F5D75;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    font-size: 0.95rem;
}

.user-menu-item:hover {
    background: rgba(122, 24, 33, 0.1);
    color: #7A1821;
}

.user-menu-item i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
}

.user-menu-item.logout-item {
    color: #ef4444;
}

.user-menu-item.logout-item:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.user-menu-divider {
    height: 1px;
    background: #E5E7EB;
    margin: 0;
}

.user-menu-item:first-child {
    border-radius: 12px 12px 0 0;
}

.user-menu-item:last-child {
    border-radius: 0 0 12px 12px;
}

/* ===================================
   CORRECTIONS BOUTONS ADDRESSES/FAVORIS
   =================================== */

/* Section adresses */
#addressesSection.active {
    display: block;
}

#addressesSection .addresses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    width: 100%;
}

/* État vide - Centrage parfait */
#addressesSection .empty-state,
#addressesSection .empty-state.compact {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    padding: 3rem 1.5rem !important;
    min-height: 300px !important;
    grid-column: 1 / -1 !important;
}

#addressesSection .empty-state i,
#addressesSection .empty-state.compact i {
    font-size: 3rem !important;
    color: #ccc !important;
    margin-bottom: 1rem !important;
    display: block !important;
}

#addressesSection .empty-state p,
#addressesSection .empty-state.compact p {
    color: #999 !important;
    font-size: 1rem !important;
    margin: 0.35rem 0 !important;
    line-height: 1.4 !important;
}

#addressesSection .empty-state-hint {
    margin: 0.35rem 0 1rem !important;
    line-height: 1.4 !important;
    font-size: 0.85rem !important;
}

/* ===================================
   SETTINGS - Alignement parfait des textes
   =================================== */

/* S'assurer que tous les settings-item ont la même structure */
.settings-item {
    border: 1px solid #e8e8e8 !important;
    border-radius: 12px !important;
    padding: 1.15rem 1.5rem !important;
    background: #fff !important;
    transition: all 0.2s ease !important;
    width: 100% !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    margin-bottom: 0.75rem !important;
}

.settings-item:hover {
    border-color: #7FB069 !important;
    box-shadow: 0 2px 8px rgba(127, 176, 105, 0.1) !important;
}

.settings-item.danger:hover {
    border-color: #ef4444 !important;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.1) !important;
}

/* Forcer la même largeur d'icône pour tous les items */
.settings-item-info {
    display: flex !important;
    align-items: center !important;
    gap: 0.75rem !important;
    flex: 1 !important;
}

/* S'assurer que les boutons n'ajoutent pas de styles par défaut */
button.settings-item {
    cursor: pointer !important;
    text-align: left !important;
}

button.settings-item:hover {
    cursor: pointer !important;
}

.settings-item-info i {
    width: 40px !important;
    min-width: 40px !important;
    height: 40px !important;
    flex-shrink: 0 !important;
    background: #f8f9fa !important;
    border-radius: 10px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 1.25rem !important;
    color: #7FB069 !important;
}

.settings-item.danger .settings-item-info i {
    background: rgba(239, 68, 68, 0.1) !important;
    color: #ef4444 !important;
}

.settings-item-info div {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
}

.settings-item-info strong {
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
    font-size: 0.95rem !important;
    color: #2D3142 !important;
    line-height: 1.4 !important;
}

.settings-item-info span {
    margin: 0 !important;
    padding: 0 !important;
    margin-top: 0.15rem !important;
    font-size: 0.85rem !important;
    color: #999 !important;
    line-height: 1.3 !important;
    display: block !important;
}

/* ===================================
   BOUTON AJOUTER UNE ADRESSE - Style identique aux favoris
   =================================== */
/* Styles uniformes pour tous les boutons dans les états vides */
#addressesSection .empty-state .btn,
#addressesSection .empty-state.compact .btn,
#favoritesSection .empty-state .btn,
#favoritesSection .empty-state.compact .btn,
#recentOrdersList .empty-state .btn,
#recentOrdersList .empty-state.compact .btn {
    margin-top: 1rem !important;
    width: auto !important;
    max-width: none !important;
    padding: 0.65rem 1.25rem !important;
    font-size: 0.95rem !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.5rem !important;
    height: auto !important;
    line-height: 1.2 !important;
    white-space: nowrap !important;
}

#addressesSection .empty-state .btn i,
#addressesSection .empty-state.compact .btn i,
#favoritesSection .empty-state .btn i,
#favoritesSection .empty-state.compact .btn i,
#recentOrdersList .empty-state .btn i,
#recentOrdersList .empty-state.compact .btn i {
    font-size: 0.95rem !important;
    display: inline-flex !important;
    align-items: center !important;
    margin: 0 !important;
    line-height: 1 !important;
}

/* ===================================
   RESPONSIVE - MOBILE
   =================================== */

@media (max-width: 768px) {
    /* Correction pour la grille d'adresses sur mobile */
    #addressesSection .addresses-grid {
        grid-template-columns: 1fr !important;
        max-width: 100% !important;
        padding: 0 !important;
    }
    
    /* S'assurer que les cartes d'adresse prennent toute la largeur */
    #addressesSection .address-card {
        width: 100% !important;
        max-width: none !important;
    }
}

@media (max-width: 480px) {
    /* Encore plus compact sur très petits écrans */
    #addressesSection .addresses-grid {
        gap: 1rem !important;
    }
    
    #addressesSection .address-card {
        padding: 1rem !important;
    }
}

/* ===================================
   INLINE ADDRESS FORMS — Clean compact style
   =================================== */

/* Button row */
.address-form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

/* Base inline form containers */
#addAddressForm,
#editAddressForm {
    background: #f9f9f9;
    padding: 1.25rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
}

#addAddressForm h3,
#editAddressForm h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    color: #2D3142;
}

/* Form rows inside address forms */
#addAddressForm .form-row,
#editAddressForm .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

#addAddressForm .form-group,
#editAddressForm .form-group {
    margin-bottom: 0.75rem;
}

#addAddressForm .form-group label,
#editAddressForm .form-group label {
    font-size: 0.85rem !important;
    margin-bottom: 0.3rem !important;
}

#addAddressForm .form-group input,
#editAddressForm .form-group input {
    padding: 0.6rem 0.75rem !important;
    font-size: 0.9rem !important;
    border-radius: 8px !important;
}

/* Buttons inside inline address forms */
#addAddressForm .btn,
#editAddressForm .btn,
#addAddressForm button[type="submit"],
#editAddressForm button[type="submit"],
#addAddressForm button[type="button"],
#editAddressForm button[type="button"] {
    padding: 0.55rem 1.1rem !important;
    font-size: 0.85rem !important;
    border-radius: 8px !important;
    gap: 0.4rem !important;
    height: auto !important;
    min-height: 0 !important;
}

#addAddressForm .btn i,
#editAddressForm .btn i {
    font-size: 0.8rem !important;
}

/* ===================================
   MODAL ADDRESS FORM — Clean compact style
   =================================== */
#addAddressModal .btn,
#addAddressModal button[type="submit"] {
    padding: 0.6rem 1.25rem !important;
    font-size: 0.9rem !important;
    border-radius: 8px !important;
    gap: 0.4rem !important;
    height: auto !important;
    min-height: 0 !important;
    width: auto !important;
}

#addAddressModal .form-group {
    margin-bottom: 1rem;
}

#addAddressModal .form-group label {
    font-size: 0.85rem !important;
    margin-bottom: 0.3rem !important;
}

#addAddressModal .form-group input,
#addAddressModal .form-group select {
    padding: 0.6rem 0.75rem !important;
    font-size: 0.9rem !important;
    border-radius: 8px !important;
}

#addAddressModal h3 {
    font-size: 1.15rem !important;
    margin-bottom: 1rem !important;
}

/* ===================================
   SECTION HEADER — "Ajouter une adresse" button
   =================================== */
#addressesSection .section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

#addressesSection .section-header .btn,
#addAddressBtn {
    padding: 0.5rem 1rem !important;
    font-size: 0.85rem !important;
    border-radius: 8px !important;
    gap: 0.4rem !important;
    height: auto !important;
    min-height: 0 !important;
}

/* ===================================
   ADDRESS CARD — Action buttons
   =================================== */
.address-card .address-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

.address-card .address-actions .btn,
.address-card .address-actions button {
    padding: 0.4rem 0.75rem !important;
    font-size: 0.8rem !important;
    border-radius: 6px !important;
    gap: 0.3rem !important;
    height: auto !important;
    min-height: 0 !important;
}

/* ===================================
   MOBILE — Address forms & modals
   =================================== */
@media (max-width: 768px) {
    #addAddressForm,
    #editAddressForm {
        padding: 1rem;
    }

    #addAddressForm .form-row,
    #editAddressForm .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    #addAddressForm h3,
    #editAddressForm h3 {
        font-size: 1rem;
    }

    /* Stack buttons vertically on mobile */
    .address-form-actions {
        flex-direction: column !important;
        gap: 0.5rem !important;
    }

    #addAddressForm .btn,
    #editAddressForm .btn,
    #addAddressForm button[type="submit"],
    #editAddressForm button[type="submit"],
    #addAddressForm button[type="button"],
    #editAddressForm button[type="button"] {
        width: 100% !important;
        justify-content: center !important;
        padding: 0.6rem 1rem !important;
        font-size: 0.85rem !important;
    }

    /* Modal form on mobile */
    #addAddressModal .modal-content {
        padding: 1.25rem !important;
    }

    #addAddressModal .form-row {
        grid-template-columns: 1fr !important;
    }

    #addAddressModal .btn,
    #addAddressModal button[type="submit"] {
        width: 100% !important;
        justify-content: center !important;
    }

    #addAddressModal h3 {
        font-size: 1.05rem !important;
    }
}

@media (max-width: 480px) {
    #addAddressForm,
    #editAddressForm {
        padding: 0.75rem;
        border-radius: 8px;
    }

    #addAddressForm .form-group input,
    #editAddressForm .form-group input,
    #addAddressModal .form-group input,
    #addAddressModal .form-group select {
        padding: 0.55rem 0.65rem !important;
        font-size: 0.85rem !important;
    }

    .address-card .address-actions {
        gap: 0.4rem;
    }

    .address-card .address-actions .btn,
    .address-card .address-actions button {
        padding: 0.35rem 0.6rem !important;
        font-size: 0.75rem !important;
    }
}

/* Fix btn-secondary dans le dashboard (fond blanc) */
.dashboard-section .btn-secondary,
.address-card .btn-secondary,
.address-actions .btn-secondary {
    background: #f5f5f5 !important;
    color: #333 !important;
    border: 1.5px solid #ddd !important;
    backdrop-filter: none !important;
}

.dashboard-section .btn-secondary:hover,
.address-card .btn-secondary:hover {
    background: #e8e8e8 !important;
    color: #111 !important;
    transform: none !important;
}

