/**
 * Styles pour le système d'affiliation de KarlGoods.com
 */

/* Conteneur principal pour les fonctionnalités d'affiliation */
.affiliate-container {
    background-color: #f9f9f9;
    border-radius: 8px;
    padding: 25px;
    margin: 30px 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.affiliate-container h2 {
    margin-top: 0;
    color: #333;
    font-size: 24px;
    border-bottom: 2px solid #eee;
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.affiliate-container p {
    color: #666;
    line-height: 1.6;
    margin-bottom: 20px;
}

/* Générateur de liens d'affiliation */
.affiliate-link-generator {
    margin-bottom: 30px;
}

.affiliate-link-generator form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

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

.affiliate-link-generator label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #444;
}

.affiliate-link-generator select,
.affiliate-link-generator input[type="text"],
.affiliate-link-generator input[type="url"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.affiliate-link-generator select:focus,
.affiliate-link-generator input[type="text"]:focus,
.affiliate-link-generator input[type="url"]:focus {
    border-color: #4a90e2;
    outline: none;
}

.affiliate-link-generator button {
    grid-column: 1 / -1;
    background-color: #4a90e2;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 12px 20px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s;
}

.affiliate-link-generator button:hover {
    background-color: #3a7bc8;
}

.affiliate-link-result {
    margin-top: 20px;
}

.affiliate-link-result .success {
    background-color: #e8f5e9;
    border: 1px solid #c8e6c9;
    border-radius: 4px;
    padding: 15px;
}

.affiliate-link-result .error {
    background-color: #ffebee;
    border: 1px solid #ffcdd2;
    border-radius: 4px;
    padding: 15px;
    color: #d32f2f;
}

.affiliate-link-result .link-container {
    display: flex;
    margin-top: 10px;
}

.affiliate-link-result input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px 0 0 4px;
    font-size: 14px;
}

.affiliate-link-result .copy-btn {
    background-color: #4a90e2;
    color: white;
    border: none;
    border-radius: 0 4px 4px 0;
    padding: 10px 15px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.affiliate-link-result .copy-btn:hover {
    background-color: #3a7bc8;
}

/* Statistiques d'affiliation */
.affiliate-stats-container {
    margin-bottom: 30px;
}

.affiliate-stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.affiliate-stats-header h3 {
    margin: 0;
    color: #333;
}

.affiliate-stats-header select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.affiliate-stats-header .refresh-stats-btn {
    background-color: transparent;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.affiliate-stats-header .refresh-stats-btn:hover {
    background-color: #f5f5f5;
}

.stats-content .loading {
    text-align: center;
    padding: 20px;
    color: #666;
}

.stats-content .error {
    background-color: #ffebee;
    border: 1px solid #ffcdd2;
    border-radius: 4px;
    padding: 15px;
    color: #d32f2f;
}

.stats-content .notice {
    background-color: #e3f2fd;
    border: 1px solid #bbdefb;
    border-radius: 4px;
    padding: 15px;
    color: #1976d2;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.stat-card {
    background-color: white;
    border-radius: 6px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s, box-shadow 0.3s;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #333;
    margin-bottom: 8px;
}

.stat-card .stat-label {
    font-size: 14px;
    color: #666;
}

.stat-card.highlight {
    background-color: #4a90e2;
}

.stat-card.highlight .stat-value,
.stat-card.highlight .stat-label {
    color: white;
}

.stats-details {
    background-color: white;
    border-radius: 6px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.stats-details h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
    font-size: 18px;
}

.stats-table {
    width: 100%;
}

.stats-row {
    display: flex;
    border-bottom: 1px solid #eee;
}

.stats-row:last-child {
    border-bottom: none;
}

.stats-cell {
    padding: 12px 8px;
    flex: 1;
}

.stats-cell:first-child {
    color: #666;
}

.stats-cell:last-child {
    text-align: right;
    font-weight: 500;
    color: #333;
}

/* Widgets de marketplace */
.marketplace-widgets {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.marketplace-widget {
    background-color: white;
    border-radius: 6px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    text-align: center;
}

.marketplace-widget h4 {
    margin-top: 0;
    color: #333;
    font-size: 18px;
    margin-bottom: 15px;
}

/* Widget Amazon */
.amazon-widget {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Widget Google Merch */
.google-merch-widget {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.google-merch-widget .product-image {
    margin-bottom: 15px;
}

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

.google-merch-widget .product-price {
    margin-bottom: 15px;
    font-size: 16px;
    color: #333;
}

.google-merch-widget .buy-button {
    display: inline-block;
    background-color: #4285f4;
    color: white;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 4px;
    font-weight: 500;
    transition: background-color 0.3s;
}

.google-merch-widget .buy-button:hover {
    background-color: #3367d6;
}

/* Liens d'affiliation */
a.affiliate-link {
    position: relative;
    text-decoration: underline;
    color: #4a90e2;
}

a.affiliate-link:after {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%234a90e2"><path d="M19 19H5V5h7V3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-7h-2v7zM14 3v2h3.6l-9.8 9.8 1.4 1.4L19 6.4V10h2V3h-7z"/></svg>');
    background-size: contain;
    margin-left: 5px;
    opacity: 0.7;
}

/* Responsive */
@media (max-width: 768px) {
    .affiliate-link-generator form {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .marketplace-widgets {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .affiliate-stats-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .affiliate-stats-header select,
    .affiliate-stats-header .refresh-stats-btn {
        margin-top: 10px;
    }
}