/**
 * AcademiaPress — Componentes Reutilizables
 * Botones, cards, barras de progreso, navegación y video container.
 */

/* ═══ BOTONES ═══ */

.ap-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--ap-space-sm);
    font-family: var(--ap-font-body);
    font-weight: 700;
    font-size: var(--ap-text-sm);
    padding: 0.75rem 1.5rem;
    border-radius: var(--ap-radius-md);
    transition: all var(--ap-transition-base);
    white-space: nowrap;
    line-height: 1;
}

.ap-btn--primary {
    background-color: var(--ap-accent);
    color: var(--ap-bg-dark);
}
.ap-btn--primary:hover {
    background-color: var(--ap-accent-soft);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 165, 74, 0.3);
}
.ap-btn--primary:active {
    transform: translateY(0);
}

.ap-btn--secondary {
    background-color: transparent;
    color: var(--ap-text-main);
    border: 1px solid #D8C7A8;
}
.ap-btn--secondary:hover {
    border-color: var(--ap-accent);
    color: var(--ap-accent);
}

.ap-btn--dark {
    background-color: transparent;
    color: var(--ap-accent);
    border: 1px solid rgba(220, 165, 74, 0.45);
}
.ap-btn--dark:hover {
    background-color: rgba(220, 165, 74, 0.1);
    border-color: var(--ap-accent);
}

.ap-btn--sm { padding: 0.5rem 1rem; font-size: var(--ap-text-xs); }
.ap-btn--full { width: 100%; }

/* Estado de carga */
.ap-btn--loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}
.ap-btn--loading::after {
    content: '';
    position: absolute;
    width: 16px; height: 16px;
    border: 2px solid rgba(19, 18, 24, 0.3);
    border-top-color: var(--ap-bg-dark);
    border-radius: 50%;
    animation: ap-spin 0.6s linear infinite;
}
@keyframes ap-spin { to { transform: rotate(360deg); } }


/* ═══ CARDS ═══ */

.ap-card {
    background: var(--ap-surface-white);
    border: 1px solid var(--ap-border-light);
    border-radius: var(--ap-radius-xl);
    box-shadow: var(--ap-shadow-card);
    padding: var(--ap-space-lg);
    transition: box-shadow var(--ap-transition-base), transform var(--ap-transition-base);
}
.ap-card:hover {
    box-shadow: var(--ap-shadow-lg);
}
.ap-card--interactive:hover {
    transform: translateY(-2px);
}

.ap-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--ap-space-md);
}
.ap-card__title {
    font-family: var(--ap-font-heading);
    font-size: var(--ap-text-lg);
    font-weight: 600;
    color: var(--ap-text-main);
}
.ap-card__body { color: var(--ap-text-soft); font-size: var(--ap-text-sm); line-height: var(--ap-leading-relaxed); }
.ap-card__footer { margin-top: var(--ap-space-lg); padding-top: var(--ap-space-md); border-top: 1px solid var(--ap-border-light); }


/* ═══ BARRA DE PROGRESO ═══ */

.ap-progress { width: 100%; height: 6px; background-color: rgba(220, 165, 74, 0.12); border-radius: var(--ap-radius-full); overflow: hidden; }
.ap-progress__bar {
    height: 100%;
    background: linear-gradient(90deg, var(--ap-accent), var(--ap-accent-soft));
    border-radius: var(--ap-radius-full);
    transition: width var(--ap-transition-slow);
    min-width: 0;
}
.ap-progress--lg { height: 8px; }

/* Texto de porcentaje junto a la barra */
.ap-progress-label {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: var(--ap-space-xs);
}
.ap-progress-label__text { font-size: var(--ap-text-xs); color: var(--ap-text-soft); font-weight: 500; }
.ap-progress-label__pct { font-size: var(--ap-text-xs); color: var(--ap-accent); font-weight: 700; }


/* ═══ ANILLO DE PROGRESO (SVG) ═══ */

.ap-ring {
    position: relative; display: inline-flex; align-items: center; justify-content: center;
}
.ap-ring__svg { transform: rotate(-90deg); }
.ap-ring__track { fill: none; stroke: rgba(220, 165, 74, 0.12); }
.ap-ring__fill { fill: none; stroke: var(--ap-accent); stroke-linecap: round; transition: stroke-dashoffset var(--ap-transition-slow); }
.ap-ring__text {
    position: absolute; font-family: var(--ap-font-body); font-weight: 700;
    font-size: var(--ap-text-sm); color: var(--ap-text-main);
}


/* ═══ NAVEGACIÓN DEL SIDEBAR ═══ */

.ap-nav { padding: var(--ap-space-md) 0; }
.ap-nav__section { margin-bottom: var(--ap-space-lg); }
.ap-nav__section-title {
    width: 100%; display: flex; justify-content: space-between; align-items: center;
    background: transparent; border: none; cursor: pointer; text-align: left;
    font-family: var(--ap-font-body); font-size: 11px; font-weight: 700;
    letter-spacing: 0.12em; text-transform: uppercase; color: rgba(255,255,255,0.4);
    padding: 0 var(--ap-space-lg); margin-bottom: var(--ap-space-sm);
    transition: color var(--ap-transition-fast);
}
.ap-nav__section-title:hover { color: rgba(255,255,255,0.8); }

.ap-nav__chevron {
    width: 14px; height: 14px; flex-shrink: 0;
    color: rgba(255,255,255,0.3);
    transition: transform 0.3s ease, color 0.3s ease;
}
.ap-nav__section-title:hover .ap-nav__chevron { color: rgba(255,255,255,0.8); }
.ap-nav__chevron--open { transform: rotate(180deg); }

.ap-nav__item {
    display: flex; align-items: center; gap: var(--ap-space-sm);
    padding: 0.625rem var(--ap-space-lg); color: var(--ap-text-invert-soft);
    font-size: var(--ap-text-sm); font-weight: 500;
    transition: all var(--ap-transition-fast); border-left: 3px solid transparent;
    cursor: pointer;
}
.ap-nav__item:hover { background-color: rgba(255, 255, 255, 0.05); color: var(--ap-text-invert); }
.ap-nav__item--active { color: var(--ap-accent); border-left-color: var(--ap-accent); background-color: rgba(220, 165, 74, 0.08); }
.ap-nav__item--completed { color: var(--ap-success); }

/* Indicadores de estado de lección */
.ap-nav__status {
    width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; font-size: 10px;
}
.ap-nav__status--pending { border: 2px solid var(--ap-text-invert-soft); }
.ap-nav__status--active { border: 2px solid var(--ap-accent); background-color: var(--ap-accent-glow); }
.ap-nav__status--completed { background-color: var(--ap-success); color: white; }
.ap-nav__status--locked { border: 2px solid rgba(255,255,255,0.15); opacity: 0.4; }


/* ═══ VIDEO CONTAINER ═══ */

.ap-video {
    position: relative; width: 100%; border-radius: var(--ap-radius-lg);
    overflow: hidden; background-color: var(--ap-bg-dark);
    box-shadow: var(--ap-shadow-lg);
}
.ap-video__wrapper {
    position: relative; padding-bottom: 56.25%; /* 16:9 */
    height: 0; overflow: hidden;
}
.ap-video__wrapper iframe {
    position: absolute; top: 0; left: 0;
    width: 100%; height: 100%; border: 0;
}
.ap-video--empty {
    min-height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        linear-gradient(135deg, rgba(220, 165, 74, 0.08), transparent),
        var(--ap-bg-dark);
}
.ap-video-empty {
    max-width: 520px;
    padding: var(--ap-space-xl);
    text-align: center;
    color: var(--ap-text-invert);
}
.ap-video-empty strong {
    display: block;
    margin-bottom: var(--ap-space-sm);
    color: var(--ap-accent);
    font-family: var(--ap-font-heading);
    font-size: var(--ap-text-xl);
}
.ap-video-empty p {
    color: var(--ap-text-invert-soft);
    line-height: var(--ap-leading-relaxed);
}


/* ═══ BADGE / TAG ═══ */

.ap-badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 0.25rem 0.625rem; border-radius: var(--ap-radius-full);
    font-size: var(--ap-text-xs); font-weight: 600; line-height: 1;
}
.ap-badge--success { background-color: rgba(36, 161, 72, 0.1); color: var(--ap-success); }
.ap-badge--warning { background-color: rgba(241, 184, 75, 0.15); color: #C8930A; }
.ap-badge--accent { background-color: var(--ap-accent-glow); color: var(--ap-accent); }


/* ═══ STREAK COUNTER ═══ */

.ap-streak {
    display: inline-flex; align-items: center; gap: var(--ap-space-xs);
    padding: 0.375rem 0.75rem; background-color: rgba(220, 165, 74, 0.08);
    border: 1px solid var(--ap-border-dark); border-radius: var(--ap-radius-full);
    font-size: var(--ap-text-sm); font-weight: 600; color: var(--ap-accent);
}
.ap-streak__icon { font-size: var(--ap-text-lg); }


/* ═══ ANIMACIONES ═══ */

@keyframes ap-fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.ap-animate-in { animation: ap-fade-in var(--ap-transition-slow) ease both; }

@keyframes ap-check-pop {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}
.ap-animate-check { animation: ap-check-pop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) both; }

/* Celebración al completar módulo */
@keyframes ap-celebration {
    0% { opacity: 0; transform: scale(0.9) translateY(20px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}
.ap-animate-celebration { animation: ap-celebration 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) both; }
