/* --- Estilos Generales --- */
:root {
    --primary-color: #007bff;
    /* AZUL PRINCIPAL */
    --success-color: #28a745;
    /* Verde */
    --danger-color: #dc3545;
    /* Rojo */
    --text-color: #333;
    --border-color: #ced4da;
    --bg-light: #f8f9fa;
}

/* WCFM Container Wrapper - Full Width Fix */
.wcfm-notas-wrapper {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text-color);
}

.wcfm-container {
    width: 100%;
    box-sizing: border-box;
}

/* --- CABECERA Y BOTÓN DE AÑADIR --- */
/* Flexbox para alinear título a la izquierda y botón a la derecha */
.wcfm-top-element-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    width: 100%;
    flex-wrap: wrap;
}

/* Título */
.wcfm-top-element-container h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    color: var(--text-color);
}

/* Contenedor del botón derecho */
.wcfm-page-head-right {
    float: none;
    margin-bottom: 0;
}

/* BOTÓN DE AÑADIR */
#open-add-nota-form {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    /* Espacio entre icono y texto */

    /* COLOR AZUL (Usa la variable --primary-color definida arriba) */
    background-color: var(--primary-color);
    border: 1px solid var(--primary-color);
    color: #fff;

    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease-in-out;
    line-height: 1.5;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Estado HOVER */
#open-add-nota-form:hover {
    background-color: #0069d9;
    border-color: #0062cc;
    transform: translateY(-1px);
    text-decoration: none;
    color: #fff;
}

#open-add-nota-form .wcfmfa {
    font-size: 1.1em;
}


/* --- Botones Genéricos --- */
.wcfm_submit_button,
.wcfm_submit_button_main {
    background-color: var(--primary-color);
    color: #fff;
    border: 1px solid var(--primary-color);
    padding: 10px 20px;
    font-size: 14px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    text-decoration: none;
    display: inline-block;
    line-height: 1.5;
}

.wcfm_submit_button:hover {
    background-color: #0069d9;
    border-color: #0062cc;
    color: #fff;
    text-decoration: none;
}

#add-producto-btn {
    background-color: var(--success-color);
    border-color: var(--success-color);
    padding: 5px 15px;
    font-size: 12px;
}

#add-producto-btn:hover {
    background-color: #218838;
    border-color: #1e7e34;
}

/* --- Estilos del Popup (Modal) --- */
.wcfm-nota-popup-container {
    display: none;
    position: fixed;
    z-index: 9999999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
}

.wcfm-nota-popup-container.wcfm-show-modal {
    display: flex !important;
}

.wcfm-nota-popup-content {
    background-color: #fff;
    width: 90%;
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    padding: 30px;
    position: relative;
    box-sizing: border-box;
    animation: fadeInDown 0.3s ease-out;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.wcfm-nota-popup-close {
    color: #495057;
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    line-height: 1;
    cursor: pointer;
    transition: color 0.2s;
    z-index: 10;
}

.wcfm-nota-popup-close:hover {
    color: var(--danger-color);
}

/* --- Encabezado del Popup --- */
#wcfm_product_manager_form_re_media_head {
    margin-bottom: 25px;
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
}

#wcfm_product_manager_form_re_media_head .wcfm-page-head-text {
    font-size: 20px;
    font-weight: 500;
    color: var(--text-color);
}

#wcfm_product_manager_form_re_media_head .wcfm-page-head-icon {
    display: none;
}

/* --- Formulario --- */
.wcfm_ele_single {
    margin-bottom: 15px;
    display: block;
    width: 100%;
}

.wcfm_title {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-color);
}

.wcfm_input {
    display: block;
    width: 100%;
    height: calc(1.5em + .75rem + 2px);
    padding: .375rem .75rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: #495057;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid var(--border-color);
    border-radius: .25rem;
    transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
    box-sizing: border-box;
}

textarea.wcfm_input {
    height: auto;
    min-height: 100px;
}

.wcfm_input:focus {
    color: #495057;
    background-color: #fff;
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, .25);
}

.wcfm_input[readonly] {
    background-color: #e9ecef;
    opacity: 1;
}

/* --- Sección de Productos --- */
#productos-container {
    background-color: var(--bg-light);
    padding: 15px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.producto-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: flex-start;
}

.producto-row input {
    margin-bottom: 0;
}

.remove-producto-btn {
    color: var(--danger-color);
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    line-height: 1;
    padding: 5px;
}

.remove-producto-btn:hover {
    color: #bd2130;
}

/* --- Botón Guardar --- */
.wcfm-container-save-button {
    margin-top: 20px;
    text-align: left;
}

.wcfm-container-save-button .wcfm_submit_button {
    width: auto;
    padding-left: 30px;
    padding-right: 30px;
}


/* --- Tabla --- */
.wcfm_table_simple_responsive {
    width: 100%;
    margin-bottom: 1rem;
    color: #212529;
    border-collapse: collapse;
}

.wcfm_table_simple_responsive th,
.wcfm_table_simple_responsive td {
    padding: .75rem;
    vertical-align: top;
    border-top: 1px solid #dee2e6;
}

.wcfm_table_simple_responsive thead th {
    vertical-align: bottom;
    border-bottom: 2px solid #dee2e6;
    background-color: var(--bg-light);
    color: #495057;
}

.wcfm_table_simple_responsive tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 0, 0, .05);
}

/* Badges / Etiquetas de estado */
td.estado-pendiente {
    color: #ffc107;
    font-weight: bold;
}

td.estado-entregado {
    color: var(--success-color);
    font-weight: bold;
}

td.estado-cancelado {
    color: var(--danger-color);
    font-weight: bold;
}

/* Iconos de Acción */
.wcfm_icon_button {
    color: #6c757d;
    margin-right: 5px;
    font-size: 16px;
    text-decoration: none;
}

.wcfm_icon_button:hover {
    color: var(--primary-color);
}

.delete-nota-btn:hover {
    color: var(--danger-color);
}

.pdf-nota-btn:hover {
    color: var(--text-color);
}

.wcfm_clearfix {
    clear: both;
}

/* --- Responsive --- */
@media (max-width: 576px) {

    /* Ajuste para cabecera en móvil */
    .wcfm-top-element-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .wcfm-page-head-right {
        width: 100%;
    }

    #open-add-nota-form {
        width: 100%;
    }

    .wcfm-nota-popup-content {
        margin: 10px;
        width: auto;
        padding: 20px;
    }

    .producto-row {
        flex-direction: column;
        gap: 5px;
        background: #fff;
        padding: 10px;
        border: 1px solid #eee;
    }

    .producto-row .remove-producto-btn {
        align-self: flex-end;
    }

    /* Tabla movil */
    .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: right;
        border: none;
        border-bottom: 1px solid #eee;
    }

    .wcfm_table_simple_responsive td:before {
        content: attr(data-label);
        float: left;
        font-weight: bold;
    }
}