/**
 * SaicoWC Author - Frontend Styles
 * Compatible con theme SaicoWC
 *
 * @package SaicoWC_Author
 * @version 1.0.0
 */

/* Variables CSS - Hereda del theme SaicoWC */
:root {
    --saicowc-primary: var(--saico-primario, #0073aa);
    --saicowc-success: var(--saico-exito, #10b981);
    --saicowc-danger: var(--saico-error, #ef4444);
    --saicowc-text: var(--saico-texto, #1f2937);
    --saicowc-text-light: var(--saico-texto-claro, #6b7280);
    --saicowc-bg: var(--saico-fondo, #ffffff);
    --saicowc-bg-alt: var(--saico-fondo-alt, #f9fafb);
    --saicowc-border: var(--saico-borde, #e5e7eb);
    --saicowc-radius: var(--saico-radio, 8px);
    --saicowc-shadow: var(--saico-sombra, 0 1px 3px rgba(0, 0, 0, 0.1));
    --saicowc-transition: 0.2s ease;
}

/* ============================================
   BOTÓN DE SEGUIR - Estilo unificado con tema
   ============================================ */

/* Botón base - hereda estilos del tema */
.stats-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--saicowc-radius);
    cursor: pointer;
    transition: all 0.25s ease;
    text-decoration: none;
    white-space: nowrap;
    border: 2px solid transparent;
}

.stats-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.stats-btn .btn-text {
    line-height: 1;
}

/* Botón Seguir - Estado Normal */
.stats-btn-follow {
    background: transparent;
    color: var(--saicowc-primary);
    border-color: var(--saicowc-primary);
}

.stats-btn-follow:hover {
    background: var(--saicowc-primary);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.25);
}

/* Ocultar icono de following cuando no está siguiendo */
.stats-btn-follow .icon-following {
    display: none;
}

/* Estado Siguiendo */
.stats-btn-follow.is-following {
    background: #10b981;
    border-color: #10b981;
    color: #fff;
}

.stats-btn-follow.is-following .icon-follow {
    display: none;
}

.stats-btn-follow.is-following .icon-following {
    display: block;
}

/* Hover cuando está siguiendo - cambiar a rojo "Dejar de seguir" */
.stats-btn-follow.is-following:hover {
    background: #ef4444;
    border-color: #ef4444;
}

.stats-btn-follow.is-following:hover .btn-text {
    font-size: 0;
}

.stats-btn-follow.is-following:hover .btn-text::after {
    content: "Dejar de seguir";
    font-size: 13px;
}

/* Loading state */
.stats-btn-follow.loading {
    pointer-events: none;
    opacity: 0.7;
}

.stats-btn-follow.loading svg {
    animation: saicowc-spin 1s linear infinite;
}

@keyframes saicowc-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   BADGES
   ============================================ */
.saicowc-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
}

.saicowc-badge svg {
    flex-shrink: 0;
}

.saicowc-badge .badge-title {
    color: var(--saicowc-text);
}

/* Colores por nivel */
.saicowc-badge-bronze {
    color: #cd7f32;
}

.saicowc-badge-silver {
    color: #a8a8a8;
}

.saicowc-badge-gold {
    color: #ffd700;
}

.saicowc-badge-platinum {
    color: #e5e4e2;
}

.saicowc-badge-diamond {
    color: #b9f2ff;
}

/* ============================================
   INTEGRACIÓN EN SINGLE PRODUCT
   ============================================ */
.saicowc-author-extension {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.saicowc-author-badge-inline {
    display: flex;
    align-items: center;
}

.saicowc-author-follow-inline {
    display: flex;
    align-items: center;
    gap: 10px;
}

.saicowc-author-follow-inline .saicowc-follow-btn {
    padding: 6px 12px;
    font-size: 12px;
}

.saicowc-followers-count {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--saicowc-text-light);
}

.saicowc-followers-count svg {
    width: 14px;
    height: 14px;
    opacity: 0.7;
}

/* ============================================
   PANEL DE GAMIFICACIÓN (PÁGINA DE AUTOR)
   ============================================ */
.saicowc-author-gamification-panel {
    background: var(--saicowc-bg);
    border: 1px solid var(--saicowc-border);
    border-radius: var(--saicowc-radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--saicowc-shadow);
}

.saicowc-gamification-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.saicowc-badge-large {
    flex-shrink: 0;
}

.saicowc-badge-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.saicowc-badge-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--saicowc-text);
}

.saicowc-badge-points {
    font-size: 14px;
    color: var(--saicowc-text-light);
}

/* Barra de progreso */
.saicowc-progress-container {
    margin-top: 12px;
}

.saicowc-progress-bar {
    height: 8px;
    background: var(--saicowc-bg-alt);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 6px;
}

.saicowc-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--saicowc-primary), var(--saicowc-success));
    border-radius: 4px;
    transition: width 0.5s ease;
}

.saicowc-progress-text {
    font-size: 12px;
    color: var(--saicowc-text-light);
}

/* Stat de seguidores en página de autor */
.saicowc-followers-stat {
    border-left: 2px solid var(--saicowc-primary) !important;
    padding-left: 16px !important;
}

/* Wrapper del botón seguir en página de autor */
.saicowc-author-follow-wrapper {
    margin-top: 16px;
}

.saicowc-author-follow-wrapper .saicowc-follow-btn {
    padding: 10px 20px;
    font-size: 14px;
}


/* ============================================
   LISTA DE AUTORES SEGUIDOS (SHORTCODE)
   ============================================ */
.saicowc-following-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.saicowc-following-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--saicowc-border);
}

.saicowc-following-item:last-child {
    border-bottom: none;
}

.saicowc-following-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--saicowc-text);
    flex: 1;
}

.saicowc-following-link:hover {
    color: var(--saicowc-primary);
}

.saicowc-following-link img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.saicowc-following-name {
    font-weight: 500;
}

.saicowc-following-item .saicowc-follow-btn {
    padding: 6px 12px;
    font-size: 12px;
}

/* ============================================
   CARD DE ESTADÍSTICAS (SHORTCODE)
   ============================================ */
.saicowc-author-stats-card {
    background: var(--saicowc-bg);
    border: 1px solid var(--saicowc-border);
    border-radius: var(--saicowc-radius);
    padding: 20px;
    box-shadow: var(--saicowc-shadow);
}

.saicowc-stats-badge {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--saicowc-border);
}

.saicowc-stats-badge-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--saicowc-text);
}

.saicowc-stats-metrics {
    display: flex;
    gap: 24px;
    margin-bottom: 16px;
}

.saicowc-stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.saicowc-stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--saicowc-text);
}

.saicowc-stat-label {
    font-size: 12px;
    color: var(--saicowc-text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.saicowc-stats-progress {
    padding-top: 16px;
    border-top: 1px solid var(--saicowc-border);
}

.saicowc-stats-progress .saicowc-progress-bar {
    margin-bottom: 8px;
}

.saicowc-progress-label {
    font-size: 12px;
    color: var(--saicowc-text-light);
}

/* ============================================
   MENSAJES Y NOTIFICACIONES
   ============================================ */
.saicowc-login-notice,
.saicowc-empty-notice {
    padding: 16px;
    background: var(--saicowc-bg-alt);
    border-radius: var(--saicowc-radius);
    color: var(--saicowc-text-light);
    text-align: center;
    font-size: 14px;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .saicowc-author-extension {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .saicowc-gamification-header {
        flex-direction: column;
        text-align: center;
    }

    .saicowc-stats-metrics {
        justify-content: center;
    }

    .saicowc-author-follow-wrapper {
        width: 100%;
    }

    .saicowc-author-follow-wrapper .saicowc-follow-btn {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================
   DARK MODE SUPPORT
   ============================================ */
@media (prefers-color-scheme: dark) {
    :root {
        --saicowc-bg: var(--saico-fondo-oscuro, #1f2937);
        --saicowc-bg-alt: var(--saico-fondo-alt-oscuro, #374151);
        --saicowc-text: var(--saico-texto-oscuro, #f9fafb);
        --saicowc-text-light: var(--saico-texto-claro-oscuro, #9ca3af);
        --saicowc-border: var(--saico-borde-oscuro, #4b5563);
    }
}

/* Clase para dark mode forzado */
.dark-mode .saicowc-author-gamification-panel,
.dark-mode .saicowc-author-stats-card,
[data-theme="dark"] .saicowc-author-gamification-panel,
[data-theme="dark"] .saicowc-author-stats-card {
    background: var(--saico-fondo-oscuro, #1f2937);
    border-color: var(--saico-borde-oscuro, #4b5563);
}

.dark-mode .saicowc-badge .badge-title,
.dark-mode .saicowc-badge-title,
.dark-mode .saicowc-stat-value,
[data-theme="dark"] .saicowc-badge .badge-title,
[data-theme="dark"] .saicowc-badge-title,
[data-theme="dark"] .saicowc-stat-value {
    color: var(--saico-texto-oscuro, #f9fafb);
}