/**
 * Frontend CSS for WC Vendor Dashboard
 *
 * @package WC_Vendor_Dashboard
 */

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

/* Product filters */
.wcvd-product-filters {
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f7f7f7;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.wcvd-filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
}

.wcvd-filter-field {
    flex: 1 1 200px;
    margin-bottom: 10px;
}

.wcvd-filter-field label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.wcvd-filter-field input[type="text"],
.wcvd-filter-field select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Checkbox group styling */
.wcvd-filter-checkboxes {
    margin-bottom: 15px;
}

.wcvd-checkbox-group {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px;
    background-color: #fff;
    list-style: none;
    margin: 0;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.07);
}

.wcvd-checkbox-item {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    padding: 8px;
    border-bottom: 1px solid #f0f0f0;
    background-color: #fafafa;
    border-radius: 3px;
}

.wcvd-checkbox-item:last-child {
    margin-bottom: 0;
    border-bottom: none;
}

.wcvd-checkbox-item input[type="checkbox"] {
    margin-right: 10px;
    min-width: 18px;
    min-height: 18px;
    cursor: pointer;
    position: relative;
    top: 1px;
}

.wcvd-checkbox-item label {
    margin-bottom: 0;
    font-weight: normal;
    cursor: pointer;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 2px 0;
}

.wcvd-filter-actions {
    display: flex;
    gap: 10px;
}

.wcvd-filter-actions button {
    flex: 1;
}

/* Dashboard header */
.wcvd-dashboard-header {
    margin-bottom: 20px;
}

/* Dashboard navigation */
.wcvd-dashboard-nav {
    margin-bottom: 20px;
    border-bottom: 1px solid #ddd;
}

.wcvd-dashboard-nav ul {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
}

.wcvd-dashboard-nav li {
    margin: 0;
    padding: 0;
}

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

.wcvd-dashboard-nav li.active a {
    background-color: #f7f7f7;
    border: 1px solid #ddd;
    border-bottom-color: #f7f7f7;
    margin-bottom: -1px;
    color: #000;
}

/* Tab content */
.wcvd-tab-content {
    display: none;
    padding: 20px;
    background-color: #f7f7f7;
    border: 1px solid #ddd;
    border-top: none;
}

.wcvd-tab-content.active {
    display: block;
}

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

/* Products table */
.wcvd-products-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.wcvd-products-table th,
.wcvd-products-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.wcvd-products-table th {
    background-color: #f0f0f0;
    font-weight: 600;
}

/* Responsive tables */
@media screen and (max-width: 768px) {
    .wcvd-products-table {
        display: block;
        overflow-x: auto;
    }
    
    .wcvd-tab-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .wcvd-tab-header h2 {
        margin-bottom: 10px;
    }
    
    .wcvd-modal-content {
        width: 95%;
        margin: 5% auto;
    }
}

.wcvd-product-image img {
    display: block;
    width: 50px;
    height: 50px;
    object-fit: cover;
}

.wcvd-product-actions .button {
    margin-right: 5px;
}

/* Modal */
.wcvd-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
}

.wcvd-modal-content {
    position: relative;
    background-color: #fff;
    margin: 2% auto;
    padding: 0;
    border: 1px solid #ddd;
    border-radius: 8px;
    width: 95%;
    max-width: 1200px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    max-height: 90vh;
    overflow: hidden;
}

.wcvd-modal-body {
    max-height: 90vh;
    overflow-y: auto;
}

.wcvd-modal-close {
    position: absolute;
    top: 15px;
    right: 25px;
    color: #666;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
    z-index: 10;
}

.wcvd-modal-close:hover,
.wcvd-modal-close:focus {
    color: #000;
}

/* Product form */
.wcvd-product-form {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: 100%;
}

/* Header Row */
.wcvd-form-header {
    flex: 0 0 auto;
    padding: 20px 30px;
    border-bottom: 1px solid #ddd;
    background: #f9f9f9;
}

.wcvd-form-header h2 {
    margin: 0;
    font-size: 24px;
    color: #333;
}

/* Content Row */
.wcvd-form-content-row {
    flex: 1;
    display: flex;
    overflow: hidden;
    min-height: 0; /* Important for Firefox */
}

/* Images Column */
.wcvd-form-images {
    flex: 0 0 40%;
    background: #f5f5f5;
    padding: 30px;
    border-right: 1px solid #e0e0e0;
    overflow-y: auto;
    box-sizing: border-box;
}

/* Content Column */
.wcvd-form-content {
    flex: 0 0 60%;
    padding: 30px;
    overflow-y: auto;
    box-sizing: border-box;
}

/* Footer Row */
.wcvd-form-footer {
    flex: 0 0 auto;
    padding: 20px 30px;
    border-top: 1px solid #ddd;
    text-align: right;
    background: #f9f9f9;
}

.wcvd-form-footer button {
    padding: 12px 24px;
    font-size: 14px;
    border-radius: 4px;
    background: var(--e-global-color-secondary);
    color: #fff;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.wcvd-form-footer button:hover,
.wcvd-form-footer button:active {
    background: var(--e-global-color-accent);
}

/* Image upload areas */
.wcvd-image-upload-area {
    border: 2px dashed #ccc;
    border-radius: 5px;
    padding: 20px;
    text-align: center;
    margin-bottom: 15px;
    transition: all 0.3s;
    background-color: #f9f9f9;
    cursor: pointer;
    position: relative;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.wcvd-image-upload-area:hover {
    border-color: white;
    background-color: #f4f7fa;
}

.wcvd-image-upload-area.wcvd-highlight {
    border-color: white;
    background-color: #f0f7fc;
    box-shadow: 0 0 5px rgba(66, 153, 225, 0.5);
}

.wcvd-image-upload-area::before {
    content: "\f317";  /* WordPress Dashicons upload icon */
    font-family: dashicons;
    font-size: 30px;
    color: #888;
    margin-bottom: 10px;
    display: block;
}

.wcvd-image-upload-area:hover::before {
    color: white;
}

.wcvd-image-upload-area.wcvd-has-image::before {
    display: none;
}

.wcvd-image-upload-area p {
    margin: 10px 0 0 0;
    color: #666;
    font-size: 14px;
}

.wcvd-image-upload-area img {
    max-width: 100%;
    height: auto;
    margin-bottom: 10px;
    border-radius: 3px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.wcvd-product-image-preview {
    max-height: 200px;
    width: auto;
    display: block;
    margin: 0 auto 10px;
}

.wcvd-uploading {
    opacity: 0.7;
    pointer-events: none;
}

.wcvd-upload-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 5px;
    background-color: #f0f0f0;
    overflow: hidden;
    border-radius: 0 0 5px 5px;
}

.wcvd-upload-progress-bar {
    height: 100%;
    background-color: white;
    width: 0;
    transition: width 0.3s;
}

/* Gallery */
.wcvd-product-gallery-images {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
    min-height: 60px;
    border: 2px dashed transparent;
    padding: 10px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.wcvd-product-gallery-images.drag-over {
    border-color: white;
    background-color: rgba(34, 113, 177, 0.1);
    box-shadow: 0 0 10px rgba(34, 113, 177, 0.2);
}

.wcvd-gallery-image {
    position: relative;
    width: 80px;
    height: 80px;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
    background-color: #f7f7f7;
    cursor: move;
}

.wcvd-gallery-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wcvd-remove-gallery-image {
    position: absolute;
    top: 0;
    right: 0;
    width: 20px;
    height: 20px;
    background: rgba(255,0,0,0.7);
    color: white;
    font-size: 16px;
    line-height: 18px;
    text-align: center;
    cursor: pointer;
    border-radius: 0 0 0 3px;
}

.wcvd-remove-gallery-image:hover {
    background: rgba(255,0,0,0.9);
}

/* Form fields */
.wcvd-form-group {
    margin-bottom: 25px;
}

.wcvd-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.wcvd-form-group input[type="text"],
.wcvd-form-group input[type="number"],
.wcvd-form-group textarea,
.wcvd-form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s ease;
    background: #fff;
}

.wcvd-form-group input[type="text"]:focus,
.wcvd-form-group input[type="number"]:focus,
.wcvd-form-group textarea:focus,
.wcvd-form-group select:focus {
    border-color: white;
    outline: none;
    box-shadow: 0 0 0 1px white;
}

.wcvd-form-group textarea {
    min-height: 150px;
    resize: vertical;
}

/* Responsive styles */
@media (max-width: 768px) {
    .wcvd-form-content-row {
        flex-direction: column;
    }

    .wcvd-form-images,
    .wcvd-form-content {
        width: 100%;
        flex: 0 0 100%;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }
    
    .wcvd-form-header,
    .wcvd-form-footer {
        padding: 15px;
    }
}

/* Product attributes */
.wcvd-product-attributes {
    margin-bottom: 15px;
}

.wcvd-attributes-container {
    margin-bottom: 10px;
}

.wcvd-attribute-row {
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 10px;
    padding: 10px;
    border: 1px solid #ddd;
    background-color: #f9f9f9;
}

.wcvd-attribute-name,
.wcvd-attribute-values {
    flex: 1 1 45%;
    margin-right: 10px;
    margin-bottom: 10px;
}

.wcvd-select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Loading */
.wcvd-loading {
    text-align: center;
    padding: 20px;
}

/* Error message */
.wcvd-error {
    background-color: #f8d7da;
    color: #721c24;
    padding: 10px 15px;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    margin-bottom: 20px;
}

/* cards */
/* Grid wrapper for product cards */
.wcvd-products-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px; /* Adjust as desired */
    margin: 20px 0;
}

/* Individual product card */
.wcvd-product-card {
    border: 1px solid #ddd;
    background: #fff;
    padding: 15px;
    border-radius: 4px; /* optional */
}

/* Product image */
.wcvd-product-image img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Product name */
.wcvd-product-name {
    font-size: 1.2em;
    margin: 10px 0;
}

/* Product description */
.wcvd-product-description {
    margin-bottom: 10px;
}

/* Custom attributes container */
.wcvd-product-attributes {
    margin-bottom: 10px;
    font-family: Montserrat, sans-serif;
}

.wcvd-product-attributes h3 {
    font-size: 1.5rem;
    font-family: Montserrat, sans-serif;
    font-weight: bold;
    margin-bottom: 15px;
}

.wcvd-product-attributes ul {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.wcvd-product-attributes li {
    font-family: Montserrat, sans-serif;
    font-size: 1rem;
    margin-bottom: 8px;
}

.wcvd-product-attributes li strong {
    font-size: 1rem;
    font-weight: bold;
}

.wcvd-product-attributes li span {
    font-size: 1rem;
}

/* Single attribute row */
.wcvd-attribute {
    margin: 4px 0;
}

/* Edit / Delete buttons container */
.wcvd-product-actions {
    margin-top: 10px;
}

/* Buttons in a row */
.wcvd-product-actions a.button {
    text-decoration: none;
    margin-right: 10px;
}

/* Responsive: single column on narrow screens */
@media (max-width: 768px) {
    .wcvd-products-grid {
        grid-template-columns: 1fr;
    }
}

.wcvd-modal-header > h2 {
    margin: 0 !important;
}

/* Readonly attribute field */
.wcvd-readonly-attribute {
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    padding: 8px 12px;
    border-radius: 4px;
    margin: 0;
    color: #666;
}

.wcvd-readonly-attribute strong {
    color: #333;
}

/* Additional styles for drag and drop interface */
.wcvd-image-upload-area.drag-over {
    border-color: white;
    background-color: rgba(34, 113, 177, 0.1);
    box-shadow: 0 0 10px rgba(34, 113, 177, 0.2);
}

.ui-sortable-placeholder {
    border: 2px dashed #ccc;
    visibility: visible !important;
    background-color: #f9f9f9 !important;
    height: 80px;
    width: 80px;
    box-sizing: border-box;
}

.wcvd-gallery-image-placeholder {
    border: 2px dashed white;
    background-color: rgba(34, 113, 177, 0.1);
    border-radius: 4px;
}
