/* =========================================================
   Master Fade Academy - Estilos Globales Compartidos (app.css)
   ========================================================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    color: #171717;
    background: #fff;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

/* =========================================================
   NAVBAR RESPONSIVO Y MENÚS DESPLEGABLES (ESCRITORIO & MÓVIL)
   ========================================================= */

nav.main-navbar {
    width: 100%;
    min-height: 75px;
    background: #fff;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0,0,0,.03);
}

.nav-container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 25px;
    height: 75px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.logo {
    font-size: 22px;
    font-weight: 850;
    letter-spacing: -.6px;
    color: #171717;
    white-space: nowrap;
    display: flex;
    align-items: center;
    text-decoration: none;
}

.logo span {
    color: #c59b35;
}

/* Botón Desplegable Toggle (Visible en Desktop, Tablet y Móvil) */
.nav-toggle-btn {
    display: none;
    align-items: center;
    gap: 8px;
    background: #fafafa;
    border: 1px solid #e5e5e5;
    padding: 8px 14px;
    border-radius: 9px;
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 750;
    color: #333;
    font-family: inherit;
    transition: all .25s ease;
}

.nav-toggle-btn:hover,
.nav-toggle-btn.is-active {
    background: #faf4e5;
    border-color: #c59b35;
    color: #8f6a15;
}

.toggle-bars {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 17px;
    height: 13px;
}

.toggle-bars span {
    width: 100%;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
    transition: transform .25s ease, opacity .25s ease;
}

.nav-toggle-btn.is-active .toggle-bars span:nth-child(1) {
    transform: translateY(5.5px) rotate(45deg);
}
.nav-toggle-btn.is-active .toggle-bars span:nth-child(2) {
    opacity: 0;
}
.nav-toggle-btn.is-active .toggle-bars span:nth-child(3) {
    transform: translateY(-5.5px) rotate(-45deg);
}

/* Menú colapsable / Barra de navegación principal */
.nav-collapsible-menu {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 1;
    margin-left: 35px;
}

.nav-links-group {
    display: flex;
    align-items: center;
    gap: 18px;
}

.nav-actions-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-link {
    color: #555;
    font-size: 14px;
    font-weight: 650;
    transition: color .2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 8px;
}

.nav-link:hover,
.nav-link.active {
    color: #c59b35;
}

.nav-chat-link {
    color: #a47d21 !important;
    font-weight: 750 !important;
    background: #faf4e5;
    border: 1px solid #ead9ae;
    padding: 6px 12px;
    border-radius: 20px;
}

.badge-unread {
    background: #d93838;
    color: #fff;
    border-radius: 50%;
    padding: 1px 6px;
    font-size: 11px;
    font-weight: 800;
}

.nav-btn-admin {
    background: #171717;
    color: #c59b35 !important;
    border: 1.5px solid #c59b35;
    padding: 8px 15px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 850;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all .25s ease;
    text-decoration: none;
    white-space: nowrap;
}

.nav-btn-admin:hover {
    background: #c59b35;
    color: #171717 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(197, 155, 53, .25);
}

.nav-btn-login {
    font-size: 13.5px;
    font-weight: 750;
    color: #171717;
    background: #fff;
    border: 1.5px solid #171717;
    padding: 7px 18px;
    border-radius: 8px;
    transition: all .2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.nav-btn-login:hover {
    background: #171717;
    color: #c59b35 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, .15);
}

/* =========================================================
   MENÚS DESPLEGABLES (DROPDOWNS) INTERACTIVOS
   ========================================================= */
.nav-dropdown {
    position: relative;
    display: inline-block;
}

.nav-dropdown-trigger {
    background: transparent;
    border: none;
    font-family: inherit;
    font-size: 14px;
    font-weight: 650;
    color: #444;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 8px;
    transition: all .2s;
}

.nav-dropdown-trigger:hover,
.nav-dropdown.open .nav-dropdown-trigger {
    color: #c59b35;
    background: #faf8f2;
}

.dropdown-arrow {
    font-size: 11px;
    transition: transform .25s ease;
}

.nav-dropdown.open .dropdown-arrow {
    transform: rotate(180deg);
}

/* Menú flotante del desplegable en Desktop */
.nav-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 250px;
    background: #fff;
    border: 1px solid #eaeaea;
    border-radius: 14px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, .1);
    padding: 8px;
    z-index: 1050;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: all .2s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-dropdown-menu-right {
    left: auto;
    right: 0;
}

.nav-dropdown.open .nav-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

@media (min-width: 992px) {
    .nav-dropdown:hover .nav-dropdown-menu {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 600;
    color: #333;
    text-decoration: none;
    transition: background .18s, color .18s;
}

.dropdown-item:hover {
    background: #faf4e5;
    color: #8f6a15;
}

.dropdown-item .item-icon {
    font-size: 17px;
    flex-shrink: 0;
}

.dropdown-item .item-title {
    font-weight: 750;
    font-size: 13.5px;
    color: #171717;
}

.dropdown-item:hover .item-title {
    color: #8f6a15;
}

.dropdown-item .item-desc {
    font-size: 11.5px;
    color: #888;
    margin-top: 1px;
}

.dropdown-divider {
    height: 1px;
    background: #f0f0f0;
    margin: 5px 0;
}

.dropdown-user-header {
    padding: 10px 14px 6px;
}

.user-header-name {
    font-weight: 850;
    font-size: 14px;
    color: #171717;
}

.user-header-email {
    font-size: 11.5px;
    color: #888;
    word-break: break-all;
}

.item-highlight {
    color: #c59b35 !important;
    font-weight: 800 !important;
}

.item-danger {
    color: #d93838 !important;
}

.item-danger:hover {
    background: #fdf2f2 !important;
}

.user-pill-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #faf4e5;
    border: 1px solid #ead9ae;
    padding: 5px 12px 5px 6px;
    border-radius: 50px;
    cursor: pointer;
}

.user-pill-trigger:hover {
    background: #f3e8cf;
}

.nav-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #c59b35;
}

.user-name {
    font-size: 13px;
    font-weight: 800;
    color: #8f6a15;
}

.nav-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,.45);
    z-index: 998;
}
.nav-backdrop.is-visible {
    display: block;
}

/* =========================
   BOTONES GLOBALES
========================= */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 180px;
    padding: 14px 26px;
    border-radius: 10px;
    font-weight: 800;
    font-size: 14px;
    transition: .3s;
    cursor: pointer;
    border: none;
    font-family: inherit;
    text-align: center;
}

.btn-primary {
    background: #171717;
    color: #fff;
}

.btn-primary:hover {
    background: #c59b35;
    color: #fff;
    transform: translateY(-2px);
}

.btn-gold {
    background: #c59b35;
    color: #171717;
}

.btn-gold:hover {
    background: #deb448;
    transform: translateY(-2px);
}

.btn-secondary {
    background: #fff;
    color: #171717;
    border: 1px solid #ddd;
}

.btn-secondary:hover {
    border-color: #c59b35;
    color: #a47d21;
    transform: translateY(-2px);
}

.btn-block {
    width: 100%;
    display: flex;
}

.btn-sm {
    min-width: auto;
    padding: 8px 16px;
    font-size: 13px;
    border-radius: 8px;
}

/* =========================
   ALERTAS / FLASH MESSAGES
========================= */

.alert {
    padding: 14px 20px;
    border-radius: 12px;
    margin-bottom: 24px;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-success {
    background: #eef9f1;
    border: 1px solid #c2ebd0;
    color: #1b6d39;
}

.alert-danger {
    background: #fdf2f2;
    border: 1px solid #f8cdcd;
    color: #9b2121;
}

.alert-warning {
    background: #faf4e5;
    border: 1px solid #ead9ae;
    color: #8c6917;
}

.alert-info {
    background: #eef6fc;
    border: 1px solid #cce5f7;
    color: #175487;
}

/* =========================
   PÁGINAS DE AUTENTICACIÓN (LOGIN / REGISTRO)
========================= */

.auth-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px 80px;
    background: radial-gradient(circle at top, #fffdf8 0%, #fff 45%, #fafafa 100%);
}

.auth-card {
    width: 100%;
    max-width: 460px;
    background: #fff;
    padding: 45px 38px;
    border-radius: 22px;
    border: 1px solid #eee;
    box-shadow: 0 18px 50px rgba(0,0,0,.08);
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.5px;
    color: #a47d21;
    background: #faf4e5;
    border: 1px solid #ead9ae;
    padding: 6px 14px;
    border-radius: 50px;
    margin-bottom: 16px;
    text-transform: uppercase;
}

.auth-header h1 {
    font-size: 28px;
    font-weight: 850;
    letter-spacing: -1px;
    margin-bottom: 8px;
}

.auth-header p {
    color: #777;
    font-size: 14px;
}

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

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: #333;
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    padding: 13px 16px;
    border: 1.5px solid #e2e2e2;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    color: #171717;
    background: #fafafa;
    transition: .3s;
    outline: none;
}

.form-control:focus {
    border-color: #c59b35;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(197,155,53,.15);
}

.form-footer {
    text-align: center;
    margin-top: 25px;
    padding-top: 22px;
    border-top: 1px solid #f0f0f0;
    font-size: 13px;
    color: #666;
}

.form-footer a {
    color: #c59b35;
    font-weight: 700;
}

.form-footer a:hover {
    text-decoration: underline;
}

/* =========================
   PERFIL DE USUARIO & CURSOS COMPRADOS
========================= */

.profile-container {
    max-width: 1200px;
    margin: 40px auto 80px;
    padding: 0 20px;
    width: 100%;
    flex: 1;
}

/* Banner de Cabecera del Estudiante */
.profile-header-card {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 24px;
    padding: 40px;
    box-shadow: 0 15px 40px rgba(0,0,0,.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 30px;
    margin-bottom: 40px;
    position: relative;
    overflow: hidden;
}

.profile-header-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: linear-gradient(90deg, #c59b35, #e2ba4f);
}

.profile-identity {
    display: flex;
    align-items: center;
    gap: 28px;
}

.avatar-upload-wrapper {
    position: relative;
    width: 120px;
    height: 120px;
    flex-shrink: 0;
}

.profile-avatar-img {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #c59b35;
    box-shadow: 0 10px 25px rgba(0,0,0,.12);
    background: #f5f5f5;
    display: block;
}

.avatar-edit-btn {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 36px;
    height: 36px;
    background: #171717;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    cursor: pointer;
    transition: .3s;
    font-size: 16px;
}

.avatar-edit-btn:hover {
    background: #c59b35;
    transform: scale(1.1);
}

.profile-info h1 {
    font-size: 28px;
    font-weight: 850;
    letter-spacing: -.5px;
    margin-bottom: 6px;
}

.profile-email {
    color: #777;
    font-size: 14px;
    margin-bottom: 12px;
}

.student-tag {
    display: inline-block;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1px;
    color: #a47d21;
    background: #faf4e5;
    border: 1px solid #ead9ae;
    padding: 5px 12px;
    border-radius: 50px;
    text-transform: uppercase;
}

.profile-stats {
    display: flex;
    gap: 25px;
}

.stat-item {
    text-align: center;
    background: #fafafa;
    border: 1px solid #eee;
    padding: 16px 24px;
    border-radius: 16px;
    min-width: 120px;
}

.stat-number {
    font-size: 28px;
    font-weight: 900;
    color: #c59b35;
    line-height: 1;
}

.stat-label {
    font-size: 12px;
    font-weight: 700;
    color: #666;
    text-transform: uppercase;
    margin-top: 6px;
}

/* Pestañas de navegación en el perfil */
.profile-nav-tabs {
    display: flex;
    gap: 15px;
    border-bottom: 2px solid #eee;
    margin-bottom: 35px;
}

.tab-btn {
    padding: 14px 22px;
    font-size: 15px;
    font-weight: 750;
    color: #777;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    transition: .3s;
    font-family: inherit;
    margin-bottom: -2px;
}

.tab-btn:hover {
    color: #171717;
}

.tab-btn.active {
    color: #c59b35;
    border-bottom-color: #c59b35;
}

/* Grid de Cursos Comprados */
.my-courses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 28px;
    margin-bottom: 50px;
}

.my-course-card {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,.06);
    transition: .3s;
    display: flex;
    flex-direction: column;
}

.my-course-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 18px 45px rgba(0,0,0,.12);
}

.course-thumb-box {
    position: relative;
    height: 180px;
    background: #171717;
    overflow: hidden;
}

.course-thumb-box img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: .4s;
    background: #f7f7f7;
}

.my-course-card:hover .course-thumb-box img {
    transform: scale(1.04);
}

.course-status-badge {
    position: absolute;
    top: 14px;
    right: 14px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .5px;
    background: #171717;
    color: #c59b35;
    padding: 5px 12px;
    border-radius: 50px;
    border: 1px solid rgba(197,155,53,.3);
}

.course-body {
    padding: 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.course-body h3 {
    font-size: 19px;
    font-weight: 800;
    line-height: 1.3;
    margin-bottom: 10px;
}

.course-body p {
    color: #666;
    font-size: 13.5px;
    margin-bottom: 18px;
    flex: 1;
}

.course-meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 700;
    color: #888;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid #f0f0f0;
}

/* Barra de progreso */
.progress-container {
    margin-bottom: 18px;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 6px;
    color: #555;
}

.progress-bar-bg {
    width: 100%;
    height: 8px;
    background: #eee;
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #c59b35, #e2ba4f);
    border-radius: 10px;
    transition: width .6s ease;
}

/* Estado Vacío de Cursos */
.empty-courses-card {
    background: #fafafa;
    border: 2px dashed #ddd;
    border-radius: 20px;
    padding: 60px 30px;
    text-align: center;
    margin: 20px 0 40px;
}

.empty-courses-card .empty-icon {
    font-size: 48px;
    color: #c59b35;
    margin-bottom: 16px;
}

.empty-courses-card h3 {
    font-size: 22px;
    margin-bottom: 10px;
    font-weight: 800;
}

.empty-courses-card p {
    color: #777;
    max-width: 480px;
    margin: 0 auto 25px;
    font-size: 15px;
}

/* Formulario de Perfil */
.profile-edit-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.profile-card-section {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 20px;
    padding: 35px 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,.04);
}

.profile-card-section h3 {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 6px;
}

.profile-card-section .section-subtitle {
    font-size: 13px;
    color: #777;
    margin-bottom: 24px;
}

/* Modal o Formulario de Subida de Avatar */
.avatar-modal-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.avatar-modal-backdrop.open {
    display: flex;
}

.avatar-modal-card {
    background: #fff;
    max-width: 440px;
    width: 100%;
    border-radius: 20px;
    padding: 35px 30px;
    box-shadow: 0 25px 60px rgba(0,0,0,.3);
    position: relative;
}

.modal-close-btn {
    position: absolute;
    top: 18px;
    right: 20px;
    background: transparent;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: #888;
}

.avatar-preview-area {
    width: 130px;
    height: 130px;
    margin: 20px auto 25px;
    border-radius: 50%;
    overflow: hidden;
    border: 4px solid #c59b35;
    background: #f0f0f0;
}

.avatar-preview-area img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* =========================
   FOOTER
========================= */

footer {
    margin-top: auto;
    padding: 35px 7%;
    background: #111;
    color: #888;
    text-align: center;
    font-size: 13px;
}

footer strong {
    color: #fff;
}

/* =========================
   RESPONSIVO
========================= */

/* =========================================================
   RESPONSIVO: TABLET Y MÓVILES (< 992px)
   ========================================================= */

@media (max-width: 991px) {
    nav.main-navbar {
        min-height: 70px;
    }

    .nav-container {
        padding: 0 18px;
        height: 70px;
    }

    .nav-toggle-btn {
        display: inline-flex;
    }

    .nav-collapsible-menu {
        display: none;
        position: absolute;
        top: 70px;
        left: 0;
        right: 0;
        background: #fff;
        border-bottom: 2px solid #c59b35;
        box-shadow: 0 20px 45px rgba(0, 0, 0, .14);
        padding: 20px 22px 26px;
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
        margin-left: 0;
        max-height: calc(100vh - 75px);
        overflow-y: auto;
    }

    .nav-collapsible-menu.menu-open {
        display: flex;
        animation: navSlideDown .25s ease forwards;
    }

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

    .nav-links-group,
    .nav-actions-group {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        gap: 8px;
    }

    .nav-dropdown {
        width: 100%;
    }

    .nav-dropdown-trigger {
        width: 100%;
        justify-content: space-between;
        background: #fafafa;
        border: 1px solid #eee;
        padding: 12px 16px;
        border-radius: 10px;
    }

    .nav-dropdown-menu {
        position: static;
        box-shadow: none;
        border: 1px solid #f0f0f0;
        background: #fbfbfb;
        margin-top: 6px;
        transform: none !important;
        opacity: 1 !important;
        visibility: visible !important;
        display: none;
    }

    .nav-dropdown.open .nav-dropdown-menu {
        display: flex;
    }

    .nav-btn-admin,
    .nav-btn-login,
    .nav-btn-register {
        width: 100%;
        text-align: center;
        justify-content: center;
        padding: 12px;
    }

    .profile-header-card {
        flex-direction: column;
        text-align: center;
        padding: 30px 20px;
    }

    .profile-identity {
        flex-direction: column;
        gap: 18px;
    }

    .profile-stats {
        width: 100%;
        justify-content: center;
    }

    .profile-edit-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 550px) {
    .auth-card {
        padding: 35px 22px;
    }

    .stat-item {
        min-width: 90px;
        padding: 12px 14px;
    }

    .stat-number {
        font-size: 22px;
    }
}
