/* ═══════════════════════════════════════════════════════
   ProfeGalo Prácticas — Frontend
   ═══════════════════════════════════════════════════════ */

/* ── Reset dentro del plugin ──────────────────────────── */
.pgp-catalog, .pgp-single-practice {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: #1a1a2e;
    line-height: 1.6;
}

/* ── Modal de identificación ─────────────────────────── */
.pgp-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 52, 96, 0.55);
    backdrop-filter: blur(4px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pgp-fadeIn 0.25s ease;
}
@keyframes pgp-fadeIn { from { opacity: 0; } to { opacity: 1; } }

.pgp-modal {
    background: #fff;
    border-radius: 16px;
    padding: 32px;
    width: 90%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    position: relative;
    animation: pgp-slideUp 0.3s ease;
}
@keyframes pgp-slideUp { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.pgp-modal h3 {
    margin: 0 0 4px 0;
    font-size: 20px;
    color: #0f3460;
}
.pgp-modal-sub {
    color: #666;
    font-size: 14px;
    margin: 0 0 20px 0;
}
.pgp-modal-close {
    position: absolute;
    top: 12px; right: 16px;
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    line-height: 1;
}
.pgp-modal-close:hover { color: #333; }

.pgp-modal-form label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #444;
    margin-bottom: 4px;
}
.pgp-modal-form input {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    margin-bottom: 14px;
    transition: border-color 0.2s;
    box-sizing: border-box;
}
.pgp-modal-form input:focus {
    outline: none;
    border-color: #0f3460;
}
.pgp-modal-error {
    background: #fff0f0;
    color: #c0392b;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 12px;
}

/* ── Botones ─────────────────────────────────────────── */
.pgp-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
    text-decoration: none;
}
.pgp-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.pgp-btn:active {
    transform: translateY(0);
}
.pgp-btn-primary {
    background: #0f3460;
    color: #fff;
    width: 100%;
    justify-content: center;
    padding: 12px;
    font-size: 16px;
}
.pgp-btn-download {
    color: #fff;
}
.pgp-btn-github {
    background: #24292e;
    color: #fff;
}
.pgp-btn[disabled] {
    opacity: 0.5;
    cursor: wait;
}

/* ── Filtros ─────────────────────────────────────────── */
.pgp-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 28px;
    padding-bottom: 16px;
    border-bottom: 1px solid #eee;
}
.pgp-filter-btn {
    padding: 8px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 20px;
    background: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    color: #555;
}
.pgp-filter-btn:hover {
    border-color: var(--accent, #0f3460);
    color: var(--accent, #0f3460);
}
.pgp-filter-btn.active {
    background: var(--accent, #0f3460);
    border-color: var(--accent, #0f3460);
    color: #fff;
}

/* ── Grupo de asignatura ─────────────────────────────── */
.pgp-subject-group {
    margin-bottom: 36px;
}
.pgp-subject-group.pgp-hidden {
    display: none;
}
.pgp-subject-header {
    border-left: 4px solid;
    padding-left: 16px;
    margin-bottom: 16px;
    display: flex;
    align-items: baseline;
    gap: 12px;
}
.pgp-subject-header h2 {
    margin: 0;
    font-size: 22px;
}
.pgp-subject-count {
    font-size: 13px;
    color: #999;
}

/* ── Grid de prácticas ───────────────────────────────── */
.pgp-practices-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

/* ── Card de práctica ────────────────────────────────── */
.pgp-practice-card {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 12px;
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.15s;
    position: relative;
}
.pgp-practice-card:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}
.pgp-card-accent {
    height: 4px;
    width: 100%;
}
.pgp-card-body {
    padding: 20px;
}
.pgp-card-number {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.5px;
}
.pgp-card-title {
    margin: 6px 0 8px 0;
    font-size: 17px;
    color: #1a1a2e;
    line-height: 1.3;
}
.pgp-card-desc {
    font-size: 14px;
    color: #666;
    margin: 0 0 12px 0;
}
.pgp-card-meta {
    font-size: 12px;
    color: #999;
    margin-bottom: 14px;
}
.pgp-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* ── Badges ──────────────────────────────────────────── */
.pgp-badge {
    display: inline-block;
    color: #fff;
    padding: 3px 12px;
    border-radius: 14px;
    font-size: 12px;
    font-weight: 600;
}

/* ── Práctica individual ─────────────────────────────── */
.pgp-single-header {
    border-left: 4px solid;
    padding-left: 20px;
    margin-bottom: 24px;
}
.pgp-single-header h2 {
    margin: 8px 0;
    font-size: 24px;
    color: #1a1a2e;
}
.pgp-theory-block {
    background: #f8f9ff;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
}
.pgp-theory-block h3 {
    margin-top: 0;
    color: #0f3460;
}

/* ── Estado vacío ────────────────────────────────────── */
.pgp-empty {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-size: 16px;
}

/* ── Loading spinner ─────────────────────────────────── */
.pgp-btn-loading::after {
    content: '';
    width: 14px; height: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: pgp-spin 0.6s linear infinite;
    display: inline-block;
    margin-left: 6px;
}
@keyframes pgp-spin { to { transform: rotate(360deg); } }

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 600px) {
    .pgp-practices-grid {
        grid-template-columns: 1fr;
    }
    .pgp-modal {
        margin: 16px;
        padding: 24px;
    }
    .pgp-card-actions {
        flex-direction: column;
    }
    .pgp-card-actions .pgp-btn {
        width: 100%;
        justify-content: center;
    }
}
