/*
 * Styles for the WooCommerce Product Editor module.
 *
 * @link       N/A
 * @since      1.0.0
 *
 * @package    CVC_Inventory
 * @subpackage CVC_Inventory/modules/wc-product-editor/assets/css
 */

/* Basic styles for the product editor interface */
#cvc-product-editor-modal {
    display: none; /* Hidden by default */
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto; /* Enable scroll if needed */
    background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

#cvc-product-editor-modal .modal-content {
    background-color: #fefefe;
    margin: 5% auto; /* 5% from the top and centered */
    padding: 20px;
    border: 1px solid #888;
    width: 90%; /* Could be more or less, depending on screen size */
    max-width: 800px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 80vh;
}

.modal-close-button {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    position: absolute;
    right: 20px;
    top: 10px;
}

.modal-close-button:hover,
.modal-close-button:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

/* Product List Styles */
/* Product Table Styles */
.cvc-product-table-container {
    overflow-x: auto; /* Enable horizontal scroll on small screens */
    margin-top: 20px;
}

.cvc-product-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-radius: 8px;
    overflow: hidden; /* Ensures rounded corners apply to table content */
}

.cvc-product-table th,
.cvc-product-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.cvc-product-table th {
    background-color: #f8f8f8;
    font-weight: bold;
    color: #333;
    text-transform: uppercase;
    font-size: 0.85em;
}

.cvc-product-table tbody tr:hover {
    background-color: #f5f5f5;
}

.cvc-product-table img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
}

.cvc-product-table td button {
    margin-right: 5px;
    /* Basic button styling, can be enhanced with Tailwind classes */
    background-color: #0073aa;
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85em;
}

.cvc-product-table td button:hover {
    background-color: #005177;
}

/* Responsive adjustments for table */
@media (max-width: 768px) {
    .cvc-product-table thead {
        display: none; /* Hide table headers on small screens */
    }

    .cvc-product-table, .cvc-product-table tbody, .cvc-product-table tr, .cvc-product-table td {
        display: block;
        width: 100%;
    }

    .cvc-product-table tr {
        margin-bottom: 15px;
        border: 1px solid #eee;
        border-radius: 8px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }

    .cvc-product-table td {
        text-align: right;
        padding-left: 50%;
        position: relative;
    }

    .cvc-product-table td::before {
        content: attr(data-label);
        position: absolute;
        left: 15px;
        width: calc(50% - 30px);
        padding-right: 10px;
        white-space: nowrap;
        text-align: left;
        font-weight: bold;
        color: #555;
    }

    .cvc-product-table td:nth-of-type(1)::before { content: "Imagen"; }
    .cvc-product-table td:nth-of-type(2)::before { content: "Nombre"; }
    .cvc-product-table td:nth-of-type(3)::before { content: "SKU"; }
    .cvc-product-table td:nth-of-type(4)::before { content: "Precio"; }
    .cvc-product-table td:nth-of-type(5)::before { content: "Stock"; }
    .cvc-product-table td:nth-of-type(6)::before { content: "Estado"; }
    .cvc-product-table td:nth-of-type(7)::before { content: "Acciones"; }

    .cvc-product-table td:last-child {
        text-align: center;
    }
}

/* Form styles within the editor modal */
.cvc-product-editor-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #333;
}

.cvc-product-editor-form input[type="text"],
.cvc-product-editor-form input[type="number"],
.cvc-product-editor-form textarea,
.cvc-product-editor-form select {
    width: 100%;
    padding: 8px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box; /* Include padding and border in the element's total width and height */
}

.cvc-product-editor-form button[type="submit"] {
    background-color: #2271b1;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
}

.cvc-product-editor-form button[type="submit"]:hover {
    background-color: #1a5b8a;
}

/* Loading spinner */
.cvc-loader {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Messages */
.cvc-message {
    padding: 10px;
    margin-bottom: 15px;
    border-radius: 4px;
    font-weight: bold;
}

.cvc-message.success {
    background-color: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}

.cvc-message.error {
    background-color: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #cvc-product-editor-modal .modal-content {
        margin: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
        min-height: 100vh;
    }

    .cvc-product-list-container {
        grid-template-columns: 1fr;
    }
}
