/* =============================================
   Tutores Maestría – Portal CSS (v2)
   Login · Dashboard Maestrante · Dashboard Tutor
   ============================================= */

:root {
    --p:      #1e3a8a;
    --p-light:#2563eb;
    --p-pale: #eff6ff;
    --teal:   #0f6e56;
    --success:#16a34a;
    --warning:#d97706;
    --danger: #dc2626;
    --border: #e2e8f0;
    --bg:     #f8fafc;
    --card:   #ffffff;
    --text:   #1e293b;
    --muted:  #64748b;
    --r:      10px;
    --sh:     0 1px 4px rgba(0,0,0,.06), 0 4px 20px rgba(0,0,0,.04);
}

/* ── Base ──────────────────────────────────── */
.tm-portal-wrap {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text);
    max-width: 900px;
    margin: 0 auto;
    padding: 20px 0 60px;
}

/* ── LOGIN ─────────────────────────────────── */
.tm-login-card {
    max-width: 400px;
    margin: 60px auto 0;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--sh);
}
.tm-login-header {
    background: linear-gradient(135deg, var(--p) 0%, var(--p-light) 100%);
    padding: 32px 24px 28px;
    text-align: center;
}
.tm-login-logo {
    margin-bottom: 14px;
}
.tm-login-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    margin: 0 0 4px;
}
.tm-login-sub {
    color: rgba(255,255,255,.75);
    font-size: .8125rem;
    margin: 0;
}
.tm-login-body {
    padding: 24px;
}
.tm-input-icon-wrap {
    position: relative;
}
.tm-input-icon {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    pointer-events: none;
}
.tm-input-icon-wrap input {
    padding-left: 36px;
}
.tm-btn-login {
    width: 100%;
    background: var(--p);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: .9375rem;
    padding: 12px;
    cursor: pointer;
    transition: background .15s;
    margin-top: 8px;
}
.tm-btn-login:hover { background: var(--p-light); }
.tm-login-hint {
    font-size: .75rem;
    color: var(--muted);
    text-align: center;
    margin-top: 16px;
    line-height: 1.6;
}
.tm-login-hint a { color: var(--p-light); }

/* ── Portal header ─────────────────────────── */
.tm-portal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
}
.tm-portal-badge {
    display: inline-block;
    background: var(--p-pale);
    color: var(--p);
    border-radius: 20px;
    padding: 3px 12px;
    font-size: .6875rem;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    margin-bottom: 6px;
}
.tm-portal-badge.tm-badge-tutor {
    background: #e1f5ee;
    color: var(--teal);
}
.tm-portal-title {
    font-size: 1.375rem;
    font-weight: 700;
    margin: 0 0 4px;
    color: var(--p);
}
.tm-portal-sub {
    font-size: .875rem;
    color: var(--muted);
    margin: 0;
}
.tm-btn-logout {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 14px;
    font-size: .8125rem;
    color: var(--muted);
    cursor: pointer;
    transition: all .15s;
    white-space: nowrap;
}
.tm-btn-logout:hover { border-color: var(--danger); color: var(--danger); }

/* ── Cards ─────────────────────────────────── */
.tm-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 20px;
    box-shadow: var(--sh);
}
.tm-card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--p);
    margin-bottom: 6px;
}
.tm-text-muted { color: var(--muted); font-size: .875rem; }

/* ── Notices ───────────────────────────────── */
.tm-notice {
    border-radius: var(--r);
    padding: 16px 18px;
    font-size: .875rem;
}
.tm-notice-warning { background: #fef9c3; border-left: 3px solid #ca8a04; color: #78350f; border-radius: 0 var(--r) var(--r) 0; }
.tm-notice-info    { background: #eff6ff; border-left: 3px solid var(--p-light); color: var(--p); border-radius: 0 var(--r) var(--r) 0; }

/* ── Formularios ───────────────────────────── */
.tm-form-group { margin-bottom: 14px; }
.tm-form-group label {
    font-size: .8125rem;
    font-weight: 600;
    color: var(--muted);
    display: block;
    margin-bottom: 5px;
}
.tm-input {
    width: 100%;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    padding: 9px 12px;
    font-size: .875rem;
    color: var(--text);
    transition: border-color .15s;
    box-sizing: border-box;
    background: #fff;
}
.tm-input:focus {
    border-color: var(--p-light);
    box-shadow: 0 0 0 3px rgba(37,99,235,.1);
    outline: none;
}

/* ── Botones ───────────────────────────────── */
.tm-btn-primary {
    background: var(--p);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: .875rem;
    padding: 10px 20px;
    cursor: pointer;
    transition: background .15s;
}
.tm-btn-primary:hover { background: var(--p-light); }
.tm-btn-ver {
    background: #f1f5f9;
    border: none;
    border-radius: 6px;
    padding: 5px 10px;
    font-size: .75rem;
    color: var(--p);
    cursor: pointer;
}
.tm-btn-ver:hover { background: var(--p-pale); }
.tm-btn-retroalim {
    background: #fef9c3;
    border: none;
    border-radius: 6px;
    padding: 5px 10px;
    font-size: .75rem;
    color: #78350f;
    cursor: pointer;
}
.tm-btn-retroalim:hover { background: #fef08a; }
.tm-btn-upload {
    display: inline-block;
    background: var(--p-pale);
    color: var(--p);
    border-radius: 6px;
    padding: 5px 10px;
    font-size: .75rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
}
.tm-btn-upload:hover { background: #dbeafe; }
.tm-btn-icon-sm {
    background: none;
    border: none;
    cursor: pointer;
    font-size: .75rem;
    padding: 2px 4px;
    opacity: .6;
}
.tm-btn-icon-sm:hover { opacity: 1; }

/* ── Progreso ──────────────────────────────── */
.tm-progreso-wrap { text-align: right; }
.tm-progreso-pct { font-size: 1.5rem; font-weight: 700; color: var(--p); line-height: 1; }
.tm-progress-bar-wrap {
    background: #e2e8f0;
    border-radius: 20px;
    height: 8px;
    overflow: hidden;
}
.tm-progress-bar {
    background: linear-gradient(90deg, var(--p) 0%, var(--p-light) 100%);
    height: 100%;
    border-radius: 20px;
    transition: width .5s ease;
    min-width: 4px;
}

/* ── Grid capítulos ────────────────────────── */
.tm-capitulos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
}
.tm-cap-card {
    background: var(--card);
    border: 1.5px solid var(--border);
    border-radius: var(--r);
    padding: 16px;
    transition: border-color .15s, box-shadow .15s;
}
.tm-cap-card:hover {
    border-color: var(--p-light);
    box-shadow: 0 4px 16px rgba(37,99,235,.1);
}
.tm-cap-card[data-estado="aprobado"] {
    border-color: #bbf7d0;
    background: #f0fdf4;
}
.tm-cap-card[data-estado="observado"] {
    border-color: #fed7aa;
    background: #fff7ed;
}
.tm-cap-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.tm-cap-num {
    font-size: .6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
}
.tm-cap-titulo-wrap {
    font-size: .875rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
    display: flex;
    align-items: flex-start;
    gap: 4px;
}
.tm-cap-stats {
    display: flex;
    gap: 12px;
    font-size: .6875rem;
    color: var(--muted);
    margin-bottom: 12px;
}
.tm-cap-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* ── Badges de estado ──────────────────────── */
.tm-badge {
    border-radius: 20px;
    padding: 3px 10px;
    font-size: .6875rem;
    font-weight: 700;
}
.tm-badge-pendiente  { background: #f1f5f9; color: #475569; }
.tm-badge-subido     { background: #eff6ff; color: #1d4ed8; }
.tm-badge-en_revision{ background: #fef9c3; color: #92400e; }
.tm-badge-observado  { background: #ffedd5; color: #9a3412; }
.tm-badge-aprobado   { background: #dcfce7; color: #15803d; }

.tm-status-chip {
    font-size: .6875rem;
    font-weight: 500;
    color: var(--muted);
    background: #f1f5f9;
    border-radius: 20px;
    padding: 4px 10px;
}
.tm-chip-revision { background: #fef9c3; color: #92400e; }
.tm-chip-ok       { background: #dcfce7; color: #15803d; font-weight: 700; }

/* ── Tabla capítulos (tutor) ───────────────── */
.tm-cap-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .8125rem;
}
.tm-cap-table th {
    background: #f8fafc;
    padding: 8px 12px;
    font-size: .6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
    border-bottom: 1.5px solid var(--border);
}
.tm-cap-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.tm-cap-table tbody tr:hover { background: #f8fafc; }
.tm-cap-table tbody tr:last-child td { border-bottom: none; }

/* Avatar tutor vista tutor */
.tm-avatar-sm {
    display: inline-flex;
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--p);
    color: #fff;
    font-size: .8125rem;
    font-weight: 700;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
}
.tm-maestrante-header { align-items: center; }
.tm-tesis-titulo { font-size: .875rem; color: var(--text); }

/* ── Modal ─────────────────────────────────── */
.tm-modal-portal {
    border-radius: 14px;
    border: none;
    box-shadow: 0 12px 40px rgba(0,0,0,.15);
}
.tm-modal-portal .modal-header {
    background: var(--p);
    color: #fff;
    border-bottom: none;
}
.tm-modal-portal .modal-title { font-size: .9375rem; font-weight: 700; }
.tm-modal-portal .btn-close { filter: invert(1) brightness(2); }

/* ── Historial en modal ────────────────────── */
.tm-historial-section { margin-bottom: 20px; }
.tm-historial-section h6 {
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--muted);
    margin-bottom: 10px;
}
.tm-archivo-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 6px;
    font-size: .8125rem;
}
.tm-archivo-item .version-num {
    background: var(--p);
    color: #fff;
    border-radius: 4px;
    padding: 1px 7px;
    font-size: .6875rem;
    font-weight: 700;
    margin-right: 8px;
}
.tm-archivo-item a { color: var(--p-light); font-size: .8125rem; }

.tm-retro-item {
    border-left: 3px solid var(--border);
    padding: 10px 14px;
    margin-bottom: 10px;
    border-radius: 0 8px 8px 0;
    background: #f8fafc;
    font-size: .8125rem;
}
.tm-retro-item.estado-aprobado { border-left-color: var(--success); background: #f0fdf4; }
.tm-retro-item.estado-observado { border-left-color: var(--warning); background: #fff7ed; }
.tm-retro-item.estado-en_revision { border-left-color: var(--p-light); }
.tm-retro-meta {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 5px;
}
.tm-retro-meta .estado-chip { font-size: .6875rem; font-weight: 700; }
.tm-retro-meta .fecha-meta { font-size: .6875rem; color: var(--muted); }
.tm-retro-comentario { color: var(--text); line-height: 1.5; }

/* ── Alertas ───────────────────────────────── */
.tm-alert-success {
    background: #dcfce7; color: #166534;
    border: 1px solid #bbf7d0;
    border-radius: 8px; padding: 10px 14px;
    font-size: .875rem; margin-top: 10px;
}
.tm-alert-error {
    background: #fee2e2; color: #991b1b;
    border: 1px solid #fecaca;
    border-radius: 8px; padding: 10px 14px;
    font-size: .875rem; margin-top: 10px;
}

/* ── Loading ───────────────────────────────── */
.tm-loading-spin {
    text-align: center;
    color: var(--muted);
    padding: 30px;
    font-size: .875rem;
}
.tm-overlay-loading {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 9999;
    display: flex; align-items: center; justify-content: center;
}
.tm-spinner-box {
    background: #fff;
    border-radius: 14px;
    padding: 32px 40px;
    text-align: center;
}
.tm-spinner-ring {
    width: 40px; height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--p-light);
    border-radius: 50%;
    animation: tm-spin .7s linear infinite;
    margin: 0 auto 12px;
}
@keyframes tm-spin { to { transform: rotate(360deg); } }

/* ── Responsive ─────────────────────────────── */
@media (max-width: 640px) {
    .tm-portal-header { flex-direction: column; }
    .tm-capitulos-grid { grid-template-columns: 1fr; }
}

/* ── Paso badge (Paso 1 / Paso 2 / Paso 3) ──── */
.tm-step-badge {
    display: inline-flex;
    align-items: center;
    background: var(--p-pale);
    color: var(--p);
    border-radius: 20px;
    padding: 2px 10px;
    font-size: .6875rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    flex-shrink: 0;
}

/* ── Tema propuesto destacado en solicitudes ─── */
.tm-tema-box {
    background: #fff;
    border: 0.5px solid #fbbf24;
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 10px;
}
.tm-tema-label {
    font-size: .6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #92400e;
    margin-bottom: 4px;
    display: block;
}
.tm-tema-titulo {
    font-size: .9375rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.4;
}
.tm-tema-desc {
    font-size: .8125rem;
    color: var(--muted);
    line-height: 1.5;
    border-top: 0.5px solid #fde68a;
    padding-top: 6px;
    margin-top: 6px;
}
