/* ============= CRUD PRODUCTS STYLES ============= */
/* Hereda variables de style-menu.css */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 50%, #0a0a0a 100%);
    color: #fff;
}

/* ============= CRUD SECTION ============= */
.crud-section {
    padding: 40px 20px;
    min-height: calc(100vh - 80px);
}

.crud-container {
    max-width: 1400px;
    margin: 0 auto;
}

/* ============= HEADER DEL CRUD ============= */
.crud-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

.crud-title {
    font-size: 32px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 50%, var(--color-accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.crud-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}

.btn-add-product {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    color: #fff;
    border: none;
    border-radius: 50px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(23, 162, 184, 0.35);
}

.btn-add-product:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(233, 30, 140, 0.4);
}

.btn-logout {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-logout:hover {
    background: rgba(220, 53, 69, 0.2);
    border-color: rgba(220, 53, 69, 0.5);
    color: #ff6b7a;
}

/* ============= BARRA DE BÚSQUEDA ============= */
.search-bar {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.search-input-wrapper {
    position: relative;
    flex: 1;
    min-width: 250px;
}

.search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    opacity: 0.6;
}

.search-input {
    width: 100%;
    padding: 14px 45px 14px 50px;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 50px;
    font-size: 15px;
    color: #fff;
    transition: all 0.3s ease;
    outline: none;
}

.search-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.search-input:focus {
    border-color: var(--color-primary);
    background: rgba(23, 162, 184, 0.1);
    box-shadow: 0 0 20px rgba(23, 162, 184, 0.2);
}

.search-clear {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 26px;
    height: 26px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-clear:hover {
    background: rgba(220, 53, 69, 0.3);
    color: #ff6b7a;
}

.search-filters {
    display: flex;
    gap: 10px;
}

.filter-select {
    padding: 14px 20px;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 50px;
    font-size: 14px;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
    min-width: 180px;
}

.filter-select:focus {
    border-color: var(--color-primary);
}

.filter-select option {
    background: #1a1a1a;
    color: #fff;
}

.search-results {
    padding: 10px 20px;
    background: rgba(23, 162, 184, 0.15);
    border-radius: 50px;
    font-size: 14px;
    color: var(--color-primary);
    white-space: nowrap;
}

.search-results span {
    font-weight: 700;
}

/* ============= TABLA DE PRODUCTOS ============= */
.products-table-wrapper {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
}

.products-table {
    width: 100%;
    border-collapse: collapse;
}

.products-table thead {
    background: rgba(23, 162, 184, 0.15);
}

.products-table th {
    padding: 18px 20px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--color-primary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.products-table td {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    vertical-align: middle;
}

.products-table tbody tr {
    transition: all 0.3s ease;
}

.products-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

.product-img-cell {
    width: 80px;
}

.product-img-thumb {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.product-name-cell {
    font-weight: 600;
    color: #fff;
}

.product-category-cell {
    text-transform: capitalize;
    color: rgba(255, 255, 255, 0.7);
}

.product-collections-cell {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.collection-tag {
    display: inline-block;
    padding: 4px 10px;
    background: rgba(23, 162, 184, 0.2);
    border-radius: 20px;
    font-size: 11px;
    color: var(--color-primary);
}

.product-price-cell {
    font-weight: 700;
    font-size: 16px;
    color: var(--color-secondary);
}

.product-badge-cell .badge {
    display: inline-block;
    padding: 5px 12px;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
}

.product-actions {
    display: flex;
    gap: 10px;
}

.btn-edit,
.btn-delete {
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-edit {
    background: rgba(23, 162, 184, 0.2);
    color: var(--color-primary);
    border: 1px solid rgba(23, 162, 184, 0.3);
}

.btn-edit:hover {
    background: rgba(23, 162, 184, 0.3);
    transform: translateY(-2px);
}

.btn-delete {
    background: rgba(220, 53, 69, 0.2);
    color: #ff6b7a;
    border: 1px solid rgba(220, 53, 69, 0.3);
}

.btn-delete:hover {
    background: rgba(220, 53, 69, 0.3);
    transform: translateY(-2px);
}

/* ============= BTN FEATURED (DESTACADO) ============= */
.product-featured-cell {
    text-align: center;
}

.btn-featured {
    padding: 9px 15px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.45);
    white-space: nowrap;
}

.btn-featured:hover {
    border-color: rgba(255, 200, 0, 0.5);
    color: rgba(255, 200, 0, 0.8);
    background: rgba(255, 200, 0, 0.08);
    transform: translateY(-2px);
}

.btn-featured.active {
    background: rgba(255, 200, 0, 0.18);
    border-color: rgba(255, 200, 0, 0.55);
    color: #ffd700;
    box-shadow: 0 4px 15px rgba(255, 200, 0, 0.2);
}

.btn-featured.active:hover {
    background: rgba(255, 200, 0, 0.1);
    color: rgba(255, 255, 255, 0.6);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: none;
}

/* ============= MODAL ============= */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 95%;
    max-width: 600px;
    max-height: 90vh;
    background: rgba(26, 26, 26, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    overflow: hidden;
}

.modal-container.active {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-title {
    font-size: 22px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.modal-close {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: rgba(220, 53, 69, 0.3);
    transform: rotate(90deg);
}

.modal-body {
    padding: 30px;
    overflow-y: auto;
    max-height: calc(90vh - 180px);
}

.modal-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-label {
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
}

.form-input,
.form-select,
.form-textarea {
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    font-size: 15px;
    color: #fff;
    transition: all 0.3s ease;
    outline: none;
    font-family: inherit;
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--color-primary);
    background: rgba(23, 162, 184, 0.1);
    box-shadow: 0 0 20px rgba(23, 162, 184, 0.2);
}

.form-select {
    cursor: pointer;
}

.form-select option {
    background: #1a1a1a;
    color: #fff;
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
}

/* ============= IMAGE UPLOAD ============= */
.image-upload-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.image-upload-area {
    position: relative;
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.03);
}

.image-upload-area:hover {
    border-color: var(--color-primary);
    background: rgba(23, 162, 184, 0.1);
}

.image-upload-area.dragover {
    border-color: var(--color-secondary);
    background: rgba(233, 30, 140, 0.1);
}

.upload-icon {
    font-size: 40px;
    margin-bottom: 10px;
}

.upload-text {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
}

.upload-text strong {
    color: var(--color-primary);
}

.image-input {
    display: none;
}

.image-preview {
    display: none;
    position: relative;
    border-radius: 12px;
    overflow: hidden;
}

.image-preview.active {
    display: block;
}

.image-preview img {
    width: 100%;
    max-height: 200px;
    object-fit: cover;
    border-radius: 12px;
}

.image-preview-remove {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    background: rgba(220, 53, 69, 0.9);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.image-preview-remove:hover {
    transform: scale(1.1);
}

/* ============= COLLECTIONS CHECKBOXES ============= */
.collections-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.collection-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.collection-checkbox:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.collection-checkbox input {
    width: 18px;
    height: 18px;
    accent-color: var(--color-primary);
    cursor: pointer;
}

.collection-checkbox span {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
}

/* ============= MODAL FOOTER ============= */
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    padding: 25px 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-cancel {
    padding: 14px 28px;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-cancel:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-save {
    padding: 14px 28px;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    color: #fff;
    border: none;
    border-radius: 50px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(23, 162, 184, 0.35);
}

.btn-save:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 35px rgba(233, 30, 140, 0.4);
}

.btn-save:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ============= LOADING STATE ============= */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============= EMPTY STATE ============= */
.empty-state {
    text-align: center;
    padding: 80px 40px;
}

.empty-state-icon {
    font-size: 60px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 22px;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 10px;
}

.empty-state p {
    font-size: 15px;
    color: rgba(255, 255, 255, 0.5);
}

/* ============= TOAST NOTIFICATIONS ============= */
.toast-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 16px 24px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    animation: slideIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.toast.success {
    background: rgba(40, 167, 69, 0.9);
    color: #fff;
}

.toast.error {
    background: rgba(220, 53, 69, 0.9);
    color: #fff;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ============= CONFIRM DIALOG ============= */
.confirm-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: rgba(26, 26, 26, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    z-index: 2001;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    max-width: 400px;
    width: 90%;
}

.confirm-dialog.active {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.confirm-dialog-icon {
    font-size: 50px;
    margin-bottom: 20px;
}

.confirm-dialog h3 {
    font-size: 20px;
    color: #fff;
    margin-bottom: 10px;
}

.confirm-dialog p {
    font-size: 15px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 30px;
}

.confirm-dialog-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
}

/* ============= RESPONSIVE ============= */
@media (max-width: 1024px) {
    .products-table-wrapper {
        overflow-x: auto;
    }

    .products-table {
        min-width: 800px;
    }
}

@media (max-width: 768px) {
    .crud-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .crud-actions {
        width: 100%;
        justify-content: space-between;
    }

    .search-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .search-input-wrapper {
        min-width: 100%;
    }

    .search-filters {
        width: 100%;
    }

    .filter-select {
        width: 100%;
        min-width: auto;
    }

    .search-results {
        text-align: center;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .modal-body {
        padding: 20px;
    }

    .modal-header,
    .modal-footer {
        padding: 20px;
    }

    .collections-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .crud-section {
        padding: 20px 15px;
    }

    .crud-title {
        font-size: 24px;
    }

    .btn-add-product {
        padding: 12px 20px;
        font-size: 14px;
    }

    .btn-add-product span:last-child {
        display: none;
    }
}