/**
 * Área de Membros — NUPROF
 * Tema claro, foco em consumo de conteúdo (videoaulas).
 * Reutiliza paleta terracota do admin.
 */

:root {
    --primary: #D97757;
    --primary-hover: #C4674A;
    --dark: #1A1A17;
    --dark-soft: #33332C;
    --bg: #F5F2EA;
    --surface: #FFFFFF;
    --surface-alt: #FAF8F1;
    --border: #E4DFD1;
    --text: #1A1A17;
    --text-muted: #6B6B62;
    --success: #2E8B57;
    --success-bg: #E6F2EA;
    --error: #C0392B;
    --error-bg: #F9E5E2;
    --radius: 12px;
    --radius-sm: 8px;
    --font-heading: 'Crimson Pro', Georgia, serif;
    --font-body: 'Inter', -apple-system, sans-serif;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 6px 20px rgba(0,0,0,0.06);
}

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

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { font-family: var(--font-heading); color: var(--dark); line-height: 1.25; }
h1 { font-size: 2rem; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.05rem; }

/* ===== TOP BAR ===== */
.members-topbar {
    background: var(--dark);
    color: #fff;
    padding: 0.9rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(217, 119, 87, 0.25);
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.45);
    position: relative;
    z-index: 10;
}
.members-topbar .brand {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 700;
    color: #fff;
}
.members-topbar .brand small {
    font-family: var(--font-body);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.55);
    display: block;
    margin-top: -2px;
}
.members-topbar .user-area { display: flex; align-items: center; gap: 1rem; font-size: 0.9rem; }
.members-topbar .user-area a { color: rgba(255,255,255,0.8); }
.members-topbar .user-area a:hover { color: #fff; }

/* ===== LAYOUT ===== */
.members-main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 1.5rem 3rem;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}
.page-header h2 { margin-bottom: 0.25rem; }
.page-header .muted { color: var(--text-muted); font-size: 0.9rem; }

.breadcrumb {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--primary); }

/* ===== FLASH ===== */
.flash-message {
    padding: 0.9rem 1.1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.25rem;
    font-size: 0.92rem;
}
.flash-success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(46,139,87,0.25); }
.flash-error { background: var(--error-bg); color: var(--error); border: 1px solid rgba(192,57,43,0.25); }

/* ===== LOGIN / FORMS CENTERED ===== */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    background: var(--bg);
}
.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2.25rem;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-md);
}
.auth-card h1 {
    font-size: 1.8rem;
    margin-bottom: 0.25rem;
    text-align: center;
}
.auth-card .subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.75rem;
}

.form-group { margin-bottom: 1.1rem; }
.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 0.35rem;
}
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"] {
    width: 100%;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.95rem;
    background: var(--surface);
    color: var(--text);
    transition: border-color 0.15s;
}
.form-group input:focus {
    outline: none;
    border-color: var(--primary);
}
.form-help { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.25rem; }

/* ===== PASSWORD FIELD COM TOGGLE DE VISIBILIDADE ===== */
.password-field {
    position: relative;
    display: flex;
    align-items: center;
}
.password-field input[type="password"],
.password-field input[type="text"] {
    width: 100%;
    padding-right: 2.8rem;
}
.password-toggle {
    position: absolute;
    right: 0.6rem;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    padding: 0.35rem 0.5rem;
    font-size: 1.05rem;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
    border-radius: 6px;
    transition: background 0.1s, color 0.1s;
}
.password-toggle:hover {
    background: var(--surface-alt);
    color: var(--primary);
}
.password-toggle.active {
    color: var(--primary);
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-block;
    padding: 0.75rem 1.25rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, transform 0.05s;
    text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); text-decoration: none; }
.btn-secondary { background: var(--surface); color: var(--dark); border-color: var(--border); }
.btn-secondary:hover { background: var(--surface-alt); text-decoration: none; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #266f47; text-decoration: none; }
.btn-block { display: block; width: 100%; text-align: center; }
.btn-sm { padding: 0.5rem 0.85rem; font-size: 0.82rem; }

/* ===== COURSE CARDS ===== */
.course-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}
.course-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    transition: transform 0.15s, box-shadow 0.15s;
    display: flex;
    flex-direction: column;
}
.course-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.course-card__video {
    position: relative;
    width: calc(100% + 2.5rem);
    margin: -1.25rem -1.25rem 1rem -1.25rem;
    padding-top: 56.25%;
    overflow: hidden;
    border-radius: var(--radius) var(--radius) 0 0;
    background: var(--dark);
}
.course-card__video iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}
.course-card h3 { margin-bottom: 0.5rem; }
.course-card .description {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    flex-grow: 1;
}
.course-card .progress-area {
    margin-bottom: 1rem;
}
.course-card .btn { margin-top: auto; }

.course-card--locked {
    opacity: 0.7;
    border-style: dashed;
    position: relative;
}
.course-card--locked:hover {
    opacity: 0.85;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: 100px;
    overflow: hidden;
    margin-bottom: 0.35rem;
}
.progress-bar .fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s;
}
.progress-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
}

.empty-state {
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    padding: 3rem 2rem;
    text-align: center;
    color: var(--text-muted);
}

/* ===== COURSE DETAIL (modules/lessons) ===== */
.course-header {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.75rem;
    margin-bottom: 1.5rem;
}
.course-header h2 { margin-bottom: 0.5rem; }
.course-header .description {
    color: var(--text-muted);
    margin-bottom: 1rem;
}
.course-header .certificate-cta {
    margin-top: 1rem;
}

.module-block {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 1rem;
    overflow: hidden;
}
.module-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface-alt);
}
.module-header h3 { font-size: 1.15rem; margin-bottom: 0.15rem; }
.module-header .muted { font-size: 0.8rem; color: var(--text-muted); }

.lesson-list { list-style: none; }
.lesson-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.9rem 1.25rem;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: var(--text);
    transition: background 0.1s;
}
.lesson-item:last-child { border-bottom: none; }
.lesson-item:hover { background: var(--surface-alt); text-decoration: none; }
.lesson-item .check {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--border);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: transparent;
}
.lesson-item.completed .check {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}
.lesson-item .title-area { flex-grow: 1; }
.lesson-item .lesson-title { font-weight: 500; }
.lesson-item .provider {
    font-size: 0.72rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

/* ===== LESSON PLAYER ===== */
.video-wrapper {
    position: relative;
    padding-bottom: 56.25%;
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 1.25rem;
}
.video-wrapper iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border: 0;
}

.lesson-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

.lesson-description {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-top: 1.25rem;
    color: var(--text-muted);
}

/* ===== LESSON LAYOUT (Udemy-style) ===== */
.members-main--full {
    max-width: none;
    margin: 0;
    padding: 0;
}

.lesson-layout {
    display: grid;
    grid-template-columns: 1fr 360px;
    min-height: calc(100vh - 64px);
    background: #26241E;
}

.lesson-main {
    background: #26241E;
    color: #fff;
    overflow-y: auto;
}
.lesson-main-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem 2rem 3rem;
}
.lesson-main .breadcrumb,
.lesson-main .breadcrumb a {
    color: rgba(255,255,255,0.55);
}
.lesson-main .breadcrumb a:hover { color: var(--primary); }

.lesson-title {
    color: #fff;
    font-size: 1.7rem;
    margin: 0.4rem 0 0.2rem;
}
.lesson-module-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.5);
    margin-bottom: 1rem;
}

.lesson-main .video-wrapper {
    margin-bottom: 1.5rem;
    border-radius: var(--radius);
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

.lesson-main .lesson-actions {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 1.25rem;
    align-items: center;
}
.lesson-status-done,
.lesson-status-pending {
    flex-grow: 1;
    text-align: center;
    font-size: 0.88rem;
    padding: 0.6rem 0.9rem;
    border-radius: var(--radius-sm);
}
.lesson-status-done {
    background: rgba(46,139,87,0.18);
    color: #6fd49a;
    border: 1px solid rgba(46,139,87,0.35);
    font-weight: 600;
}
.lesson-status-pending {
    background: rgba(255,255,255,0.05);
    color: rgba(255,255,255,0.55);
    border: 1px dashed rgba(255,255,255,0.18);
}
.lesson-main .btn-secondary {
    background: rgba(255,255,255,0.08);
    color: #fff;
    border-color: rgba(255,255,255,0.15);
}
.lesson-main .btn-secondary:hover {
    background: rgba(255,255,255,0.14);
}

.lesson-main .lesson-description {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.78);
}
.lesson-main .lesson-description h3 {
    color: #fff;
    font-size: 1.05rem;
    margin-bottom: 0.6rem;
}

/* ===== BOTÃO WHATSAPP INSTRUTOR ===== */
.lesson-whatsapp {
    margin-top: 1.5rem;
}
.btn-whatsapp {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1.25rem;
    background: #25D366;
    color: #fff;
    font-weight: 600;
    font-size: 0.92rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: background 0.2s, transform 0.15s;
    width: 100%;
    justify-content: center;
}
.btn-whatsapp:hover {
    background: #1EBE57;
    transform: translateY(-1px);
}

/* ===== MATERIAIS DE APOIO ===== */
.lesson-materials {
    background: rgba(217, 119, 87, 0.08);
    border: 1px solid rgba(217, 119, 87, 0.25);
    border-radius: var(--radius);
    padding: 1.25rem 1.4rem;
    margin-top: 1.25rem;
}
.lesson-materials h3 {
    color: #fff;
    font-size: 1.1rem;
    margin-bottom: 0.2rem;
    display: flex;
    align-items: center;
    gap: 0.45rem;
}
.lesson-materials h3::before {
    content: '\1F4CE'; /* 📎 */
    font-size: 1.05rem;
}
.lesson-materials .materials-hint {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
    margin-bottom: 0.85rem;
}
.materials-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}
.materials-list li {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    padding: 0.7rem 0.9rem;
    transition: background 0.15s, border-color 0.15s;
}
.materials-list li:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(217, 119, 87, 0.45);
}
.materials-list .mat-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    line-height: 1;
}
.materials-list .mat-info {
    flex-grow: 1;
    min-width: 0;
}
.materials-list .mat-name {
    color: #fff;
    font-weight: 500;
    font-size: 0.92rem;
    word-break: break-word;
    line-height: 1.35;
}
.materials-list .mat-size {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.76rem;
    margin-top: 0.15rem;
}
.materials-list .btn {
    flex-shrink: 0;
}

/* ===== SIDEBAR DO CURRÍCULO ===== */
.curriculum-sidebar {
    background: var(--surface);
    border-left: 1px solid var(--border);
    overflow-y: auto;
    max-height: calc(100vh - 64px);
    position: sticky;
    top: 0;
}

.curriculum-header {
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface-alt);
    position: sticky;
    top: 0;
    z-index: 2;
}
.curriculum-header h3 {
    font-size: 1.1rem;
    margin-bottom: 0.85rem;
}
.curriculum-progress .progress-bar {
    height: 6px;
    margin-bottom: 0.3rem;
}

.curriculum-modules {
    padding: 0.5rem 0;
}

.curriculum-module {
    border-bottom: 1px solid var(--border);
}
.curriculum-module > summary {
    list-style: none;
    cursor: pointer;
    padding: 0.85rem 1.25rem;
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    user-select: none;
    font-weight: 600;
    color: var(--dark);
    font-size: 0.92rem;
    transition: background 0.1s;
}
.curriculum-module > summary::-webkit-details-marker { display: none; }
.curriculum-module > summary::before {
    content: '\25B8';
    color: var(--text-muted);
    font-size: 0.7rem;
    transition: transform 0.2s;
    margin-right: 0.35rem;
}
.curriculum-module[open] > summary::before {
    transform: rotate(90deg);
}
.curriculum-module > summary:hover {
    background: var(--surface-alt);
}
.curriculum-module .mod-title {
    flex-grow: 1;
}
.curriculum-module .mod-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.curriculum-lessons {
    list-style: none;
    background: var(--surface-alt);
}
.curr-lesson a {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.7rem 1.25rem 0.7rem 2.1rem;
    color: var(--text);
    font-size: 0.85rem;
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: background 0.1s;
}
.curr-lesson a:hover {
    background: var(--surface);
    text-decoration: none;
}
.curr-lesson .check {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1.5px solid var(--border);
    background: var(--surface);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    color: transparent;
}
.curr-lesson.done .check {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}
.curr-lesson .text {
    flex-grow: 1;
    line-height: 1.35;
}
.curr-lesson.current a {
    background: var(--surface);
    border-left-color: var(--primary);
    font-weight: 600;
    color: var(--primary);
}
.curr-lesson.done a {
    color: var(--text-muted);
}
.curr-lesson.current.done a {
    color: var(--primary);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 960px) {
    .lesson-layout {
        grid-template-columns: 1fr;
    }
    .curriculum-sidebar {
        position: static;
        max-height: none;
        border-left: none;
        border-top: 1px solid var(--border);
    }
    .lesson-main-inner {
        padding: 1.25rem 1rem 2rem;
    }
}

@media (max-width: 640px) {
    .members-main { padding: 1.25rem 1rem 2rem; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .auth-card { padding: 1.5rem; }
    .lesson-title { font-size: 1.35rem; }
}
