/**
 * AOS Cert — Admin & Frontend Stylesheet
 * Sigue el AOS UI Style Guide v1.0
 * Variables CSS alineadas con el core de WordPress.
 */

/* =========================================================================
   0. Variables globales
   ========================================================================= */
:root {
    --aos-primary:      #2271b1;
    --aos-primary-dk:   #135e96;
    --aos-success:      #107c10;
    --aos-danger:       #d63638;
    --aos-warning:      #ffb900;
    --aos-bg:           #f0f0f1;
    --aos-card:         #ffffff;
    --aos-border:       #c3c4c7;
    --aos-border-light: #dcdcde;
    --aos-text:         #1d2327;
    --aos-muted:        #50575e;
    --aos-radius:       4px;
    --aos-radius-lg:    6px;

    /* Colores de tipo de certificado */
    --aos-type-asistencia: #2271b1;
    --aos-type-ponente:    #107c10;
    --aos-type-moderador:  #8c5900;
    --aos-type-comite:     #6b2fa0;
}

/* =========================================================================
   1. Contenedor principal
   ========================================================================= */
.aos-wrap {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin: 20px 20px 0 0;
    max-width: 1200px;
}

/* =========================================================================
   2. Cards
   ========================================================================= */
.aos-card {
    background: var(--aos-card);
    border: 1px solid var(--aos-border);
    box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
    border-radius: var(--aos-radius-lg);
    overflow: hidden;
    margin-bottom: 25px;
}

.aos-card.highlighted {
    border-top: 4px solid var(--aos-primary);
}

.aos-card-header {
    padding: 16px 20px;
    background: #f9f9f9;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.aos-card-header h2 {
    margin: 0;
    font-size: 1em;
    color: var(--aos-text);
}

.aos-card-body {
    padding: 20px;
}

/* =========================================================================
   3. Stats row (Dashboard)
   ========================================================================= */
.aos-stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 25px;
}

@media (max-width: 1100px) {
    .aos-stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .aos-stats-row {
        grid-template-columns: 1fr;
    }
}

.aos-stat-box {
    background: var(--aos-card);
    border: 1px solid var(--aos-border-light);
    border-left: 5px solid var(--aos-border);
    padding: 20px;
    border-radius: var(--aos-radius);
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 90px;
}

.aos-stat-box h4 {
    margin: 0 0 10px;
    font-size: .75em;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #646970;
}

.aos-stat-box .stat-value {
    font-size: 1.8em;
    font-weight: 700;
    color: var(--aos-text);
    line-height: 1;
}

.aos-stat-box .dashicons {
    position: absolute;
    right: 15px;
    bottom: 15px;
    font-size: 40px;
    width: 40px;
    height: 40px;
    color: #f0f0f1;
}

/* Variantes de color por estado */
.aos-stat-box.primary   { border-left-color: var(--aos-primary); }
.aos-stat-box.success   { border-left-color: var(--aos-success); }
.aos-stat-box.warning   { border-left-color: var(--aos-warning); }
.aos-stat-box.muted     { border-left-color: var(--aos-muted); }

/* =========================================================================
   4. Tablas
   ========================================================================= */
.aos-cert-table {
    width: 100%;
    border-collapse: collapse;
}

.aos-cert-table td,
.aos-cert-table th {
    vertical-align: middle;
    padding: 10px 12px !important;
    color: var(--aos-muted);
}

.aos-cert-table th {
    font-weight: 600;
    color: var(--aos-text);
    text-align: left;
    border-bottom: 2px solid var(--aos-border-light);
}

.aos-cert-table tbody tr:hover {
    background: #f6f7f7;
}

/* Celda de usuario */
.aos-user-cell strong a {
    display: block;
    font-size: 1em;
    text-decoration: none;
    color: var(--aos-text);
}

.aos-user-cell strong a:hover {
    color: var(--aos-primary);
}

/* Celda de acciones */
.aos-actions-cell {
    text-align: right;
    white-space: nowrap;
}

.aos-actions-cell .button + .button {
    margin-left: 4px;
}

/* =========================================================================
   5. Badges / píldoras
   ========================================================================= */
.aos-badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: var(--aos-radius);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    line-height: 1.4;
    white-space: nowrap;
}

.aos-badge-primary  { background: #dbe9f7; color: var(--aos-primary); }
.aos-badge-success  { background: #e5f5e5; color: var(--aos-success); }
.aos-badge-warning  { background: #fff5cc; color: #7a5c00; }
.aos-badge-danger   { background: #fce8e8; color: var(--aos-danger); }
.aos-badge-muted    { background: var(--aos-bg); color: var(--aos-muted); }

/* Tipos de certificado */
.aos-badge-asistencia { background: #dbe9f7; color: #2271b1; }
.aos-badge-ponente    { background: #e5f5e5; color: #107c10; }
.aos-badge-moderador  { background: #fff0d0; color: #7a4800; }
.aos-badge-comite     { background: #f0e6fa; color: #6b2fa0; }

/* =========================================================================
   6. Barra de progreso (bulk)
   ========================================================================= */
.aos-cert-progress-wrap {
    background: #e0e0e0;
    border-radius: 4px;
    height: 8px;
    overflow: hidden;
    margin: 12px 0 6px;
}

.aos-cert-progress-bar {
    background: var(--aos-primary);
    height: 100%;
    width: 0%;
    transition: width .35s ease;
    border-radius: 4px;
}

.aos-cert-progress-text {
    font-size: .82em;
    color: var(--aos-muted);
    margin: 0;
}

/* =========================================================================
   7. Trial notice (UI-Style-Guide §7)
   ========================================================================= */
.aos-cert-trial-notice {
    display: flex !important;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
    padding: 12px 16px !important;
}

.aos-cert-trial-notice .trial-text {
    flex: 1;
    min-width: 220px;
}

.aos-cert-trial-notice .trial-text ul {
    margin: 6px 0 0 16px;
    padding: 0;
    font-size: .92em;
}

.aos-cert-trial-banner {
    border-radius: var(--aos-radius);
    margin-bottom: 20px;
}

/* =========================================================================
   8. Pestaña de licencia
   ========================================================================= */
.aos-license-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 4px;
}

.aos-version-badge {
    background: var(--aos-primary);
    color: #fff;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
}

/* =========================================================================
   9. Support grid
   ========================================================================= */
.aos-support-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin: 16px 0 30px;
}

.aos-support-item {
    background: var(--aos-bg);
    border: 1px solid var(--aos-border);
    border-radius: var(--aos-radius);
    padding: 20px;
    text-align: center;
}

.aos-support-item .dashicons {
    font-size: 36px;
    width: 36px;
    height: 36px;
    color: var(--aos-primary);
    display: block;
    margin: 0 auto 8px;
}

.aos-support-item h3 {
    margin: 8px 0 6px;
    font-size: .95em;
}

.aos-support-item p {
    font-size: .85em;
    color: var(--aos-muted);
    margin: 0 0 12px;
}

/* =========================================================================
   10. Formulario de plantilla (editor)
   ========================================================================= */
.aos-cert-template-preview {
    border: 1px solid var(--aos-border);
    border-radius: var(--aos-radius);
    overflow: hidden;
    background: #f9f9f9;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--aos-muted);
    font-size: .9em;
    text-align: center;
    padding: 20px;
}

/* =========================================================================
   11. Asignación masiva — estado de selección
   ========================================================================= */
#aos-cert-bulk-actions {
    background: #fff3cd;
    border: 1px solid var(--aos-warning);
    border-radius: var(--aos-radius);
    padding: 10px 16px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

#aos-cert-selected-count {
    font-weight: 600;
    color: var(--aos-text);
}

/* =========================================================================
   12. Perfil frontend — Cards de certificados
   ========================================================================= */
.aos-cert-profile-tab {
    padding: 4px 0;
}

.aos-cert-edition-group {
    margin-bottom: 30px;
}

.aos-cert-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.aos-cert-card {
    background: var(--aos-card);
    border: 1px solid var(--aos-border-light);
    border-radius: var(--aos-radius-lg);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: box-shadow .2s;
}

.aos-cert-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, .08);
}

.aos-cert-card .cert-type-icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.aos-cert-card .cert-type-icon .dashicons {
    font-size: 22px;
    width: 22px;
    height: 22px;
    line-height: 1;
}

.aos-cert-card .cert-title {
    font-weight: 700;
    color: var(--aos-text);
    font-size: .95em;
    margin: 0;
}

.aos-cert-card .cert-date {
    font-size: .8em;
    color: var(--aos-muted);
    margin: 0;
}

.aos-cert-card .cert-sent-status {
    font-size: .82em;
    color: var(--aos-muted);
    display: flex;
    align-items: center;
    gap: 5px;
}

.aos-cert-card .cert-actions {
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px dashed var(--aos-border-light);
}

.aos-cert-card .cert-dl-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: var(--aos-radius);
    font-size: .85em;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    color: #fff;
    transition: opacity .2s;
}

.aos-cert-card .cert-dl-btn:hover {
    opacity: .88;
    color: #fff;
}

.aos-cert-card .cert-dl-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    line-height: 1;
}

/* =========================================================================
   13. Navegación de pestañas WP heredada — overrides menores
   ========================================================================= */
.aos-wrap .nav-tab-wrapper {
    border-bottom: 1px solid var(--aos-border);
    margin-bottom: 0;
}

.aos-wrap .nav-tab {
    font-size: .9em;
}

/* =========================================================================
   14. Spinner de carga inline
   ========================================================================= */
.aos-cert-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(34, 113, 177, .3);
    border-top-color: var(--aos-primary);
    border-radius: 50%;
    animation: aos-spin .7s linear infinite;
    vertical-align: middle;
    margin-right: 5px;
}

@keyframes aos-spin {
    to { transform: rotate(360deg); }
}

/* =========================================================================
   15. Toast / notificación flotante
   ========================================================================= */
#aos-cert-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
    padding: 12px 20px;
    border-radius: var(--aos-radius);
    font-size: .9em;
    font-weight: 600;
    max-width: 340px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .15);
    display: none;
    align-items: center;
    gap: 10px;
    animation: aos-toast-in .25s ease;
}

@keyframes aos-toast-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

#aos-cert-toast.success {
    background: #e5f5e5;
    color: #155015;
    border-left: 4px solid var(--aos-success);
}

#aos-cert-toast.error {
    background: #fce8e8;
    color: #7a1e1e;
    border-left: 4px solid var(--aos-danger);
}

#aos-cert-toast.warning {
    background: #fff5cc;
    color: #5c4200;
    border-left: 4px solid var(--aos-warning);
}

/* =========================================================================
   16. Responsive general
   ========================================================================= */
@media (max-width: 960px) {
    .aos-wrap {
        margin-right: 10px;
    }

    .aos-cert-cards-grid {
        grid-template-columns: 1fr;
    }
}
