/**
 * Public-facing CSS for WP Affiliate Manager
 */

/* Tableau des commandes avec colonnes optimisées */
.orders-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.orders-table th, 
.orders-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
    vertical-align: top;
}

.orders-table th {
    background-color: #f9f9f9;
    font-weight: 600;
    color: #333;
}

/* Largeurs de colonnes spécifiques */
.orders-table th:nth-child(1), /* # */
.orders-table td:nth-child(1) {
    width: 5%;
}

.orders-table th:nth-child(2), /* Date */
.orders-table td:nth-child(2) {
    width: 10%;
}

.orders-table th:nth-child(3), /* Client */
.orders-table td:nth-child(3) {
    width: 15%;
}

.orders-table th:nth-child(4), /* Produits */
.orders-table td:nth-child(4) {
    width: 30%; /* Colonne produits plus large */
}

.orders-table th:nth-child(5), /* Total */
.orders-table td:nth-child(5),
.orders-table th:nth-child(6), /* Marge */
.orders-table td:nth-child(6),
.orders-table th:nth-child(7), /* Marge sans transport */
.orders-table td:nth-child(7) {
    width: 10%;
}

.orders-table th:nth-child(8), /* Statut */
.orders-table td:nth-child(8) {
    width: 10%;
}

/* Affiliate Dashboard */
.affiliate-dashboard {
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.affiliate-dashboard-nav {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.affiliate-dashboard-nav a {
    padding: 10px 15px;
    text-decoration: none;
    color: #555;
    font-weight: 500;
}

.affiliate-dashboard-nav a.active {
    color: #2271b1;
    border-bottom: 2px solid #2271b1;
}

.affiliate-dashboard-content {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 20px;
}

/* Date Filter */
.date-filter-container {
    margin-bottom: 30px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 6px;
    border: 1px solid #eee;
}

.date-filter-container h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 16px;
    color: #333;
}

.date-filter-form {
    margin-bottom: 10px;
}

.date-inputs {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
}

.date-field {
    flex: 1;
    min-width: 180px;
}

.date-field label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

.date-picker {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
}

.filter-button {
    padding: 8px 15px;
    background: #2271b1;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.filter-button:hover {
    background: #135e96;
}

.date-range-info {
    margin-top: 10px;
    font-size: 14px;
    color: #666;
    font-style: italic;
}

/* Order Status Summary */
.order-status-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 30px;
}

.status-card {
    flex: 1;
    min-width: 200px;
    padding: 15px;
    background: white;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.status-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.status-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

.status-count {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.status-progress {
    height: 8px;
    background: #eee;
    border-radius: 4px;
    margin-bottom: 5px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: 4px;
}

.status-percentage {
    text-align: right;
    font-size: 12px;
    color: #666;
}

/* Stats Cards */
.affiliate-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    flex: 1;
    min-width: 200px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 4px;
    border-left: 4px solid #2271b1;
}

.stat-card h3 {
    margin-top: 0;
    color: #555;
    font-size: 16px;
}

.stat-card .value {
    font-size: 24px;
    font-weight: bold;
    color: #2271b1;
}

.stat-card .stat-desc {
    font-size: 0.8rem;
    color: #777;
    margin-top: 5px;
    text-align: center;
}

/* Order Creation Form - New Design */
.product-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    padding: 20px;
    margin-bottom: 30px;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.product-left-column {
    display: flex;
    flex-direction: column;
}

.product-right-column {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.product-image-container {
    margin-bottom: 15px;
    text-align: center;
}

.product-image-container img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

.product-info {
    margin-bottom: 20px;
}

.product-info h3 {
    margin-top: 0;
    font-size: 18px;
    color: #333;
    margin-bottom: 10px;
}

.product-description {
    color: #666;
    line-height: 1.5;
    margin-bottom: 15px;
}

.product-colors {
    margin-bottom: 15px;
}

.color-title {
    font-weight: 500;
    margin-bottom: 8px;
    color: #333;
}

.color-options {
    display: flex;
    gap: 10px;
}

.color-option {
    width: 45px !important;
    height: 45px !important;
    border-radius: 50% !important;
    margin-right: 12px !important;
    margin-bottom: 10px !important;
    cursor: pointer !important;
    box-shadow: 0 3px 6px rgba(0,0,0,0.16) !important;
    border: 3px solid #e5e5e5 !important;
    display: inline-block !important;
    position: relative !important;
    transition: all 0.3s ease !important;
    background-image: none !important;
    /* Forcer la suppression du fond gris */
    background-color: attr(data-color) !important;
}

.color-option.selected {
    border-color: #2271b1;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transform: scale(1.3);
}

/* Couleurs spéciales - meilleur affichage */
.color-option[title="Blanc"] {
    border: 2px solid #ddd;
    background-color: #FFFFFF !important;
    box-shadow: 0 3px 6px rgba(0,0,0,0.1);
}

/* Product size options */
.product-sizes {
    margin: 15px 0;
}

.size-title {
    font-weight: 500;
    margin-bottom: 8px;
    color: #333;
}

.size-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.size-option {
    width: 60px !important;
    height: 50px !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    transition: all 0.25s ease !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin-right: 8px !important;
    margin-bottom: 8px !important;
    border: 2px solid #ddd !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    background-color: #f9f9f9 !important;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1) !important;
}

.size-option:hover {
    background-color: #f0f0f0;
    border-color: #999;
    transform: translateY(-2px);
}

.size-option.selected {
    border: 3px solid #2271b1;
    background-color: #e6f3fb;
    box-shadow: 0 3px 8px rgba(0,0,0,0.2);
    transform: scale(1.15);
}

.price-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.base-price-label {
    display: flex;
    align-items: center;
    font-weight: 500;
    color: #555;
}

.base-price-label .price-icon {
    color: #2ecc71;
    margin-right: 5px;
    font-size: 20px;
}

.selling-price-label {
    display: flex;
    align-items: center;
    font-weight: 500;
    color: #555;
}

.selling-price-label .price-icon {
    color: #3498db;
    margin-right: 5px;
    font-size: 20px;
}

.base-price-display, .selling-price-display {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 15px;
}

.form-group {
    flex: 1;
    min-width: 200px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

select.form-control {
    height: 42px;
}

.actions-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
}

.btn-primary {
    background-color: #2271b1;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
}

.btn-primary:hover {
    background-color: #135e96;
}

.btn-danger {
    background-color: #e74c3c;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
}

.btn-danger:hover {
    background-color: #c0392b;
}

.price-display {
    display: flex;
    align-items: center;
    gap: 10px;
}

.margin-badge {
    background-color: #2ecc71;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-weight: 500;
    font-size: 14px;
}

/* Product selection dropdown with image */
.product-select-container {
    position: relative;
    margin-bottom: 20px;
}

.product-select-container select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"></polyline></svg>');
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
    padding-right: 30px;
}

/* Customer form section */
.customer-form {
    background: #ffffff;
    border-radius: 8px;
    padding: 20px;
    margin-top: 30px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.section-title {
    margin: 30px 0 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
    font-size: 18px;
}

.customer-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-group input, 
.form-group select, 
.form-group textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Totals */
.order-totals {
    margin-top: 30px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 4px;
}

.totals-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.totals-row.total {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #ddd;
    font-weight: bold;
}

.totals-row.margin {
    color: #2271b1;
    font-weight: bold;
}

/* Post-order actions */
.post-order-actions {
    margin-top: 30px;
    display: flex;
    gap: 20px;
    justify-content: center;
}

.post-order-actions .button {
    padding: 12px 20px;
    background-color: #2271b1;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 500;
    display: inline-block;
    text-align: center;
    min-width: 200px;
    transition: all 0.3s ease;
}

.post-order-actions .button:hover {
    background-color: #135e96;
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.post-order-actions .return-dashboard {
    background-color: #4CAF50;
}

.post-order-actions .return-dashboard:hover {
    background-color: #388E3C;
}

/* Orders List */
.affiliate-orders {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.affiliate-orders th,
.affiliate-orders td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.affiliate-orders th {
    background-color: #f9f9f9;
    font-weight: 600;
    color: #000;
}

.affiliate-orders tr:hover {
    background-color: #f5f5f5;
}

.affiliate-orders .order-number {
    font-weight: 600;
}

.affiliate-orders .order-status {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 12px;
    text-transform: uppercase;
}

.affiliate-orders .status-completed {
    background-color: #c6e1c6;
    color: #5b841b;
}

.affiliate-orders .status-processing {
    background-color: #c8d7e1;
    color: #2e4453;
}

.affiliate-orders .status-on-hold {
    background-color: #f8dda7;
    color: #94660c;
}

.affiliate-orders .status-failed {
    background-color: #eba3a3;
    color: #761919;
}

.affiliate-orders .status-cancelled {
    background-color: #e5e5e5;
    color: #777;
}

.order-items {
    max-width: 400px;
    min-width: 350px;
}

.order-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 15px;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 6px;
    border-left: 3px solid #2271b1;
}

.order-item img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    margin-right: 12px;
    border-radius: 4px;
}

.order-item .item-details {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.order-item .item-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 3px;
    color: #333;
}

.order-item .item-detail-text {
    font-size: 13px;
    color: #555;
    margin-bottom: 5px;
}

.order-item .item-attributes {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 12px;
}

.order-item .item-attr {
    background: #eee;
    padding: 2px 6px;
    border-radius: 3px;
    color: #666;
}

.order-item .item-qty {
    margin-left: 10px;
    color: #666;
    font-size: 13px;
}

/* Responsive fixes */
@media (max-width: 768px) {
    .affiliate-dashboard-nav {
        flex-wrap: wrap;
    }
    
    .product-row {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .product-select-container,
    .price-container,
    .quantity-container,
    .margin-container {
        width: 100%;
        margin-bottom: 10px;
    }
    
    .totals-row {
        flex-direction: column;
    }
    
    .totals-row div:last-child {
        margin-top: 5px;
        font-weight: bold;
    }
}
/* RTL Support */
.rtl {
    direction: rtl;
    text-align: right;
}

.rtl .affiliate-dashboard-nav {
    flex-direction: row-reverse;
}

.rtl .product-row {
    flex-direction: row-reverse;
}

.rtl .order-item {
    flex-direction: row-reverse;
}

.rtl .item-qty {
    margin-right: 10px;
    margin-left: 0;
}

/* Styles pour le message de confirmation de commande créée */
.order-created-message {
    margin: 15px 0 25px;
    padding: 15px;
    border-radius: 4px;
    text-align: center;
}

.order-created-message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* Boutons après création de commande */
.create-new-order {
    background-color: #007bff !important;
    color: white !important;
    font-weight: bold !important;
}

.return-dashboard {
    background-color: #4CAF50 !important;
    color: white !important;
}

/* Style pour l'indicateur de chargement des attributs */
.attributes-loading {
    margin: 10px 0;
    padding: 8px 12px;
    background-color: #f8f9fa;
    border-radius: 4px;
    color: #666;
    font-style: italic;
    text-align: center;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}
.product-image {
    margin-bottom: 10px;
}

.product-image img {
    max-width: 100px;
    height: auto;
}

.product-select-container {
    margin-bottom: 15px;
}
