/**
 * Account Refonte Styles
 * Dashboard, Orders Table, Favorites Grid
 */

/* ==========================================
   DASHBOARD - Statistics Cards
   ========================================== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin-top: 24px;
    max-width: 800px;
}

/* Mobile: Scroll horizontal pour les cartes */
@media (max-width: 768px) {
    .stats-grid {
        display: flex;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        gap: 16px;
        padding-bottom: 16px;
        margin-left: -24px;
        margin-right: -24px;
        padding-left: 24px;
        padding-right: 24px;
        max-width: none;
    }
    
    .stats-grid::-webkit-scrollbar {
        height: 6px;
    }
    
    .stats-grid::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 10px;
    }
    
    .stats-grid::-webkit-scrollbar-thumb {
        background: var(--primary);
        border-radius: 10px;
    }
    
    .stats-grid::-webkit-scrollbar-thumb:hover {
        background: var(--primary-dark);
    }
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

/* Mobile: Cartes en scroll horizontal */
@media (max-width: 768px) {
    .stat-card {
        min-width: 280px;
        flex-shrink: 0;
        scroll-snap-align: start;
    }
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-info {
    flex: 1;
}

.stat-label {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

/* ==========================================
   ORDERS TABLE
   ========================================== */

.orders-table-container {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.orders-table {
    width: 100%;
    border-collapse: collapse;
}

.orders-table thead {
    background: #f9fafb;
}

.orders-table th {
    padding: 16px;
    text-align: left;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 2px solid #e5e7eb;
}

.orders-table td {
    padding: 16px;
    border-bottom: 1px solid #f3f4f6;
    font-size: 14px;
    color: var(--text-primary);
}

.orders-table tbody tr:hover {
    background: #f9fafb;
}

.order-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-pending {
    background: #fef3c7;
    color: #92400e;
}

.status-processing {
    background: #dbeafe;
    color: #1e40af;
}

.status-shipped {
    background: #e0e7ff;
    color: #3730a3;
}

.status-delivered {
    background: #d1fae5;
    color: #065f46;
}

.status-cancelled {
    background: #fee2e2;
    color: #991b1b;
}

.btn-view-order {
    padding: 8px 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-view-order:hover {
    background: var(--primary-dark);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 24px;
    border-top: 1px solid #e5e7eb;
}

.pagination-btn {
    padding: 8px 16px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.pagination-btn:hover:not(:disabled) {
    background: #f9fafb;
    border-color: var(--primary);
    color: var(--primary);
}

.pagination-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ==========================================
   FAVORITES GRID
   ========================================== */

.favorites-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-top: 24px;
}

.favorite-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.favorite-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.favorite-image {
    position: relative;
    width: 100%;
    padding-top: 100%;
    overflow: hidden;
    background: #f9fafb;
}

.favorite-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.favorite-image .product-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: #ef4444;
    color: white;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.btn-remove-favorite {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    background: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.2s;
}

.btn-remove-favorite:hover {
    background: #fee2e2;
    color: #dc2626;
    transform: scale(1.1);
}

.favorite-info {
    padding: 16px;
}

.favorite-info .product-cat {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.favorite-info .product-name {
    margin: 8px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.favorite-info .product-name a {
    color: inherit;
    text-decoration: none;
}

.favorite-info .product-name a:hover {
    color: var(--primary);
}

.product-price-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 12px 0;
}

.price-old {
    font-size: 14px;
    color: var(--text-muted);
    text-decoration: line-through;
}

.product-price {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
}

.btn-add-to-cart {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s;
}

.btn-add-to-cart:hover {
    background: var(--primary-dark);
}

/* ==========================================
   RESPONSIVE
   ========================================== */

@media (max-width: 1200px) {
    .favorites-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    /* Container padding mobile */
    .account-page .container {
        padding: 32px 16px !important;
    }
    
    /* Header mobile */
    .account-header {
        margin-bottom: 24px;
    }
    
    .account-header h1 {
        font-size: 24px;
    }
    
    .account-header p {
        font-size: 14px;
    }
    
    /* Layout mobile: sidebar en bas */
    .account-layout {
        display: flex;
        flex-direction: column-reverse;
        gap: 24px;
    }
    
    /* Sidebar mobile: navigation horizontale */
    .account-sidebar {
        position: sticky;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        border-top: 1px solid #e5e7eb;
        box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
        z-index: 100;
        margin: 0 -16px;
        padding: 0;
    }
    
    .account-nav {
        display: flex;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
        gap: 0;
        padding: 0;
    }
    
    .account-nav::-webkit-scrollbar {
        display: none;
    }
    
    .account-nav-item {
        flex: 0 0 auto;
        min-width: 80px;
        padding: 12px 8px;
        flex-direction: column;
        gap: 4px;
        font-size: 11px;
        border-radius: 0;
        border-right: 1px solid #f3f4f6;
        scroll-snap-align: start;
    }
    
    .account-nav-item:last-child {
        border-right: none;
    }
    
    .account-nav-item svg {
        width: 20px;
        height: 20px;
    }
    
    .account-nav-item span {
        text-align: center;
        white-space: nowrap;
    }
    
    .account-nav-item.active {
        background: var(--primary);
        color: white;
    }
    
    /* Content mobile */
    .account-content {
        width: 100%;
        padding: 0;
    }
    
    .tab-title {
        font-size: 20px;
        margin-bottom: 20px;
    }
    
    /* Stats grid déjà géré ci-dessus */

    /* Orders table mobile */
    .orders-table-container {
        overflow-x: auto;
        margin: 0 -16px;
        border-radius: 0;
    }

    .orders-table {
        min-width: 600px;
    }
    
    .orders-table th,
    .orders-table td {
        padding: 12px 8px;
        font-size: 13px;
    }
    
    .btn-view-order {
        padding: 6px 12px;
        font-size: 12px;
    }

    /* Favorites grid mobile */
    .favorites-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        margin: 0 -16px;
        padding: 0 16px;
    }
    
    .favorite-info {
        padding: 12px;
    }
    
    .favorite-info .product-name {
        font-size: 14px;
    }
    
    .product-price {
        font-size: 16px;
    }
    
    .btn-add-to-cart {
        padding: 10px;
        font-size: 13px;
    }
    
    /* Form mobile */
    .account-form .form-row {
        flex-direction: column;
        gap: 16px;
    }
    
    .account-form .form-group {
        width: 100%;
    }
    
    /* Modal mobile */
    .order-modal-content {
        width: 100%;
        max-width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        margin: 0;
    }
    
    .order-modal-header {
        padding: 16px;
    }
    
    .order-modal-header h2 {
        font-size: 18px;
    }
    
    .order-tabs-header {
        padding: 0 16px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .order-tabs-header::-webkit-scrollbar {
        display: none;
    }
    
    .order-tab-btn {
        padding: 10px 16px;
        font-size: 13px;
        white-space: nowrap;
    }
    
    .order-tab-btn svg {
        width: 16px;
        height: 16px;
    }
    
    .order-tabs-content {
        padding: 16px;
    }
    
    .order-info-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .order-info-card {
        padding: 16px;
    }
    
    .order-info-title {
        font-size: 14px;
    }
    
    /* Review modal mobile */
    .review-modal-content {
        width: 100%;
        max-width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        margin: 0;
    }
    
    .review-modal-header {
        padding: 16px;
    }
    
    .review-modal-header h3 {
        font-size: 18px;
    }
    
    .review-modal-body {
        padding: 16px;
    }
    
    .review-product-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .review-product-img {
        width: 100%;
        max-width: 200px;
    }
    
    .star-rating {
        justify-content: center;
    }
    
    .review-form-actions {
        flex-direction: column;
        gap: 12px;
    }
    
    .review-form-actions button {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .account-page .container {
        padding: 24px 12px !important;
    }
    
    .account-header h1 {
        font-size: 20px;
    }
    
    .stat-card {
        min-width: 260px;
        padding: 16px;
    }
    
    .stat-icon {
        width: 48px;
        height: 48px;
    }
    
    .stat-value {
        font-size: 24px;
    }
    
    .favorites-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .account-nav-item {
        min-width: 70px;
        padding: 10px 6px;
        font-size: 10px;
    }
    
    .account-nav-item svg {
        width: 18px;
        height: 18px;
    }
}
