/* ═══════════════════════════════════════════════════════
   TUTORIALES STYLES — MyBox Pack
   Usa las variables CSS del sistema (--bg-card, --text, etc.)
   ═══════════════════════════════════════════════════════ */

/* ── Page layout ── */
.tut-page {
    padding: 24px;
    max-width: 1100px;
}

.tut-header {
    margin-bottom: 24px;
}

.tut-page-title {
    margin: 0 0 4px;
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--text, #1e293b);
    letter-spacing: -0.02em;
}

.tut-page-sub {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-muted, #64748b);
}

/* ── Uploader panel (superdev) ── */
.tut-uploader {
    background: var(--bg-card, #fff);
    border: 1.5px solid var(--border, #e2e8f0);
    border-radius: 14px;
    margin-bottom: 28px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,.04);
}

.tut-uploader-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--accent, #2563eb);
    user-select: none;
    transition: background .15s;
}

.tut-uploader-toggle:hover {
    background: var(--bg-hover, #f8fafc);
}

.tut-toggle-arrow {
    transition: transform .25s var(--ease, ease);
    color: var(--accent, #2563eb);
}

.tut-uploader-body {
    padding: 0 20px 20px;
    border-top: 1px solid var(--border, #e2e8f0);
}

.tut-form-grid {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding-top: 18px;
}

.tut-field { display: flex; flex-direction: column; gap: 6px; }
.tut-field--full { width: 100%; }

.tut-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted, #64748b);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.tut-label-hint {
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    margin-left: 4px;
    color: var(--text-muted, #94a3b8);
}

.tut-input {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid var(--border, #e2e8f0);
    border-radius: 10px;
    font-size: 0.875rem;
    background: var(--bg, #f8fafc);
    color: var(--text, #1e293b);
    font-family: inherit;
    transition: border-color .15s, box-shadow .15s;
    box-sizing: border-box;
}

.tut-input:focus {
    outline: none;
    border-color: var(--accent, #2563eb);
    box-shadow: 0 0 0 3px rgba(37,99,235,.1);
    background: var(--bg-card, #fff);
}

.tut-textarea { resize: vertical; min-height: 68px; }

/* Role toggles */
.tut-roles-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.tut-role-toggle {
    display: flex;
    align-items: center;
    gap: 0;
    cursor: pointer;
}

.tut-role-toggle input[type="checkbox"] {
    display: none;
}

.tut-role-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 16px;
    border-radius: 20px;
    border: 1.5px solid var(--border, #e2e8f0);
    background: var(--bg, #f8fafc);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted, #64748b);
    transition: all .15s;
    user-select: none;
}

.tut-role-toggle input:checked + .tut-role-pill {
    background: var(--accent-light, #eff6ff);
    border-color: var(--accent, #2563eb);
    color: var(--accent, #2563eb);
}

.tut-role-pill:hover {
    border-color: var(--accent, #2563eb);
    color: var(--accent, #2563eb);
}

/* Form actions */
.tut-form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 18px;
    flex-wrap: wrap;
}

.tut-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all .15s;
    font-family: inherit;
}

.tut-btn--save {
    background: var(--accent, #2563eb);
    color: #fff;
}

.tut-btn--save:hover { filter: brightness(1.08); }
.tut-btn--save:disabled { opacity: .6; cursor: not-allowed; }

.tut-btn--cancel {
    background: var(--bg, #f1f5f9);
    color: var(--text-muted, #64748b);
    border: 1.5px solid var(--border, #e2e8f0);
}

.tut-btn--cancel:hover {
    background: var(--bg-hover, #e2e8f0);
}

.tut-feedback {
    margin: 10px 0 0;
    font-size: 0.82rem;
    font-weight: 600;
}

/* ── Tutorial grid ── */
.tut-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

/* ── Skeleton loader ── */
.tut-skeleton-wrap {
    display: contents;
}

.tut-skeleton {
    border-radius: 14px;
    height: 260px;
    background: linear-gradient(
        90deg,
        var(--bg-card, #f1f5f9) 25%,
        var(--bg-hover, #e2e8f0) 50%,
        var(--bg-card, #f1f5f9) 75%
    );
    background-size: 200% 100%;
    animation: tut-shimmer 1.4s infinite;
}

@keyframes tut-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── Tutorial card ── */
.tut-card {
    background: var(--bg-card, #fff);
    border: 1.5px solid var(--border, #e2e8f0);
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform .18s, box-shadow .18s;
    box-shadow: 0 2px 8px rgba(0,0,0,.04);
}

.tut-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 28px rgba(0,0,0,.1);
}

/* Thumbnail */
.tut-card-thumb {
    position: relative;
    padding-top: 56.25%; /* 16:9 */
    background: var(--bg, #0f172a);
    cursor: pointer;
    overflow: hidden;
}

.tut-thumb-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .3s;
}

.tut-card:hover .tut-thumb-img { transform: scale(1.04); }

.tut-thumb-fallback {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    background: linear-gradient(135deg, #0f172a, #1a2744);
}

.tut-play-btn {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,.35);
    transition: background .2s;
}

.tut-play-btn span {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: rgba(255,255,255,.95);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #0f172a;
    padding-left: 4px;
    box-shadow: 0 4px 16px rgba(0,0,0,.35);
    transition: transform .2s;
}

.tut-card:hover .tut-play-btn { background: rgba(0,0,0,.5); }
.tut-card:hover .tut-play-btn span { transform: scale(1.12); }

/* Card body */
.tut-card-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.tut-card-title {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text, #1e293b);
    line-height: 1.35;
}

.tut-card-desc {
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-muted, #64748b);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Role badges on card */
.tut-card-roles {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    margin-top: 2px;
}

.tut-rbadge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
}

.tut-rbadge--admin    { background: #eff6ff; color: #2563eb; }
.tut-rbadge--sucursal { background: #f0fdf4; color: #16a34a; }
.tut-rbadge--cliente  { background: #fff7ed; color: #ea580c; }
.tut-rbadge--none     { background: var(--bg, #f1f5f9); color: var(--text-muted, #94a3b8); }

/* Card action buttons (superdev) */
.tut-card-actions {
    display: flex;
    gap: 6px;
    margin-top: 4px;
}

.tut-card-btn {
    flex: 1;
    padding: 6px 10px;
    border: none;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: all .15s;
}

.tut-card-btn--edit {
    background: var(--bg, #f1f5f9);
    color: var(--accent, #2563eb);
    border: 1.5px solid var(--border, #e2e8f0);
}

.tut-card-btn--edit:hover {
    background: var(--accent-light, #eff6ff);
    border-color: var(--accent, #2563eb);
}

.tut-card-btn--delete {
    background: #fef2f2;
    color: #dc2626;
    border: 1.5px solid #fecaca;
}

.tut-card-btn--delete:hover {
    background: #fee2e2;
    border-color: #f87171;
}

/* ── Empty / Error states ── */
.tut-empty {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 24px;
    text-align: center;
}

.tut-empty-icon  { font-size: 3rem; margin-bottom: 14px; }

.tut-empty-title {
    margin: 0 0 6px;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text, #1e293b);
}

.tut-empty-sub {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-muted, #64748b);
    max-width: 360px;
}

.tut-error {
    grid-column: 1 / -1;
    padding: 18px;
    background: #fef2f2;
    border: 1.5px solid #fecaca;
    border-radius: 10px;
    color: #dc2626;
    font-size: 0.85rem;
    font-weight: 600;
}

/* ── Video Player Modal ── */
.tut-modal {
    position: fixed;
    inset: 0;
    z-index: 9500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .28s;
}

.tut-modal--open {
    opacity: 1;
    pointer-events: all;
}

.tut-modal-bd {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.75);
    backdrop-filter: blur(3px);
}

.tut-modal-box {
    position: relative;
    background: #0f172a;
    border-radius: 16px;
    overflow: hidden;
    width: 100%;
    max-width: 860px;
    box-shadow: 0 24px 80px rgba(0,0,0,.6);
    transform: scale(.95);
    transition: transform .28s var(--ease, ease);
}

.tut-modal--open .tut-modal-box {
    transform: scale(1);
}

.tut-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.tut-modal-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #f1f5f9;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 12px;
}

.tut-modal-close {
    background: rgba(255,255,255,.1);
    border: none;
    border-radius: 8px;
    color: #f1f5f9;
    width: 32px;
    height: 32px;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .15s;
}

.tut-modal-close:hover { background: rgba(255,255,255,.2); }

.tut-modal-player {
    position: relative;
    padding-top: 56.25%;
    background: #000;
}

.tut-iframe,
.tut-video-el {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* ── Dark mode overrides ── */
.dark-mode .tut-input {
    background: var(--bg-card, #1e293b);
    border-color: var(--border, #334155);
    color: var(--text, #f1f5f9);
}

.dark-mode .tut-input:focus {
    background: var(--bg-card-hover, #263348);
}

.dark-mode .tut-role-pill {
    background: var(--bg-card, #1e293b);
    border-color: var(--border, #334155);
    color: var(--text-muted, #94a3b8);
}

.dark-mode .tut-card-btn--edit {
    background: var(--bg-card, #1e293b);
}

.dark-mode .tut-card-btn--delete {
    background: rgba(220,38,38,.12);
}

.dark-mode .tut-rbadge--admin    { background: rgba(37,99,235,.15); }
.dark-mode .tut-rbadge--sucursal { background: rgba(22,163,74,.15); }
.dark-mode .tut-rbadge--cliente  { background: rgba(234,88,12,.15); }

/* ── Responsive ── */
@media (max-width: 600px) {
    .tut-page { padding: 16px; }

    .tut-grid {
        grid-template-columns: 1fr;
    }

    .tut-modal-box {
        max-width: 100%;
        border-radius: 12px;
    }

    .tut-form-actions {
        flex-direction: column-reverse;
    }

    .tut-btn { width: 100%; justify-content: center; }
}