/* --- Extracted from 05_TABLES_Premium_Standardized.css --- */
/* =========================================
   TABLES (Premium Standardized)
   ========================================= */
table,
.data-table {
    width: 100%;
    border-collapse: separate;
    /* Allows border-radius */
    border-spacing: 0;
    margin-top: 10px;
    font-size: 0.95rem;
}

/* HEADERS */
th,
.data-table th {
    padding: 16px;
    text-align: center;
    /* USER REQ: Centered Titles */
    font-weight: 800;
    font-size: 0.8rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(248, 250, 252, 0.45) !important;
    /* Subtle header bg */
    border-bottom: 1.5px solid rgba(255, 255, 255, 0.4) !important;
    white-space: nowrap;
}

/* CELLS */
td,
.data-table td {
    padding: 16px;
    text-align: center;
    /* USER REQ: Centered Content */
    vertical-align: middle;
    color: var(--text-main);
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    font-weight: 700;
    transition: 0.2s;
}

/* FIRST COLUMN LEFT ALIGN (Optional override, but default is center now) */
/* If specific tables need left align, use class .text-left */
.text-left {
    text-align: left !important;
}

.text-right {
    text-align: right !important;
}

/* HOVER ROWS */
tr:hover td {
    background-color: rgba(241, 245, 249, 0.55) !important;
}

/* ICONS IN TABLES */
.data-table i {
    font-size: 1.2rem;
    vertical-align: middle;
    color: var(--text-light);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.data-table .btn-icon i {
    color: inherit;
}

/* BADGES WITHIN TABLES */
.data-table .badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* AVATARS IN TABLES */
.table-avatar {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    margin: 0 auto;
    display: block;
    background: #f1f5f9;
}

.table-avatar {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    object-fit: cover;
    margin: 0 auto;
    /* Center avatar */
    display: block;
    background: #f1f5f9;
}

tr:last-child td {
    border-bottom: none;
}

/* Specific Cell Formatting classes */
.td-date {
    font-size: 0.85rem;
    color: var(--text-light);
    font-weight: 700;
    white-space: nowrap !important;
}

.td-number {
    font-family: 'Inter', sans-serif;
    /* Keep Inter for numbers too, cleaner than mono */
    font-feature-settings: "tnum";
    /* Tabular numbers for alignment */
    font-weight: 700;
    color: var(--text-main);
    text-align: right;
}

.td-money {
    font-feature-settings: "tnum";
    font-weight: 700;
    color: var(--text-main);
    text-align: right;
}

.td-ref {
    font-family: monospace;
    font-size: 0.85rem;
    background: #f1f5f9;
    padding: 4px 8px;
    border-radius: 6px;
    color: var(--text-main);
}

/* Modal Table Overrides */
.modal-table-wrap {
    background: rgba(255, 255, 255, 0.75) !important;
    -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
    backdrop-filter: blur(20px) saturate(180%) !important;
    border: 1px solid rgba(255, 255, 255, 0.4) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.8) !important;
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin-bottom: 20px;
}

.modal-table-wrap table {
    min-width: 600px;
    width: 100%;
}

.modal-table-wrap th {
    background: rgba(248, 250, 252, 0.45) !important;
    color: var(--text-light) !important;
    font-weight: 800 !important;
    font-size: 0.8rem !important;
    padding: 12px 15px;
    border-bottom: 1.5px solid rgba(255, 255, 255, 0.4) !important;
}

.modal-table-wrap td {
    padding: 12px 15px;
    font-size: 0.85rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.search-container {
    display: flex;
    flex-wrap: wrap;
    /* Added for responsiveness */
    gap: 12px;
    margin-bottom: 25px;
    align-items: center;
    position: relative;
    width: 100%;
}

/* Search Clear Button (X) */
.search-clear-btn {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--text-light);
    border: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    font-size: 12px;
    font-weight: 700;
    transition: all 0.2s;
    padding: 0;
    line-height: 1;
}

.search-clear-btn:hover {
    background: var(--primary);
    transform: translateY(-50%) scale(1.1);
}

.search-clear-btn.visible {
    display: flex;
}

/* Control search wrapper - for management sections */
.control-search {
    position: relative;
}

.control-search .search-clear-btn {
    right: 10px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 25px;
}

.card-product {
    background: var(--bg-card);
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    transition: 0.3s;
}

.card-product:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-float);
}

.card-img {
    height: 280px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 10px;
}

.card-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.card-body {
    padding: 25px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-grow: 1;
    justify-content: space-between;
}

.tag {
    background: var(--text-main);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 20px;
    position: absolute;
    top: 15px;
    left: 15px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.product-price {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--primary);
}

.hidden {
    display: none !important;
}

.admin-toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 20px;
    background: white;
    padding: 10px;
    border-radius: 20px;
    border: 1px solid var(--border);
    flex-wrap: wrap;
}

.stock-tag {
    padding: 4px 8px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.75rem;
}



/* --- Extracted from 27_MOBILE_RESPONSIVE_TABLES_CARD_VIEW.css --- */
/* =========================================
   MOBILE RESPONSIVE TABLES (CARD VIEW)
   ========================================= */
@media screen and (max-width: 575.98px) {

    /* Force table to not behave like a table */
    table,
    thead,
    tbody,
    th,
    td,
    tr {
        display: block;
    }

    /* Hide headers */
    thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    /* Card Style for Rows */
    tr {
        border: 1px solid var(--border);
        border-radius: 12px;
        margin-bottom: 15px;
        background: white;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
        padding: 10px;
    }

    /* Cell Style */
    td {
        border-bottom: 1px solid #eee;
        position: relative;
        padding-left: 0 !important;
        /* Reset padding */
        padding-right: 0 !important;
        padding-top: 10px !important;
        padding-bottom: 10px !important;
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: right !important;
        /* Content to right */
    }

    td:last-child {
        border-bottom: 0;
    }

    /* Label */
    td:before {
        content: attr(data-label);
        font-weight: 700;
        color: var(--text-light);
        text-align: left;
        margin-right: 20px;
        font-size: 0.85rem;
        flex-shrink: 0;
    }

    /* Adjust Actions Column */
    td[data-label="Acciones"],
    td[data-label="Acción"] {
        justify-content: center;
        /* Center buttons */
        padding-top: 15px !important;
    }

    td[data-label="Acciones"]:before,
    td[data-label="Acción"]:before {
        display: none;
        /* Hide label for actions, just show buttons centered */
    }

    /* Adjust specific elements */
    .btn-icon {
        margin: 0 5px;
        /* More space for touch */
    }

    /* Adjust Dashboard Grid */
    .kpi-grid {
        grid-template-columns: 1fr 1fr;
        /* 2 cols on mobile */
    }

    /* Adjust Toolbar */
    .admin-toolbar {
        flex-direction: column;
        align-items: stretch !important;
        gap: 10px;
    }

    .admin-toolbar input {
        width: 100% !important;
        max-width: none !important;
    }
}



/* --- Extracted from 30_FIX_Status_Badge_Position_in_Tables.css --- */
/* === FIX: Status Badge Position in Tables === */
td .status-badge {
    position: static !important;
    /* Force static in tables */
    display: inline-block;
    margin: 0;
    box-shadow: none;
}

/* Ensure colors are robust */
.status-badge {
    z-index: 1;
    /* Low z-index just in case */
}

/* CATALOGO PREMIUM UI */
.qty-stepper {
    display: flex;
    align-items: center;
    background: #f1f5f9;
    border-radius: 50px;
    padding: 2px;
    border: 1px solid #e2e8f0;
}

.qty-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: white;
    color: var(--text-main);
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}

.qty-btn:hover {
    background: var(--primary);
    color: white;
    transform: scale(1.1);
}

.qty-input {
    width: 30px;
    background: transparent;
    border: none;
    text-align: center;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-main);
    padding: 0;
}

.qty-input:focus {
    outline: none;
    box-shadow: none;
}

.btn-add-premium {
    flex: 1;
    background: var(--text-main);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.btn-add-premium:hover {
    background: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(211, 22, 40, 0.3);
}

.btn-add-premium:active {
    transform: scale(0.95);
}

.btn-add-premium.added {
    background: var(--success) !important;
    pointer-events: none;
}

/* Compact/Small variants for Cleaner UI */
.qty-stepper.compact {
    padding: 1px;
    height: 32px;
}

.qty-btn.small {
    width: 28px;
    height: 28px;
    font-size: 0.8rem;
}

.qty-input.small {
    width: 24px;
    font-size: 0.85rem;
}

.btn-add-premium.small {
    padding: 0 8px;
    height: 30px;
    font-size: 0.8rem;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* Fix for Red Border overload */
.product-card {
    border-color: var(--border) !important;
    /* Force neutral border */
}

/* Low stock borders removed to favor neutral aesthetic, keeping only the badge. */

/* Ensure Compact Spacing */
.prod-info-premium {
    padding-bottom: 0 !important;
}

/* LIST VIEW SUPPORT */
.products-grid.list-view {
    grid-template-columns: 1fr !important;
}

.product-card.list-mode {
    flex-direction: row;
    align-items: center;
    min-height: 120px;
}



/* --- Extracted from 32_RESTORED_GRID_VIEW_STYLES_REQUIRED.css --- */
/* === RESTORED GRID VIEW STYLES (REQUIRED) === */
/* (Consolidated - single source of truth for grid footer layout) */
.footer-layout.grid {
    padding: 6px 8px 10px 8px;
    border-top: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.price-layout.grid {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: normal;
    overflow: hidden;
}

.actions-layout.grid {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
}



/* --- Extracted from 34_2_LIST_VIEW_GENERAL_PC__MOBILE.css --- */
/* --- 2. LIST VIEW: GENERAL (PC & MOBILE) --- */
.product-card.list-mode .prod-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
}





/* --- Extracted from 35_MOBILE_LIST_VIEW_maxwidth_768px.css --- */
/* --- MOBILE LIST VIEW (max-width: 768px) --- */
@media (max-width: 768px) {

    /* 1. CARD LAYOUT */
    .grid.list-view .product-card.list-mode,
    .product-card.list-mode {
        display: flex !important;
        flex-direction: row !important;
        align-items: flex-start !important;
        padding: 10px !important;
        gap: 12px !important;
        min-height: 90px;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    /* 2. IMAGE (Visible & Sized) */
    .grid.list-view .product-card.list-mode .prod-img-container,
    .product-card.list-mode .prod-img-container {
        display: flex !important;
        width: 60px !important;
        height: 60px !important;
        min-width: 60px !important;
        padding: 4px !important;
        background: #ffffff;
        border-radius: 8px;
        margin: 0 !important;
        visibility: visible !important;
        opacity: 1 !important;
        align-items: center;
        justify-content: center;
    }

    .product-card.list-mode .prod-img {
        width: 100% !important;
        height: 100% !important;
        object-fit: contain !important;
    }

    /* 3. TEXT CONTENT */
    .grid.list-view .product-card.list-mode .prod-info-premium,
    .product-card.list-mode .prod-info-premium {
        flex: 1 1 auto !important;
        min-width: 0 !important;
        padding: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        margin-right: 6px !important;
    }

    .grid.list-view .product-card.list-mode .prod-title,
    .product-card.list-mode .prod-title {
        font-size: 0.9rem !important;
        line-height: 1.3 !important;
        /* Disable clamp to show full text if needed, or refine it */
        display: block !important;
        white-space: normal !important;
        overflow: visible !important;
        height: auto !important;
    }

    /* Refined Description Subtext (Ref/Type) */
    .product-card.list-mode .prod-info-premium div {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        align-items: center;
        margin-top: 4px;
    }

    /* 4. ACTIONS COLUMN (Right) */
    .grid.list-view .product-card.list-mode .card-footer,
    .product-card.list-mode .card-footer {
        flex: 0 0 auto !important;
        width: auto !important;
        background: transparent !important;
        border: none !important;
        margin-left: auto !important;
        padding: 0 !important;
    }

    .grid.list-view .product-card.list-mode .footer-layout.list,
    .product-card.list-mode .footer-layout.list {
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-end !important;
        gap: 8px !important;
        margin-left: auto !important;
    }

    /* Order: Price Top, Actions Bottom */
    .grid.list-view .product-card.list-mode .price-layout.list,
    .product-card.list-mode .price-layout.list {
        order: -1 !important;
        margin: 0 !important;
        justify-content: flex-end !important;
    }

    .grid.list-view .product-card.list-mode .actions-layout.list,
    .product-card.list-mode .actions-layout.list {
        order: 2 !important;
        display: flex !important;
        flex-direction: row !important;
        gap: 4px !important;
    }

    /* Mobile Buttons */
    .product-card.list-mode .btn-add-premium.small {
        width: 32px !important;
        height: 28px !important;
        padding: 0 !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
    }

    .product-card.list-mode .btn-add-premium.small i {
        margin: 0 !important;
        font-size: 1.1rem !important;
    }

    .product-card.list-mode .btn-add-premium.small .btn-text {
        display: none !important;
    }
}



/* --- Extracted from 36_DESKTOP_LIST_VIEW_minwidth_769px.css --- */
/* --- DESKTOP LIST VIEW (min-width: 769px) --- */
@media (min-width: 769px) {

    /* 1. CARD LAYOUT */
    .product-card.list-mode {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        padding: 12px 20px !important;
        gap: 20px !important;
    }

    /* 2. IMAGE */
    .product-card.list-mode .prod-img-container {
        display: block !important;
        width: 65px !important;
        height: 65px !important;
        padding: 2px !important;
        flex-shrink: 0 !important;
    }

    /* 3. TEXT */
    .product-card.list-mode .prod-info-premium {
        flex: 1 !important;
        padding: 0 !important;
    }

    /* 4. FOOTER (Total Right Alignment) */
    .grid.list-view .product-card.list-mode .footer-layout.list,
    .product-card.list-mode .footer-layout.list {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: flex-end !important;
        gap: 20px !important;
        min-width: unset !important;
        flex: 1 !important;
    }

    /* 5. ACTIONS ROW (Horizontal like Mobile) */
    /* 5. ACTIONS ROW (Horizontal like Mobile) - NUCLEAR FIX */
    /* 5. ACTIONS ROW (Horizontal like Mobile) - HIGH SPECIFICITY */
    .grid.list-view .product-card.list-mode .actions-layout.list,
    .product-card.list-mode .actions-layout.list {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        /* Prevent wrapping */
        align-items: center !important;
        justify-content: flex-end !important;
        /* Align to right */
        gap: 12px !important;
        width: auto !important;
        margin: 0 !important;
        white-space: nowrap !important;
    }

    /* Child Reset */
    .product-card.list-mode .qty-stepper.compact {
        margin: 0 !important;
        width: auto !important;
        flex: 0 0 auto !important;
        display: flex !important;
    }

    .product-card.list-mode .d-price-group.row-mode {
        border-bottom: 1px solid #f1f5f9;
        padding-bottom: 4px;
        width: 100%;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: flex-end !important;
        flex-wrap: nowrap !important;
        gap: 12px !important;
    }

    .product-card.list-mode .d-price-label {
        font-size: 0.75rem !important;
        font-weight: 700 !important;
        white-space: nowrap !important;
        color: var(--text-light) !important;
    }

    .product-card.list-mode .d-price-tag-retail,
    .product-card.list-mode .d-price-tag-wholesale {
        font-size: 1.1rem !important;
        font-weight: 900 !important;
    }

    .product-card.list-mode .d-price-group.row-mode:last-child {
        border-bottom: none;
    }

    .product-card.list-mode .btn-add-premium.small {
        margin: 0 !important;
        width: 38px !important;
        height: 38px !important;
        flex: 0 0 auto !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 0 !important;
        border-radius: 10px !important;
    }

    /* Target both desktop and mobile button variants */
    .product-card.list-mode .btn-add-premium.small .btn-text,
    .product-card.list-mode .m-btn-add .btn-text {
        display: none !important;
    }

    .product-card.list-mode .btn-add-premium.small i,
    .product-card.list-mode .m-btn-add i {
        margin: 0 !important;
        font-size: 1.2rem !important;
    }
}


/* DEFAULT GRID VIEW IMAGE CONTAINER (Consolidated) */
.product-card .prod-img-container {
    height: 260px;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    background: #ffffff;
}