/*
 * Estilos de UI para el plugin ACU Certificados
 * Estructuras: tarjetas de estadísticas, tablas, formularios, modales y dashboards.
 */

.acu-stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.acu-stat-box {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    text-align: center;
    transition: all 0.3s ease;
}

.acu-stat-box:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.acu-stat-box .dashicons {
    font-size: 36px;
    width: 36px;
    height: 36px;
    color: #7ac543;
    margin-bottom: 12px;
}

.acu-stat-box h3 {
    margin: 0 0 12px 0;
    color: #1d2327;
    font-size: 16px;
    font-weight: 500;
}

.stat-number {
    font-size: 28px;
    font-weight: bold;
    color: #7ac543;
}

.acu-recent-activity {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 30px;
}

.acu-section-header {
    display: flex;
    align-items: center;
    margin-bottom: 24px;
}

.acu-section-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #1d2327;
    display: flex;
    align-items: center;
}

.acu-section-header .dashicons {
    margin-right: 10px;
    color: #7ac543;
    font-size: 24px;
    width: 24px;
    height: 24px;
}

.wp-list-table {
    border: none;
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 0;
}

.wp-list-table th {
    background: #f8f9fa;
    color: #1d2327;
    font-weight: 600;
    text-align: left;
    padding: 16px;
    border-bottom: 2px solid #e5e7eb;
}

.wp-list-table td {
    padding: 16px;
    vertical-align: middle;
    border-bottom: 1px solid #e5e7eb;
    color: #4b5563;
}

.wp-list-table tr:hover {
    background: #f9fafb;
}

.button.ver-detalles {
    background: #7ac543;
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.button.ver-detalles:hover {
    background: #fc9601;
    border-color: #fc9601;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

.acu-btn .dashicons {
    margin-right: 8px;
}

/* Formularios */
.acu-form {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-top: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

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

.form-actions {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

/* Tabs de navegación */
.nav-tab-wrapper {
    margin-bottom: 20px;
    border-bottom: 2px solid #7ac543;
}

.tab-content {
    display: none;
}

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

/* Sección de importación */
.import-section {
    max-width: 600px;
    margin: 20px auto;
    text-align: center;
}

/* Secciones del formulario */
.form-section-title {
    color: #23282d;
    padding-bottom: 10px;
    margin: 20px 0;
    border-bottom: 2px solid #7ac543;
}

/* Espaciado entre secciones */
.form-row+.form-section-title {
    margin-top: 40px;
}

/* Visualización de campos numéricos */
.form-group input[type="number"] {
    text-align: right;
    padding-right: 15px;
}

/* Indicador de campo requerido */
.form-group label::after {
    content: "*";
    color: #d63638;
    margin-left: 4px;
}

/* Responsive */
@media screen and (max-width: 782px) {
    .acu-stats-container {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .tablenav .actions {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
}

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

.acu-modal.active,
.acu-modal:target {
    display: block;
}

.acu-modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 600px;
    border-radius: 5px;
    position: relative;
    animation: modalFadeIn 0.3s;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.acu-close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    right: 20px;
    top: 10px;
}

.acu-close:hover,
.acu-close:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

.acu-detalles-grid {
    padding: 24px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.acu-detalle-item {
    padding: 16px;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.acu-detalle-label {
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
    font-size: 14px;
}

.acu-detalle-valor {
    color: #1f2937;
    font-size: 16px;
}

/* Importación: pasos, mapeo y vista previa */
.paso-importacion {
    margin: 20px 0;
    padding: 20px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.paso-importacion h4 {
    margin-top: 0;
    color: #23282d;
    border-bottom: 2px solid #0073aa;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.mapeo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.mapeo-item {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 4px;
    border: 1px solid #e2e4e7;
}

.mapeo-item label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.mapeo-item select {
    width: 100%;
}

.form-preview {
    margin: 30px 0;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
}

.form-preview h4 {
    margin: 0;
    padding: 15px;
    background: #f8f9fa;
    border-bottom: 1px solid #ddd;
}

.table-responsive {
    overflow-x: auto;
    max-height: 400px;
    overflow-y: auto;
}

/* Mejorar vista previa de importación: evitar letras en columna por table-layout: fixed */
.form-preview table {
    table-layout: auto !important;
    width: max-content;
    border-collapse: collapse;
}

.form-preview thead th,
.form-preview tbody td {
    white-space: nowrap;
}

.import-error {
    color: #dc3232;
    background: #fbeaea;
    padding: 10px;
    border-left: 4px solid #dc3232;
    margin: 10px 0;
}

.import-success {
    color: #46b450;
    background: #ecf7ed;
    padding: 10px;
    border-left: 4px solid #46b450;
    margin: 10px 0;
}

.import-warning {
    color: #ffb900;
    background: #fff8e5;
    padding: 10px;
    border-left: 4px solid #ffb900;
    margin: 10px 0;
}

.lista-sucursales {
    list-style: none;
    padding: 0;
    margin: 0;
}

.lista-sucursales li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #ddd;
}

.lista-sucursales li:last-child {
    border-bottom: none;
}

.nombre-sucursal {
    font-size: 14px;
    flex-grow: 1;
}

.acciones-sucursal {
    display: flex;
    gap: 10px;
}

.editar-sucursal-form {
    display: flex;
    gap: 10px;
    width: 100%;
    align-items: center;
}

.editar-sucursal-form input {
    flex-grow: 1;
}

/* Login */
.acu-login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.acu-login-box {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
}

.acu-messages {
    margin-bottom: 20px;
}

.acu-message {
    padding: 10px 15px;
    border-radius: 4px;
    margin-bottom: 15px;
}

.acu-message.error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.acu-message.success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.acu-form-group {
    margin-bottom: 20px;
}

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

.acu-input-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

.acu-input-group input:focus {
    border-color: #7ac543;
    box-shadow: 0 0 0 1px #7ac543;
    outline: none;
}

.acu-checkbox {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.acu-checkbox input {
    margin-right: 8px;
}

.acu-btn-block {
    display: block;
    width: 100%;
    font-weight: 700;
    color: white;
    border: 2px solid #7ac543;
}

.acu-btn-block:hover {
    border-color: #fc9601;
}

.acu-form-footer {
    margin-top: 20px;
    text-align: center;
}

.acu-forgot-password {
    color: #7ac543;
    text-decoration: none;
    font-size: 14px;
}

.acu-forgot-password:hover {
    color: #fc9601;
    text-decoration: underline;
}

/* Grid: inputs de logos inferiores en certificados */
.acu-logos-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Dashboards */
.acu-dashboard {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
    background: #f0f2f5;
}

.acu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.acu-header h1 {
    margin: 0;
    color: #1d2327;
    font-size: 24px;
    font-weight: 600;
}

.acu-subtitle {
    color: #23282d;
    font-size: 20px;
    margin: 0 0 10px 0;
}

.acu-empresa {
    color: #666;
    font-size: 16px;
    margin: 0 0 20px 0;
}

.acu-stat-card {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.acu-stat-card h3 {
    margin: 0 0 10px 0;
    color: #666;
    font-size: 16px;
}

.acu-stat-card .stat-number {
    font-size: 28px;
    font-weight: bold;
    color: #7ac543;
}

.acu-table {
    width: 100%;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border-collapse: collapse;
    margin-top: 20px;
}

.acu-table th {
    background: #f8f9fa;
    padding: 12px;
    text-align: left;
    border-bottom: 2px solid #dee2e6;
    color: #495057;
}

.acu-table td {
    padding: 12px;
    border-bottom: 1px solid #dee2e6;
    color: #212529;
}

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

.acu-table .no-records {
    text-align: center;
    color: #666;
    padding: 20px;
}

.acu-generate-certificate {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-top: 30px;
}

.acu-recent-collections {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-top: 30px;
}

.acu-btn-logout .dashicons {
    margin-right: 8px;
}

.acu-logout {
    margin-top: 30px;
    text-align: right;
}

/* Responsive - tablas y modales */
@media screen and (max-width: 782px) {
    .wp-list-table {
        display: block;
        overflow-x: auto;
    }

    .acu-detalles-grid {
        grid-template-columns: 1fr;
    }

    .acu-modal-content {
        margin: 20px;
    }

    .acu-header {
        flex-direction: column;
        text-align: center;
        gap: 16px;
    }
}

.acu-btn {
    background: #7ac543;
    color: white;
    border: 2px solid #7ac543;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 700;
}

.acu-btn:hover {
    background: #fc9601;
    border-color: #fc9601;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

.acu-btn-primary {
    background: #7ac543;
    color: white;
    font-weight: 700;
    border: 2px solid #7ac543;
}

.acu-btn-primary:hover {
    background: #fc9601;
    border-color: #fc9601;
    color: white;
}