/**
 * NEA Tango Sync - Frontend Styles
 *
 * @package NEA_Tango_Sync
 * @since 1.0.0
 */

/* ==========================================================================
   General Frontend Styles
   ========================================================================== */

.nea-tango-sync-info {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 15px;
    margin: 15px 0;
    font-size: 14px;
    line-height: 1.5;
}

.nea-tango-sync-info h3 {
    margin: 0 0 10px 0;
    font-size: 16px;
    color: #495057;
    font-weight: 600;
}

.nea-tango-sync-info p {
    margin: 0 0 8px 0;
    color: #6c757d;
}

.nea-tango-sync-info p:last-child {
    margin-bottom: 0;
}

/* ==========================================================================
   Sync Status Display
   ========================================================================== */

.sync-status-display {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 10px 0;
}

.sync-status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.sync-status-indicator.synced {
    background: #28a745;
    animation: pulse-green 2s infinite;
}

.sync-status-indicator.pending {
    background: #ffc107;
    animation: pulse-yellow 2s infinite;
}

.sync-status-indicator.error {
    background: #dc3545;
    animation: pulse-red 2s infinite;
}

.sync-status-indicator.not-synced {
    background: #6c757d;
}

@keyframes pulse-green {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

@keyframes pulse-yellow {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

@keyframes pulse-red {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.sync-status-text {
    font-size: 13px;
    font-weight: 500;
    color: #495057;
}

.sync-status-text.synced {
    color: #28a745;
}

.sync-status-text.pending {
    color: #ffc107;
}

.sync-status-text.error {
    color: #dc3545;
}

.sync-status-text.not-synced {
    color: #6c757d;
}

/* ==========================================================================
   Product Info Display
   ========================================================================== */

.product-sync-info {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 12px;
    margin: 10px 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.product-sync-info .info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    border-bottom: 1px solid #f8f9fa;
}

.product-sync-info .info-row:last-child {
    border-bottom: none;
}

.product-sync-info .info-label {
    font-weight: 600;
    color: #495057;
    font-size: 13px;
}

.product-sync-info .info-value {
    color: #6c757d;
    font-size: 13px;
    text-align: right;
}

.product-sync-info .info-value.synced {
    color: #28a745;
}

.product-sync-info .info-value.pending {
    color: #ffc107;
}

.product-sync-info .info-value.error {
    color: #dc3545;
}

.product-sync-info .info-value.not-synced {
    color: #6c757d;
}

.nea-price-missing {
    display: inline-block;
    color: #a42828;
    font-weight: 600;
}

/* Ocultar mensaje "Sin precio para tu lista" en el buscador AJAX */
.dgwt-wcas-suggestion-wrapper .nea-price-missing,
.dgwt-wcas-suggestion .nea-price-missing,
.dgwt-wcas-sp .nea-price-missing,
.dgwt-wcas-meta .nea-price-missing {
    display: none !important;
}

.nea-price-iva {
    display: inline;
    font-size: 0.9em;
    color: #666;
    margin-left: 6px;
    line-height: 1.2;
    vertical-align: middle;
}

.nea-price-wrapper {
    display: inline-block;
}

.nea-price-general-list {
    display: inline-block;
    font-size: 0.85em;
    color: #888;
    margin-left: 8px;
    text-decoration: line-through;
    vertical-align: baseline;
    font-weight: normal;
}

.nea-price-original {
    display: inline-block;
    font-size: 0.85em;
    color: #888;
    margin-right: 8px;
    text-decoration: line-through;
    vertical-align: baseline;
    font-weight: normal;
}

/* ==========================================================================
   Shortcode Styles
   ========================================================================== */

.nea-tango-sync-shortcode {
    margin: 20px 0;
}

.nea-tango-sync-shortcode .shortcode-title {
    font-size: 18px;
    font-weight: 600;
    color: #212529;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid #007bff;
}

.nea-tango-sync-shortcode .shortcode-content {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 20px;
}

/* ==========================================================================
   WooCommerce Integration
   ========================================================================== */

/* Product Loop */
.woocommerce ul.products li.product .nea-tango-sync-info {
    margin: 10px 0;
    font-size: 12px;
}

.woocommerce ul.products li.product .sync-status-display {
    margin: 8px 0;
}

.woocommerce ul.products li.product .sync-status-indicator {
    width: 8px;
    height: 8px;
}

.woocommerce ul.products li.product .sync-status-text {
    font-size: 11px;
}

/* Single Product */
.woocommerce div.product .nea-tango-sync-info {
    margin: 20px 0;
    padding: 20px;
}

.woocommerce div.product .sync-status-display {
    margin: 15px 0;
}

.woocommerce div.product .product-sync-info {
    margin: 15px 0;
}

/* Product Meta */
.woocommerce div.product .product_meta .nea-tango-sync-meta {
    padding: 10px 0;
    border-top: 1px solid #eee;
    margin-top: 10px;
}

.woocommerce div.product .product_meta .nea-tango-sync-meta .meta-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
}

.woocommerce div.product .product_meta .nea-tango-sync-meta .meta-label {
    font-weight: 600;
    color: #666;
}

.woocommerce div.product .product_meta .nea-tango-sync-meta .meta-value {
    color: #333;
}

/* ==========================================================================
   Price Display
   ========================================================================== */

.nea-tango-sync-price {
    position: relative;
}

.nea-tango-sync-price .original-price {
    text-decoration: line-through;
    color: #6c757d;
    font-size: 0.9em;
    margin-right: 8px;
}

.nea-tango-sync-price .sync-price {
    color: #dc3545;
    font-weight: 600;
}

.nea-tango-sync-price .price-note {
    font-size: 0.8em;
    color: #6c757d;
    font-style: italic;
    margin-top: 5px;
}

/* ==========================================================================
   Stock Display
   ========================================================================== */

.nea-tango-sync-stock {
    margin: 10px 0;
}

.nea-tango-sync-stock .stock-status {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.nea-tango-sync-stock .stock-status.in-stock {
    background: #d4edda;
    color: #155724;
}

.nea-tango-sync-stock .stock-status.low-stock {
    background: #fff3cd;
    color: #856404;
}

.nea-tango-sync-stock .stock-status.out-of-stock {
    background: #f8d7da;
    color: #721c24;
}

.nea-tango-sync-stock .stock-quantity {
    font-size: 13px;
    color: #6c757d;
    margin-left: 10px;
}

/* ==========================================================================
   Notification Styles
   ========================================================================== */

.nea-tango-sync-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 15px 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 9999;
    max-width: 300px;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.nea-tango-sync-notification.show {
    transform: translateX(0);
}

.nea-tango-sync-notification.success {
    border-left: 4px solid #28a745;
}

.nea-tango-sync-notification.warning {
    border-left: 4px solid #ffc107;
}

.nea-tango-sync-notification.error {
    border-left: 4px solid #dc3545;
}

.nea-tango-sync-notification.info {
    border-left: 4px solid #17a2b8;
}

.nea-tango-sync-notification .notification-title {
    font-weight: 600;
    margin-bottom: 5px;
    color: #212529;
}

.nea-tango-sync-notification .notification-message {
    color: #6c757d;
    font-size: 14px;
    line-height: 1.4;
}

.nea-tango-sync-notification .notification-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 18px;
    color: #6c757d;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nea-tango-sync-notification .notification-close:hover {
    color: #212529;
}

/* ==========================================================================
   Loading States
   ========================================================================== */

.nea-tango-sync-loading {
    position: relative;
    opacity: 0.6;
    pointer-events: none;
}

.nea-tango-sync-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
    .nea-tango-sync-info {
        padding: 12px;
        margin: 12px 0;
        font-size: 13px;
    }
    
    .product-sync-info {
        padding: 10px;
        margin: 8px 0;
    }
    
    .product-sync-info .info-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .product-sync-info .info-value {
        text-align: left;
    }
    
    .nea-tango-sync-notification {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
        transform: translateY(-100%);
    }
    
    .nea-tango-sync-notification.show {
        transform: translateY(0);
    }
}

@media (max-width: 480px) {
    .nea-tango-sync-info {
        padding: 10px;
        margin: 10px 0;
        font-size: 12px;
    }
    
    .nea-tango-sync-info h3 {
        font-size: 14px;
    }
    
    .product-sync-info {
        padding: 8px;
        margin: 6px 0;
    }
    
    .sync-status-display {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .nea-tango-sync-shortcode .shortcode-content {
        padding: 15px;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .nea-tango-sync-notification,
    .nea-tango-sync-loading::after {
        display: none !important;
    }
    
    .nea-tango-sync-info,
    .product-sync-info {
        border: 1px solid #ccc;
        background: #fff;
        box-shadow: none;
    }
    
    .sync-status-indicator {
        border: 1px solid #000;
        background: #fff !important;
    }
}

/* ==========================================================================
   High Contrast Mode
   ========================================================================== */

@media (prefers-contrast: high) {
    .nea-tango-sync-info {
        border: 2px solid #000;
        background: #fff;
    }
    
    .product-sync-info {
        border: 2px solid #000;
        background: #fff;
    }
    
    .sync-status-indicator {
        border: 2px solid #000;
    }
    
    .nea-tango-sync-notification {
        border: 2px solid #000;
        background: #fff;
    }
}

/* ==========================================================================
   Reduced Motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .sync-status-indicator.synced,
    .sync-status-indicator.pending,
    .sync-status-indicator.error {
        animation: none;
    }
    
    .nea-tango-sync-notification {
        transition: none;
    }
    
    .nea-tango-sync-loading::after {
        animation: none;
    }
}

/* ==========================================================================
   Dark Mode Support
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    .nea-tango-sync-info {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .nea-tango-sync-info h3 {
        color: #f7fafc;
    }
    
    .nea-tango-sync-info p {
        color: #cbd5e0;
    }
    
    .product-sync-info {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .product-sync-info .info-label {
        color: #f7fafc;
    }
    
    .product-sync-info .info-value {
        color: #cbd5e0;
    }
    
    .nea-tango-sync-shortcode .shortcode-content {
        background: #2d3748;
        color: #e2e8f0;
    }
    
    .nea-tango-sync-shortcode .shortcode-title {
        color: #f7fafc;
        border-bottom-color: #63b3ed;
    }
    
    .nea-tango-sync-notification {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .nea-tango-sync-notification .notification-title {
        color: #f7fafc;
    }
    
    .nea-tango-sync-notification .notification-message {
        color: #cbd5e0;
    }
}
