/* ============================================================
   Instructivos — Galería de Videos de Capacitación
   ============================================================ */

/* ── Layout ── */
.instructivos-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
}
.instructivos-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary, #1e293b);
    margin: 0;
}
.instructivos-header h2 i {
    color: #6366f1;
    margin-right: 8px;
}

/* ── Upload Zone (Admin Only) ── */
.upload-zone {
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    padding: 28px;
    text-align: center;
    margin-bottom: 28px;
    transition: all .25s ease;
    background: var(--bg-card, #fff);
    cursor: pointer;
}
.upload-zone:hover,
.upload-zone.drag-over {
    border-color: #6366f1;
    background: #eef2ff;
}
.upload-zone i.fa-cloud-arrow-up {
    font-size: 2.5rem;
    color: #6366f1;
    margin-bottom: 10px;
}

/* ── Video Grid ── */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 22px;
}
.video-card {
    background: var(--bg-card, #fff);
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
    transition: box-shadow .25s, transform .2s;
    display: flex;
    flex-direction: column;
}
.video-card:hover {
    box-shadow: 0 10px 25px rgba(99, 102, 241, .12);
    transform: translateY(-2px);
}
.video-card .video-thumbnail {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
}
.video-card .video-thumbnail i {
    font-size: 3.2rem;
    color: rgba(255,255,255,.9);
    transition: transform .2s, color .2s;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
}
.video-card .video-thumbnail:hover i {
    transform: scale(1.15);
    color: #fff;
}
.video-card .card-body {
    padding: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.video-card .card-body h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary, #1e293b);
    margin: 0 0 6px;
    line-height: 1.35;
}
.video-card .card-body .video-desc {
    font-size: .84rem;
    color: #64748b;
    margin: 0 0 10px;
    flex: 1;
    line-height: 1.45;
}
.video-card .card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: .8rem;
    color: #94a3b8;
    margin-bottom: 12px;
    padding-top: 8px;
    border-top: 1px solid #f1f5f9;
}
.video-card .card-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.video-card .card-actions button {
    flex: 1;
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #f8fafc;
    color: #334155;
    font-size: .82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}
.video-card .card-actions button:hover {
    background: #6366f1;
    color: #fff;
    border-color: #6366f1;
}
.video-card .card-actions button.btn-delete {
    flex: 0 0 38px;
    color: #ef4444;
    border-color: #fecaca;
}
.video-card .card-actions button.btn-delete:hover {
    background: #ef4444;
    color: #fff;
    border-color: #ef4444;
}

/* ── Player Modal ── */
.player-modal-backdrop {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,.75);
    z-index: 9998;
    display: none;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}
.player-modal-backdrop.active {
    display: flex;
}
.player-modal {
    background: #0f172a;
    border-radius: 12px;
    overflow: hidden;
    width: 90vw;
    max-width: 960px;
    box-shadow: 0 20px 60px rgba(0,0,0,.6);
    position: relative;
    transition: all 0.25s ease-out;
}
.player-modal video {
    width: 100%;
    display: block;
    max-height: 75vh;
    background: #000;
}
.player-modal .player-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: #1e293b;
    border-top: 1px solid rgba(255,255,255,0.08);
}
.player-modal .player-controls .player-title {
    color: #e2e8f0;
    font-size: .92rem;
    font-weight: 600;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 12px;
}
.player-modal .player-controls button {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,.15);
    color: #e2e8f0;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: .82rem;
    margin-left: 6px;
    transition: all .2s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.player-modal .player-controls button:hover {
    background: #6366f1;
    border-color: #6366f1;
    color: #fff;
}

/* ── Mini-Player Flotante estilo YouTube ── */
.player-modal-backdrop.mini-mode {
    background: transparent !important;
    pointer-events: none !important;
}

.player-modal-backdrop.mini-mode .player-modal {
    position: fixed !important;
    bottom: 24px !important;
    right: 24px !important;
    width: 360px !important;
    max-width: 90vw !important;
    border-radius: 12px !important;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55) !important;
    pointer-events: auto !important;
    z-index: 99999 !important;
    border: 1px solid rgba(255, 255, 255, 0.15);
    animation: slideInMini 0.25s ease-out;
}

@keyframes slideInMini {
    from { transform: translateY(30px) scale(0.9); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

.player-modal-backdrop.mini-mode .player-modal video {
    max-height: 200px !important;
}

.player-modal-backdrop.mini-mode .player-controls {
    padding: 6px 10px !important;
}

.player-modal-backdrop.mini-mode .player-title {
    font-size: 0.78rem !important;
}

.player-modal-backdrop.mini-mode #player-btn-mini {
    display: none !important;
}

.player-modal-backdrop.mini-mode #player-btn-restore {
    display: inline-flex !important;
}

#player-btn-restore {
    display: none;
}

/* ── Empty State ── */
.instructivos-empty {
    text-align: center;
    padding: 60px 20px;
    color: #94a3b8;
}
.instructivos-empty i {
    font-size: 3.5rem;
    color: #cbd5e1;
    margin-bottom: 14px;
}
.instructivos-empty h3 {
    font-size: 1.15rem;
    color: #64748b;
    margin: 0 0 6px;
}
.instructivos-empty p {
    font-size: .9rem;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .video-grid {
        grid-template-columns: 1fr;
    }
    .player-modal {
        width: 96vw;
        border-radius: 8px;
    }
    .player-modal-backdrop.mini-mode .player-modal {
        width: calc(100vw - 32px) !important;
        right: 16px !important;
        bottom: 16px !important;
    }
}
