/**
 * Estilos públicos del plugin
 * 
 * @package Piwity_Simple_Wishlist
 */

/* ===========================
   Botón de Lista de Deseos
   =========================== */

.psw-wishlist-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #fff;
    border: 2px solid #ddd;
    border-radius: 4px;
    color: #333;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: none;
    line-height: 1;
}

.psw-wishlist-button:hover {
    border-color: #e74c3c;
    color: #e74c3c;
    background: #fff;
}

.psw-wishlist-button:focus {
    outline: 2px solid #e74c3c;
    outline-offset: 2px;
}

.psw-wishlist-button.psw-in-wishlist {
    background: #e74c3c;
    border-color: #e74c3c;
    color: #fff;
}

.psw-wishlist-button.psw-in-wishlist:hover {
    background: #c0392b;
    border-color: #c0392b;
    color: #fff;
}

.psw-wishlist-button.psw-loading {
    opacity: 0.6;
    cursor: not-allowed;
}

.psw-wishlist-button .psw-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.psw-wishlist-button .psw-icon svg {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
}

.psw-wishlist-button:hover .psw-icon svg {
    transform: scale(1.1);
}

/* ===========================
   Contenedor de Lista de Deseos - Tabla
   =========================== */

.psw-wishlist-container {
    margin: 30px 0;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.psw-wishlist-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: #fff;
}

.psw-wishlist-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
}

.psw-wishlist-count {
    font-size: 14px;
    opacity: 0.95;
}

.psw-wishlist-count strong {
    font-size: 18px;
    font-weight: 700;
}

/* ===========================
   Acciones de la Lista (Top y Bottom)
   =========================== */

.psw-wishlist-actions-top,
.psw-wishlist-actions-bottom {
    padding: 20px 30px;
    text-align: center;
    background: #f8f9fa;
}

.psw-wishlist-actions-top {
    border-bottom: 1px solid #e0e0e0;
}

.psw-wishlist-actions-bottom {
    border-top: 1px solid #e0e0e0;
}

.psw-wishlist-actions-top .button,
.psw-wishlist-actions-bottom .button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
}

.psw-wishlist-actions-top .dashicons,
.psw-wishlist-actions-bottom .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
}

/* ===========================
   Tabla de Lista de Deseos
   =========================== */

.psw-wishlist-table-wrapper {
    overflow-x: auto;
    padding: 0;
}

.psw-wishlist-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.psw-wishlist-table thead {
    background: #f8f9fa;
}

.psw-wishlist-table th {
    padding: 15px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #e0e0e0;
}

.psw-wishlist-table td {
    padding: 20px 15px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

.psw-wishlist-row {
    transition: background-color 0.2s ease;
}

.psw-wishlist-row:hover {
    background-color: #f8f9fa;
}

/* Columnas específicas */
.psw-col-image {
    width: 100px;
    text-align: center;
}

.psw-col-image img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    display: block;
    margin: 0 auto;
}

.psw-no-image {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    background: #f0f0f0;
    border-radius: 6px;
    color: #ccc;
}

.psw-no-image .dashicons {
    font-size: 32px;
    width: 32px;
    height: 32px;
}

.psw-col-product {
    min-width: 200px;
}

.psw-product-title {
    color: #333;
    font-weight: 600;
    font-size: 15px;
    text-decoration: none;
    transition: color 0.3s ease;
    display: block;
    margin-bottom: 5px;
}

.psw-product-title:hover {
    color: #e74c3c;
}

.psw-product-sku {
    font-size: 12px;
    color: #999;
}

.psw-product-sku code {
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
}

.psw-col-price {
    width: 120px;
}

.psw-price-wrapper {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.psw-price-wrapper del {
    color: #999;
    font-size: 14px;
    margin-right: 5px;
}

.psw-price-wrapper ins {
    text-decoration: none;
    color: #e74c3c;
}

.psw-col-stock {
    width: 130px;
    text-align: center;
}

.psw-stock-badge {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
}

.psw-stock-available {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.psw-stock-unavailable {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.psw-stock-unknown {
    background: #e2e3e5;
    color: #6c757d;
    border: 1px solid #d6d8db;
}

.psw-col-actions {
    width: 200px;
    text-align: center;
}

.psw-action-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
}

.psw-action-buttons .button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    font-size: 14px;
    white-space: nowrap;
    transition: all 0.3s ease;
}

.psw-action-buttons .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.psw-single-add-to-cart {
    background: #e74c3c;
    border-color: #e74c3c;
    color: #fff;
}

.psw-single-add-to-cart:hover {
    background: #c0392b;
    border-color: #c0392b;
}

.psw-view-product {
    background: #3498db;
    border-color: #3498db;
    color: #fff;
    text-decoration: none;
}

.psw-view-product:hover {
    background: #2980b9;
    border-color: #2980b9;
    color: #fff;
}

.psw-remove-item {
    background: #fff;
    border-color: #ddd;
    color: #333;
}

.psw-remove-item:hover {
    background: #dc3545;
    border-color: #dc3545;
    color: #fff;
}

.psw-action-buttons .button.psw-loading {
    opacity: 0.6;
    pointer-events: none;
}

/* ===========================
   Mensajes y Notificaciones
   =========================== */

.psw-wishlist-notice,
.psw-wishlist-empty {
    padding: 40px 20px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    text-align: center;
    font-size: 16px;
    color: #6c757d;
    margin: 20px 0;
}

.psw-message {
    position: fixed;
    top: 50px;
    right: 20px;
    padding: 16px 24px;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    animation: pswSlideIn 0.3s ease;
    max-width: 400px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.psw-message.psw-success {
    border-left: 4px solid #28a745;
}

.psw-message.psw-error {
    border-left: 4px solid #dc3545;
}

.psw-message-text {
    flex: 1;
    font-size: 14px;
}

@keyframes pswSlideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes pswSlideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

.psw-message.psw-hiding {
    animation: pswSlideOut 0.3s ease;
}

/* ===========================
   Responsive Design
   =========================== */

@media screen and (max-width: 1024px) {
    .psw-col-stock {
        width: 100px;
    }
    
    .psw-product-sku {
        display: none;
    }
}

@media screen and (max-width: 768px) {
    .psw-wishlist-actions-top,
    .psw-wishlist-actions-bottom {
        padding: 15px;
    }
    
    .psw-wishlist-table-wrapper {
        padding: 0;
    }
    
    /* Convertir tabla a cards verticales en móvil */
    .psw-wishlist-table,
    .psw-wishlist-table thead,
    .psw-wishlist-table tbody,
    .psw-wishlist-table th,
    .psw-wishlist-table td,
    .psw-wishlist-table tr {
        display: block;
    }
    
    .psw-wishlist-table thead {
        display: none;
    }
    
    .psw-wishlist-row {
        margin-bottom: 20px;
        border: 1px solid #e0e0e0;
        border-radius: 8px;
        background: #fff;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
        overflow: hidden;
    }
    
    .psw-wishlist-row:hover {
        background-color: #fff;
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    }
    
    .psw-wishlist-table td {
        padding: 15px;
        border-bottom: none;
        position: relative;
        text-align: left !important;
    }
    
    .psw-wishlist-table td::before {
        content: attr(data-label);
        font-weight: 600;
        display: block;
        margin-bottom: 8px;
        color: #666;
        font-size: 12px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    
    .psw-col-image {
        text-align: center !important;
        padding: 20px 15px 15px !important;
        border-bottom: 1px solid #f0f0f0;
    }
    
    .psw-col-image::before {
        display: none;
    }
    
    .psw-col-image img {
        width: 100px;
        height: 100px;
        margin: 0 auto;
    }
    
    .psw-col-product::before {
        content: "Producto";
    }
    
    .psw-col-price::before {
        content: "Precio";
    }
    
    .psw-col-stock {
        border-bottom: 1px solid #f0f0f0;
    }
    
    .psw-col-stock::before {
        content: "Disponibilidad";
    }
    
    .psw-col-actions {
        padding: 15px !important;
        background: #f8f9fa;
    }
    
    .psw-col-actions::before {
        display: none;
    }
    
    .psw-action-buttons {
        flex-direction: row;
        justify-content: stretch;
        gap: 10px;
    }
    
    .psw-action-buttons .button {
        flex: 1;
        justify-content: center;
    }
    
    .psw-action-buttons .button .psw-button-text {
        display: inline;
    }
    
    .psw-product-title {
        font-size: 16px;
    }
    
    .psw-message {
        left: 10px;
        right: 10px;
        max-width: none;
    }
}

@media screen and (max-width: 576px) {
    .psw-col-image img {
        width: 80px;
        height: 80px;
    }
    
    .psw-action-buttons .button .psw-button-text {
        font-size: 13px;
    }
    
    .psw-product-title {
        font-size: 15px;
    }
}

/* ===========================
   Integración con WooCommerce
   =========================== */

.single-product .psw-wishlist-button,
.woocommerce ul.products li.product .psw-wishlist-button {
    margin-top: 10px;
}

/* Compatibilidad con botones de WooCommerce */
.woocommerce .psw-wishlist-button {
    width: 100%;
    justify-content: center;
}

/* ===========================
   Grid antiguo (compatibilidad)
   =========================== */

.psw-wishlist-grid {
    display: grid;
    gap: 30px;
    margin: 20px 0;
}

.psw-wishlist-grid.psw-columns-2 {
    grid-template-columns: repeat(2, 1fr);
}

.psw-wishlist-grid.psw-columns-3 {
    grid-template-columns: repeat(3, 1fr);
}

.psw-wishlist-grid.psw-columns-4 {
    grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 992px) {
    .psw-wishlist-grid.psw-columns-4,
    .psw-wishlist-grid.psw-columns-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .psw-wishlist-grid {
        grid-template-columns: 1fr;
    }
}

.psw-wishlist-item {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.psw-wishlist-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-4px);
}

