/* =============================================
   VIP Certificados — Design System
   Branding: VIP Salud Ocupacional
   Colors from logo: Blue, Purple, Orange, Green, Teal
   ============================================= */

/* ---- CSS Custom Properties ---- */
:root {
    /* Primary Palette (from logo) */
    --primary: #4f46e5;
    --primary-dark: #3730a3;
    --primary-light: #818cf8;
    --primary-50: #eef2ff;

    /* Accent Colors (logo gradients) */
    --purple: #7c3aed;
    --purple-light: #a78bfa;
    --orange: #f97316;
    --orange-light: #fdba74;
    --green: #16a34a;
    --green-light: #4ade80;
    --teal: #0d9488;

    /* Neutrals */
    --white: #ffffff;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    /* Semantic */
    --success: #16a34a;
    --success-bg: #f0fdf4;
    --warning: #eab308;
    --warning-bg: #fefce8;
    --danger: #dc2626;
    --danger-bg: #fef2f2;

    /* Layout */
    --sidebar-width: 320px;
    --nav-height: 64px;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.10), 0 4px 6px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.10), 0 10px 10px rgba(0, 0, 0, 0.04);

    /* Typography */
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --transition: 200ms ease;
}

/* ---- Reset & Base ---- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.6;
    color: var(--gray-800);
    background: var(--gray-50);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    text-decoration: none;
    color: inherit;
}

img {
    max-width: 100%;
    height: auto;
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--purple));
    color: var(--white);
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.35);
}

.btn-primary:hover {
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.45);
}

.btn-secondary {
    background: var(--white);
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}

.btn-secondary:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
}

.btn-success {
    background: linear-gradient(135deg, var(--green), var(--teal));
    color: var(--white);
    box-shadow: 0 2px 8px rgba(22, 163, 74, 0.35);
}

.btn-success:hover {
    box-shadow: 0 4px 14px rgba(22, 163, 74, 0.45);
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-edit {
    background: var(--primary-50);
    color: var(--primary);
    border: 1px solid var(--primary-light);
}

.btn-edit:hover {
    background: var(--primary);
    color: var(--white);
}

.btn-delete {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid #fca5a5;
}

.btn-delete:hover {
    background: var(--danger);
    color: var(--white);
}

.btn-logout {
    background: transparent;
    color: var(--gray-500);
    border: 1px solid var(--gray-300);
    width: 100%;
    margin-top: 8px;
}

.btn-logout:hover {
    background: var(--danger-bg);
    color: var(--danger);
    border-color: var(--danger);
}

.btn-nav {
    padding: 15px 36px;
    border-radius: 999px;
    font-size: 18px;
    font-weight: 700;
}

.btn-prev {
    background: var(--white);
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}

.btn-prev:hover {
    background: var(--gray-100);
}

.btn-next {
    background: linear-gradient(135deg, var(--primary), var(--purple));
    color: var(--white);
}

/* ---- Alerts ---- */
.alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 20px;
    animation: slideDown 0.3s ease;
}

.alert-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid #fca5a5;
}

.alert-icon {
    font-size: 18px;
}

/* ---- Badges ---- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success {
    background: var(--success-bg);
    color: var(--success);
}

.badge-warning {
    background: var(--warning-bg);
    color: #92400e;
}

.badge-danger {
    background: var(--danger-bg);
    color: var(--danger);
}

/* Highlight Text */
.highlight {
    font-weight: 700;
    color: #e63946;
    /* Red emphasis color matching the theme/logo perhaps, or just bold/distinct */
    background-color: #f1faee;
    /* Light background */
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
    border: 1px solid #e63946;
}

/* ============================
   LOGIN PAGE
   ============================ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 30%, #4338ca 60%, #7c3aed 100%);
    position: relative;
    overflow: hidden;
}

.login-bg-shapes {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.shape {
    position: absolute;
    border-radius: 50%;
    opacity: 0.08;
    background: var(--white);
}

.shape-1 {
    width: 600px;
    height: 600px;
    top: -200px;
    right: -200px;
    animation: float 20s infinite ease-in-out;
}

.shape-2 {
    width: 400px;
    height: 400px;
    bottom: -150px;
    left: -100px;
    animation: float 15s infinite ease-in-out reverse;
}

.shape-3 {
    width: 200px;
    height: 200px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: pulse 8s infinite ease-in-out;
}

.login-card {
    position: relative;
    width: 100%;
    max-width: 420px;
    margin: 20px;
    padding: 48px 40px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl), 0 0 60px rgba(79, 70, 229, 0.15);
    animation: cardEntry 0.5s ease;
}

.login-logo {
    text-align: center;
    margin-bottom: 24px;
}

.login-logo img {
    height: 80px;
    width: auto;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.login-title {
    text-align: center;
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--gray-900);
    margin-bottom: 4px;
}

.login-subtitle {
    text-align: center;
    color: var(--gray-500);
    font-size: 14px;
    margin-bottom: 28px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.label-icon {
    font-size: 16px;
}

.login-form input[type="text"],
.login-form input[type="password"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 14px;
    color: var(--gray-800);
    background: var(--white);
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}

.login-form input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.login-form input::placeholder {
    color: var(--gray-400);
}

.login-form .btn-primary {
    margin-top: 8px;
    padding: 14px;
    font-size: 15px;
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 12px;
    color: var(--gray-400);
}

/* ============================
   LMS LAYOUT
   ============================ */
.lms-container {
    display: flex;
    min-height: 100vh;
    background: var(--gray-50);
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--white);
    border-right: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow-y: auto;
    transition: transform 0.3s ease;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--gray-100);
}

.sidebar-logo {
    height: 40px;
    width: auto;
}

.sidebar-header h2 {
    font-size: 16px;
    font-weight: 700;
    color: var(--gray-900);
    flex: 1;
}

.sidebar-close {
    display: none;
    background: none;
    border: none;
    font-size: 20px;
    color: var(--gray-500);
    cursor: pointer;
}

/* Sidebar home button */
.sidebar-home-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 12px 16px 4px;
    padding: 9px 14px;
    background: var(--primary-50, #eff6ff);
    color: var(--primary, #2563eb);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s;
}

.sidebar-home-btn:hover {
    background: var(--primary-light, #dbeafe);
}

/* Progress */
.progress-section {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-100);
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
}

.progress-count {
    color: var(--primary);
}

.progress-bar {
    height: 8px;
    background: var(--gray-100);
    border-radius: 999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--purple));
    border-radius: 999px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 0;
}

/* Modules */
.sidebar-nav {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
}

.module-group {
    margin-bottom: 2px;
}

.module-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    cursor: pointer;
    transition: background var(--transition);
    user-select: none;
}

.module-header:hover {
    background: var(--gray-50);
}

.module-icon {
    font-size: 18px;
}

.module-title {
    flex: 1;
    font-size: 13px;
    font-weight: 700;
    color: var(--gray-800);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.module-arrow {
    font-size: 12px;
    color: var(--gray-400);
    transition: transform 0.2s ease;
}

.module-group.expanded .module-arrow {
    transform: rotate(90deg);
}

.module-lessons {
    display: none;
    padding: 0 0 8px 0;
}

.module-group.expanded .module-lessons {
    display: block;
}

.lesson-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px 10px 48px;
    font-size: 13px;
    color: var(--gray-600);
    transition: all var(--transition);
    position: relative;
}

.lesson-link:hover {
    background: var(--primary-50);
    color: var(--primary);
}

.lesson-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--gray-300);
    transition: all var(--transition);
    flex-shrink: 0;
}

.lesson-link.completed .lesson-dot {
    background: var(--green);
}

.lesson-link.active {
    background: var(--primary-50);
    color: var(--primary);
    font-weight: 600;
}

.lesson-link.active .lesson-dot {
    background: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

.lesson-link.locked {
    opacity: 0.5;
    pointer-events: none;
    cursor: not-allowed;
    background: var(--gray-50);
}

.lesson-link.locked:hover {
    background: var(--gray-50);
    color: var(--gray-600);
}

/* Status LEDs */
.lesson-dot.pending {
    background-color: #3b82f6;
    /* Blue */
    box-shadow: 0 0 8px #3b82f6;
}

.lesson-dot.completed {
    background-color: #22c55e;
    /* Green */
    box-shadow: 0 0 8px #22c55e;
}

.lesson-dot.failed {
    background-color: #ef4444;
    /* Red */
    box-shadow: 0 0 8px #ef4444;
}

.lesson-title {
    flex: 1;
}

.lesson-badge {
    font-size: 14px;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--gray-100);
    margin-top: auto;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--purple));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

/* Main Content */
.lms-main {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Top Bar */
.topbar {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 50;
}

.menu-btn {
    background: none;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-size: 18px;
    cursor: pointer;
}

.topbar-title {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-800);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar-home {
    font-size: 20px;
    text-decoration: none;
}

.topbar-logout {
    font-size: 20px;
}

/* Content Area */
.content-area {
    flex: 1;
    padding: 32px 40px;
    max-width: 900px;
}

.lesson-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.lesson-main-title {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--gray-900);
    line-height: 1.3;
}

.lesson-step-badge {
    padding: 6px 14px;
    background: var(--primary-50);
    color: var(--primary);
    font-size: 13px;
    font-weight: 600;
    border-radius: 999px;
    white-space: nowrap;
}

/* Video Container */
.video-container {
    position: relative;
    padding-bottom: 56.25%;
    /* 16:9 */
    height: 0;
    overflow: hidden;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    margin-bottom: 28px;
    background: var(--gray-900);
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Lesson Content */
.lesson-content {
    background: var(--white);
    padding: 32px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 28px;
    border: 1px solid var(--gray-100);
}

.lesson-content h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--primary-50);
}

.lesson-content h4 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--gray-800);
    margin: 20px 0 10px;
}

.lesson-content p {
    margin-bottom: 14px;
    color: var(--gray-700);
    line-height: 1.7;
}

.lesson-content ul {
    margin: 8px 0 16px 20px;
}

.lesson-content li {
    margin-bottom: 8px;
    color: var(--gray-700);
    line-height: 1.6;
}

.lesson-content strong {
    color: var(--gray-900);
}

/* Lesson Image */
.lesson-image {
    margin-bottom: 28px;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.lesson-image img {
    width: 100%;
    height: auto;
    max-height: 500px;
    object-fit: contain;
    transition: transform 0.4s ease;
    background-color: #f8f9fa;
    /* Light background for transparent images */
}

.lesson-image:hover img {
    transform: scale(1.01);
}

/* Navigation Bar */
.nav-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 40px;
    background: var(--white);
    border-top: 1px solid var(--gray-200);
    position: sticky;
    bottom: 0;
    z-index: 50;
}

.nav-form {
    display: inline;
}

.nav-indicator {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-500);
    padding: 6px 14px;
    background: var(--gray-100);
    border-radius: 999px;
}

/* ============================
   QUIZ
   ============================ */
.quiz-form {
    background: var(--white);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-100);
}

.quiz-question {
    padding: 24px 0;
    border-bottom: 1px solid var(--gray-100);
}

.quiz-question:last-of-type {
    border-bottom: none;
}

.question-number {
    font-size: 12px;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.question-text {
    font-size: 15px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 16px;
    line-height: 1.5;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.quiz-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    font-size: 14px;
}

.quiz-option:hover {
    border-color: var(--primary-light);
    background: var(--primary-50);
}

.quiz-option input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

.quiz-option input[type="radio"]:checked~.option-text {
    color: var(--primary);
    font-weight: 600;
}

.option-label {
    font-weight: 700;
    color: var(--primary);
    min-width: 20px;
}

.option-text {
    color: var(--gray-700);
    transition: color var(--transition);
}

.quiz-submit {
    margin-top: 24px;
    padding: 16px;
    font-size: 16px;
}

/* Quiz Result */
.quiz-result {
    text-align: center;
    padding: 48px 32px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    animation: cardEntry 0.4s ease;
}

.quiz-result-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.quiz-result h2 {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 12px;
}

.quiz-passed h2 {
    color: var(--success);
}

.quiz-failed h2 {
    color: var(--danger);
}

.quiz-score {
    font-size: 20px;
    color: var(--gray-600);
    margin-bottom: 16px;
}

.quiz-result .btn {
    margin-top: 16px;
    padding: 14px 32px;
    font-size: 16px;
}

/* ============================
   CERTIFICATE
   ============================ */
.certificate-page {
    min-height: 100vh;
    background: var(--gray-100);
    padding: 32px;
}

.certificate-actions {
    display: flex;
    justify-content: space-between;
    max-width: 800px;
    margin: 0 auto 24px;
    gap: 16px;
}

.certificate-card {
    max-width: 800px;
    margin: 0 auto;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}

.certificate-border {
    padding: 48px;
    border: 3px solid var(--gray-200);
    border-radius: var(--radius-lg);
    margin: 16px;
    position: relative;
}

.certificate-border::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    border: 3px solid transparent;
    border-image: linear-gradient(135deg, var(--primary), var(--purple), var(--orange), var(--green)) 1;
    border-radius: var(--radius-lg);
    pointer-events: none;
}

.cert-header {
    text-align: center;
    margin-bottom: 40px;
}

.cert-trophy {
    font-size: 56px;
    margin-bottom: 16px;
}

.cert-title {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--gray-900);
    letter-spacing: 3px;
    text-transform: uppercase;
}

.cert-line {
    width: 200px;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--purple), var(--orange), var(--green));
    margin: 16px auto 0;
    border-radius: 2px;
}

.cert-body {
    text-align: center;
    margin-bottom: 40px;
}

.cert-text {
    font-size: 15px;
    color: var(--gray-600);
    margin-bottom: 12px;
}

.cert-name {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
    margin: 16px 0 4px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.cert-doc {
    font-size: 14px;
    color: var(--gray-500);
    margin-bottom: 24px;
}

.cert-course {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-800);
    margin: 16px 0;
    padding: 12px 24px;
    background: var(--primary-50);
    border-radius: var(--radius-sm);
    display: inline-block;
}

.cert-footer {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 24px;
    text-align: center;
    padding-top: 32px;
    border-top: 1px solid var(--gray-200);
}

.cert-footer-col p {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 4px;
}

.cert-seal {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--green), var(--teal));
    color: var(--white);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 800;
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
}

.cert-signature-line {
    width: 120px;
    height: 2px;
    background: var(--gray-300);
    margin: 20px auto 8px;
}

.cert-subtitle {
    font-size: 11px !important;
    color: var(--gray-400) !important;
}

.cert-date {
    font-size: 16px !important;
    font-weight: 700;
    color: var(--gray-800) !important;
    margin-bottom: 0 !important;
}

.cert-number {
    text-align: center;
    margin-top: 24px;
    font-size: 12px;
    color: var(--gray-400);
    letter-spacing: 1px;
}

/* ============================
   HOME PAGE
   ============================ */
.home-page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px;
}

.home-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 36px;
    flex-wrap: wrap;
    gap: 16px;
}

.home-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.home-logo {
    height: 48px;
    width: auto;
}

.home-header h1 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--gray-900);
    margin: 0;
}

.home-subtitle {
    font-size: 14px;
    color: var(--gray-500);
    margin: 0;
}

/* Grid */
.course-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); /* Aumentado 10% (de 300px a 330px) */
    gap: 24px;
    align-items: start;
}

/* Base card */
.course-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-100);
    padding: 26px; /* Aumentado ligeramente para mantener proporción */
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: box-shadow var(--transition), transform var(--transition);
}

.course-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.course-card--active {
    border-top: 4px solid var(--primary);
}

.course-card--done {
    border-top: 4px solid var(--green);
}

.course-card--new {
    border-top: 4px solid var(--gray-300);
}

/* Card header */
.course-card-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.course-icon {
    font-size: 36px; /* Aumentado icono (~10%) */
    flex-shrink: 0;
    line-height: 1;
}

.course-card-meta {
    flex: 1;
    min-width: 0;
}

.course-name {
    display: block;
    font-size: 16px; /* Aumentado fuente título */
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1.4;
}

.course-year {
    display: block;
    font-size: 14px;
    color: var(--gray-500);
    margin-top: 2px;
    font-weight: 600;
}

/* Badges */
.course-badge {
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
    white-space: nowrap;
}

.course-badge--done {
    background: var(--success-bg);
    color: var(--success);
}

.course-badge--active {
    background: var(--primary-50);
    color: var(--primary);
}

.course-badge--pending {
    background: var(--gray-100);
    color: var(--gray-500);
}

/* Progress */
.course-progress-area {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.course-progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 13px; /* Aumentado ligeramente */
    font-weight: 600;
    color: var(--gray-600);
}

.course-progress-bar {
    height: 8px;
    background: var(--gray-100);
    border-radius: 999px;
    overflow: hidden;
}

.course-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--purple));
    border-radius: 999px;
    transition: width 0.6s ease;
}

.course-card--done .course-progress-fill {
    background: linear-gradient(90deg, var(--green), var(--teal));
}

.course-date {
    font-size: 13px;
    color: var(--gray-400);
    margin: 0;
}

/* Card actions */
.course-card-actions {
    display: flex;
    gap: 8px; /* Reducido el gap para dar más espacio a los botones */
    flex-wrap: wrap; /* Permite saltar de línea si el espacio es muy corto */
    margin-top: auto;
}

.course-card-actions .btn {
    flex: 1;
    min-width: 135px; /* Aumentado un poco el min-width */
    justify-content: center;
    padding: 8px 12px; /* Pad. ajustado para dejar margen interior visible pero pequeño */
    white-space: normal; /* Permite dos líneas si el botón es muy angosto */
    text-align: center;
    line-height: 1.2;
    font-size: 13.5px;
}

.course-card-actions .btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}


/* Card "+" Nuevo Curso */
.course-card--add {
    border: 2px dashed var(--gray-300);
    background: var(--gray-50);
    box-shadow: none;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    text-align: center;
    font-family: var(--font);
    color: var(--gray-400);
    transition: all var(--transition);
    gap: 8px;
}

.course-card--add:hover {
    border-color: var(--primary);
    background: var(--primary-50);
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.course-add-icon {
    font-size: 56px;
    font-weight: 300;
    line-height: 1;
    display: block;
}

.course-add-label {
    font-size: 16px;
    font-weight: 700;
    display: block;
}

.course-add-year {
    font-size: 13px;
    font-weight: 500;
    display: block;
}

@media (max-width: 768px) {
    .home-page {
        padding: 20px 16px;
    }

    .home-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .course-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================
   ADMIN PANEL
   ============================ */
.admin-page {
    max-width: 1440px;
    margin: 0 auto;
    padding: 32px;
}

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.admin-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.admin-logo {
    height: 48px;
    width: auto;
}

.admin-header h1 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--gray-900);
}

.admin-subtitle {
    font-size: 13px;
    color: var(--gray-500);
}

.admin-table-wrapper {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow-x: auto;
    border: 1px solid var(--gray-100);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table thead {
    background: var(--gray-50);
    border-bottom: 2px solid var(--gray-200);
}

.admin-table th {
    padding: 14px 16px;
    font-size: 12px;
    font-weight: 700;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: left;
    white-space: nowrap;
}

.admin-table td {
    padding: 14px 16px;
    font-size: 14px;
    color: var(--gray-700);
    border-bottom: 1px solid var(--gray-100);
}

.admin-table tbody tr:hover {
    background: var(--gray-50);
}

.actions-cell {
    white-space: nowrap;
}

.actions-cell > * + * {
    margin-left: 8px;
}

.text-muted {
    color: var(--gray-400);
}

.cert-link {
    color: var(--primary);
    font-weight: 600;
    transition: color var(--transition);
}

.cert-link:hover {
    color: var(--primary-dark);
}

/* Admin Form */
.form-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 32px;
    border: 1px solid var(--gray-100);
}

.admin-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.admin-form .form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.admin-form .form-group label small {
    font-weight: 400;
    color: var(--gray-400);
}

.admin-form input[type="text"],
.admin-form input[type="password"],
.admin-form input[type="email"],
.admin-form input[type="number"],
.admin-form select {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 14px;
    color: var(--gray-800);
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.admin-form input:focus,
.admin-form select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-checkboxes {
    display: flex !important;
    gap: 24px;
    margin-bottom: 24px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-700);
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 20px;
    border-top: 1px solid var(--gray-100);
}

/* ============================
   PROFILE PAGE
   ============================ */
.profile-page {
    max-width: 960px;
    margin: 0 auto;
    padding: 32px;
}

.profile-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 24px;
    align-items: start;
}

.profile-photo-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-100);
    padding: 24px 20px;
    text-align: center;
    position: sticky;
    top: 24px;
}

.profile-photo-wrapper {
    margin-bottom: 12px;
}

.profile-photo {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary-light);
    display: block;
    margin: 0 auto;
}

.profile-photo-placeholder {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--gray-100);
    border: 3px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    margin: 0 auto;
}

.profile-photo-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 4px;
}

.profile-photo-hint {
    font-size: 11px;
    color: var(--gray-400);
    margin-bottom: 16px;
}

.profile-photo-btn {
    width: 100%;
    justify-content: center;
    cursor: pointer;
}

/* Sidebar profile link */
.user-info-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
    text-decoration: none;
    transition: background var(--transition);
    margin-bottom: 0;
}

.user-info-link:hover {
    background: var(--primary-50);
    color: var(--primary);
}

.user-avatar-img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.profile-edit-icon {
    margin-left: auto;
    font-size: 14px;
    opacity: 0.6;
}

.field-disabled {
    background: var(--gray-50) !important;
    color: var(--gray-500) !important;
    cursor: not-allowed !important;
}

.field-hint {
    display: block;
    font-size: 11px;
    color: var(--gray-400);
    margin-top: 4px;
    font-weight: 400;
}

.alert-success {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid #86efac;
}

@media (max-width: 768px) {
    .profile-layout {
        grid-template-columns: 1fr;
    }

    .profile-photo-card {
        position: static;
    }
}

/* ============================
   SIDEBAR OVERLAY (Mobile)
   ============================ */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 90;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.open {
    display: block;
    opacity: 1;
}

/* ============================
   ANIMATIONS
   ============================ */
@keyframes cardEntry {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0);
    }

    50% {
        transform: translate(30px, 30px);
    }
}

@keyframes pulse {

    0%,
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.08;
    }

    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 0.04;
    }
}

/* ============================
   RESPONSIVE
   ============================ */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-close {
        display: block;
    }

    .topbar {
        display: flex;
    }

    .lms-main {
        margin-left: 0;
    }

    .content-area {
        padding: 20px 16px;
    }

    .nav-bar {
        padding: 12px 16px;
    }

    .lesson-main-title {
        font-size: 1.25rem;
    }

    .lesson-image img {
        height: 200px;
    }

    .admin-form .form-row {
        grid-template-columns: 1fr;
    }

    .form-checkboxes {
        flex-direction: column;
        gap: 12px;
    }

    .certificate-border {
        padding: 24px;
    }

    .cert-title {
        font-size: 1.25rem;
        letter-spacing: 1px;
    }

    .cert-name {
        font-size: 1.5rem;
    }

    .cert-footer {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .certificate-actions {
        flex-direction: column;
    }

    .admin-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .login-card {
        padding: 32px 24px;
    }

    .btn-nav {
        padding: 8px 16px;
        font-size: 13px;
    }
}

/* ============================
   PRINT STYLES
   ============================ */
@media print {
    @page {
        size: landscape;
        margin: 0;
    }

    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
    }

    .no-print,
    .certificate-actions,
    .nav-bar,
    .sidebar,
    .topbar,
    .sidebar-overlay {
        display: none !important;
    }

    html,
    body {
        margin: 0;
        padding: 0;
        background: white;
        width: 100%;
        height: 100%;
    }

    .certificate-page {
        padding: 0;
        margin: 0;
        background: white;
        min-height: 100vh;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .certificate-card {
        box-shadow: none;
        border-radius: 0;
        width: 100%;
        max-width: 100%;
        margin: 0;
    }

    .certificate-border {
        border: 2px solid #ccc;
        margin: 10mm;
        padding: 40px;
    }

    .certificate-border::before {
        border: 2px solid #1a365d;
    }

    .cert-trophy {
        font-size: 48px;
    }

    .cert-title {
        font-size: 1.5rem;
    }

    .cert-name {
        font-size: 1.75rem;
        color: #1a365d;
    }

    .cert-course {
        background: #eef2ff !important;
    }

    .cert-line {
        background: linear-gradient(90deg, #4f46e5, #7c3aed, #f97316, #16a34a) !important;
    }

    .cert-seal {
        background: linear-gradient(135deg, #16a34a, #14b8a6) !important;
        color: white !important;
    }

    .cert-footer {
        grid-template-columns: 1fr 1fr 1fr;
    }
}
/* ---- Admin tabs ---- */
.admin-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--gray-200);
    margin-bottom: 24px;
}

.admin-tab {
    padding: 10px 20px;
    margin-bottom: -2px;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-500);
    border-bottom: 2px solid transparent;
    border-radius: 8px 8px 0 0;
    text-decoration: none;
    transition: color var(--transition), background var(--transition);
}

.admin-tab:hover {
    color: var(--primary);
    background: var(--primary-50);
}

.admin-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.unlinked-badge {
    margin-left: 6px;
    white-space: nowrap;
}

/* ---- Companies tab ---- */
.companies-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.companies-toolbar .search-container {
    position: relative;
    flex: 1;
    max-width: 420px;
    margin-bottom: 0;
}

.companies-toolbar .search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    font-size: 16px;
    pointer-events: none;
}

.companies-toolbar .search-input {
    width: 100%;
    padding: 12px 16px 12px 40px;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-family: var(--font);
    font-size: 14px;
    color: var(--gray-700);
    background: var(--white);
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.companies-toolbar .search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.company-number {
    font-weight: 700;
    color: var(--gray-500);
    font-variant-numeric: tabular-nums;
}

.company-users-link {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}

.company-users-link:hover {
    text-decoration: underline;
}

.company-dialog {
    margin: auto;
    width: min(560px, calc(100vw - 32px));
    border: none;
    border-radius: 16px;
    padding: 0;
    box-shadow: var(--shadow-xl);
}

.company-dialog::backdrop {
    background: rgba(17, 24, 39, 0.45);
    backdrop-filter: blur(2px);
}

.company-dialog form {
    padding: 28px;
}

.company-dialog h2 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 18px;
}

.company-dialog .dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 22px;
}

.company-dialog .alert {
    margin-bottom: 16px;
}

.access-link-card {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 24px;
    padding: 16px 20px;
    margin-bottom: 20px;
    background: var(--primary-50);
    border: 1px solid var(--primary-light);
    border-radius: var(--radius);
}

.access-link-card strong {
    color: var(--gray-900);
    font-size: 14px;
}

.access-link-card p {
    margin: 2px 0 0;
    font-size: 13px;
    color: var(--gray-600);
}

.access-link-row {
    display: flex;
    gap: 8px;
    flex: 1;
    max-width: 480px;
}

.access-link-row input {
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-size: 14px;
    color: var(--gray-700);
    background: var(--white);
}

.resend-access {
    white-space: nowrap;
}

.account-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 18px;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
    cursor: pointer;
}

.account-fields {
    margin-top: 14px;
    padding: 16px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
}

.account-fields .form-row {
    margin-bottom: 12px;
    gap: 12px;
}

.account-fields .form-group {
    margin-bottom: 12px;
}

.company-dialog {
    max-height: calc(100vh - 32px);
    overflow-y: auto;
}

.company-dialog .account-fields {
    width: 100%;
}
