/* Contenedor General */
.wcfm-pedido-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    max-width: 100%;
    margin: 20px 0;
}

.wcfm-pedido-wrapper * {
    box-sizing: border-box;
}

/* Filters Container */
.wcfm-filters-container {
    margin-bottom: 20px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 8px;
    border: 1px solid #e1e1e1;
}

.wcfm-filters-container form {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
}

.wcfm-filters-container label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    font-size: 13px;
    color: #444;
}

.wcfm-filters-container select,
.wcfm-filters-container input {
    height: 38px;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 0 10px;
}

/* Mobile responsiveness for filters */
@media (max-width: 768px) {
    .wcfm-filters-container form {
        flex-direction: column;
        align-items: stretch;
    }

    .wcfm-filters-container label {
        width: 100%;
    }

    .wcfm-filters-container select,
    .wcfm-filters-container input {
        width: 100% !important;
        /* Force full width on mobile */
    }

    .wcfm_submit_button {
        width: 100%;
        margin-top: 10px;
    }
}

/* Header */
.wcfm-header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

/* Botones Generales */
.wcfm_submit_button,
.wcfm_mini_button {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.wcfm_submit_button:hover {
    background-color: #0056b3;
}

.wcfm_mini_button {
    padding: 5px 10px;
    font-size: 12px;
    background-color: #28a745;
}

/* Icon Buttons en Tabla */
.wcfm_icon_button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    margin: 0 5px;
    color: #555;
}

.wcfm_icon_button:hover {
    color: #000;
    transform: scale(1.1);
}

.delete-pedido-btn {
    color: #dc3545;
}

.pdf-pedido-btn {
    color: #dc3545;
}

/* Tabla Responsive Styling */
.responsive-table-container {
    width: 100%;
}

.wcfm_table_simple_responsive {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.wcfm_table_simple_responsive th,
.wcfm_table_simple_responsive td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
    white-space: normal;
    color: #333 !important;
    /* Force visibility */
    /* Force wrap */
    word-wrap: break-word;
    /* Break long words */
    word-break: break-word;
}

.wcfm_table_simple_responsive th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #333;
}

.wcfm_table_simple_responsive tr:hover {
    background-color: #f1f1f1;
}

/* Estados Colors */
.aprobado td,
.entregado td {
    border-left: 3px solid #28a745;
}

.pendiente td {
    border-left: 3px solid #ffc107;
}

.rechazado td,
.cancelado td {
    border-left: 3px solid #dc3545;
}

.wcfm-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: bold;
}

.wcfm-badge.aprobado,
.wcfm-badge.entregado {
    background: #d4edda;
    color: #155724;
}

.wcfm-badge.pendiente {
    background: #fff3cd;
    color: #856404;
}

.wcfm-badge.rechazado,
.wcfm-badge.cancelado {
    background: #f8d7da;
    color: #721c24;
}

/* Formularios */
.wcfm-form-group {
    margin-bottom: 15px;
}

.wcfm-form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.wcfm_input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

/* POPUP MODAL (Critical for frontend) */
.wcfm-pedido-popup-container {
    display: none;
    position: fixed;
    z-index: 999999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    padding-top: 50px;
    align-items: flex-start;
    justify-content: center;
}

.wcfm-pedido-popup-content {
    background-color: #fff;
    margin: 20px auto;
    padding: 25px;
    border: 1px solid #888;
    width: 90%;
    max-width: 650px;
    position: relative;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.wcfm-pedido-popup-close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    position: absolute;
    right: 20px;
    top: 10px;
    cursor: pointer;
}

.wcfm-pedido-popup-close:hover {
    color: #000;
}

/* Productos Row en Modal */
.producto-row {
    background: #fdfdfd;
    padding: 10px;
    border: 1px solid #e9e9e9;
    margin-bottom: 8px;
    border-radius: 4px;
}

/* Responsive Mobile */
@media (max-width: 768px) {
    .wcfm_table_simple_responsive thead {
        display: none;
    }

    .wcfm_table_simple_responsive tr {
        display: block;
        margin-bottom: 15px;
        border: 1px solid #ddd;
    }

    .wcfm_table_simple_responsive td {
        display: block;
        text-align: left;
        /* Reset alignment */
        padding-left: 10px;
        /* Standard padding */
        position: relative;
        border: none;
        border-bottom: 1px solid #eee;
        padding-top: 30px;
        /* Space for label */
    }

    /* Product Row Mobile Stack */
    .producto-row {
        flex-direction: column;
        align-items: stretch !important;
        gap: 15px !important;
        /* Increased gap */
    }

    .producto-row>div {
        flex: 1 1 100% !important;
        width: 100% !important;
    }

    .producto-row select,
    .producto-row input {
        width: 100% !important;
        margin-bottom: 5px;
        box-sizing: border-box;
        /* Ensure padding doesn't overflow */
    }

    /* Make Total and Delete Button visible/accessible */
    .remove-producto-btn {
        width: 100%;
        background-color: #ffeaea;
        border: 1px solid #ffcccc;
        padding: 5px;
        margin-top: 5px;
    }

    .wcfm_table_simple_responsive td::before {
        content: attr(data-label);
        position: absolute;
        top: 5px;
        /* Top positioning */
        left: 10px;
        width: calc(100% - 20px);
        /* Prevent overflow */
        text-align: left;
        font-weight: bold;
        color: #777;
        font-size: 0.9em;
    }

    .actions-cell {
        text-align: center !important;
        padding-left: 0 !important;
    }
}

/* TABS STYLING */
.wcfm-tabs-nav {
    display: flex;
    flex-wrap: wrap;
    /* Allow wrapping */

    border-bottom: 2px solid #ddd;
    margin-bottom: 20px;
    margin-top: 10px;
}

.wcfm-tab-btn {
    background: #f1f1f1;
    border: none;
    padding: 10px 20px;
    cursor: pointer;
    font-weight: 600;
    color: #555;
    outline: none;
    border-radius: 5px 5px 0 0;
    margin-right: 5px;
    transition: all 0.2s;
}

.wcfm-tab-btn:hover {
    background: #e9e9e9;
    color: #000;
}

.wcfm-tab-btn.active {
    background: #007bff;
    color: white;
}

.wcfm-tab-content {
    display: none;
    animation: fadeIn 0.3s;
}

.wcfm-tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* STATS DASHBOARD */
.wcfm-stats-dashboard {
    padding: 10px;
}

.stats-grid {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 30px;
}

.stat-card {
    flex: 1;
    min-width: 200px;
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    text-align: center;
    border-top: 4px solid #ddd;
}

.stat-card h3 {
    margin: 0;
    font-size: 14px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-card p {
    font-size: 32px;
    font-weight: bold;
    margin: 10px 0 0;
    color: #333;
}

.stat-card.blue {
    border-top-color: #007bff;
}

.stat-card.green {
    border-top-color: #28a745;
}

.stat-card.orange {
    border-top-color: #fd7e14;
}

.stat-card.purple {
    border-top-color: #6f42c1;
}

.stats-tables-container {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.stat-box {
    flex: 1;
    min-width: 300px;
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.stat-box h4 {
    margin-top: 0;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
    color: #444;
}

/* Mobile Stats Tweaks */
@media screen and (max-width: 900px) {

    .stats-grid,
    .stat-card,
    .stats-tables-container,
    .stat-box {
        display: block !important;
        width: 100% !important;
        margin-bottom: 20px !important;
    }

    .stats-grid {
        display: block !important;
    }

    .stat-box {
        overflow-x: auto !important;
    }
}