:root {
    --primary: #C0392B;
    --primary-dark: #96281B;
    --primary-light: #E74C3C;
    --dark: #1a1a2e;
    --dark-alt: #16213e;
    --sidebar-width: 260px;
    --header-height: 64px;
}

/* ======= BASE ======= */
* { box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #f4f6f9;
    color: #333;
}

a { text-decoration: none; }
a:hover { text-decoration: none; }

/* ======= LOGIN PAGE ======= */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--dark) 0%, var(--primary-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-box {
    background: #fff;
    border-radius: 16px;
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo img {
    max-height: 80px;
}

.login-logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-top: 0.5rem;
    line-height: 1.2;
}

.login-logo span {
    font-size: 0.85rem;
    color: #666;
    font-weight: 400;
}

/* ======= ADMIN LAYOUT ======= */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.admin-sidebar {
    width: var(--sidebar-width);
    background: var(--dark);
    color: #fff;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.sidebar-brand {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    background: var(--dark-alt);
}

.sidebar-brand h5 {
    color: var(--primary-light);
    font-weight: 700;
    font-size: 0.95rem;
    margin: 0;
    line-height: 1.3;
}

.sidebar-brand small {
    color: rgba(255,255,255,0.4);
    font-size: 0.72rem;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
}

.sidebar-section {
    padding: 0.5rem 1.5rem 0.25rem;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255,255,255,0.3);
    margin-top: 0.5rem;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1.5rem;
    color: rgba(255,255,255,0.7);
    font-size: 0.875rem;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    color: #fff;
    background: rgba(255,255,255,0.06);
    border-left-color: var(--primary-light);
}

.sidebar-nav a i {
    width: 18px;
    text-align: center;
    font-size: 1rem;
    color: rgba(255,255,255,0.5);
}

.sidebar-nav a.active i,
.sidebar-nav a:hover i {
    color: var(--primary-light);
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.08);
    font-size: 0.8rem;
    color: rgba(255,255,255,0.4);
}

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

.admin-topbar {
    height: var(--header-height);
    background: #fff;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 1rem;
}

.admin-topbar .page-title {
    font-weight: 600;
    font-size: 1.05rem;
    color: #333;
    flex: 1;
}

.admin-content {
    padding: 1.75rem;
    flex: 1;
}

/* Stats cards */
.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid #f0f0f0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.08);
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    margin-bottom: 1rem;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #1a1a2e;
    line-height: 1;
}

.stat-card .stat-label {
    color: #888;
    font-size: 0.82rem;
    margin-top: 0.25rem;
}

/* Cards */
.card {
    border: 1px solid #f0f0f0;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.card-header {
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
    padding: 1rem 1.25rem;
    border-radius: 12px 12px 0 0 !important;
}

/* Course grid */
.course-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #f0f0f0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    transition: transform 0.2s, box-shadow 0.2s;
}

.course-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.course-card .course-thumb {
    width: 100%;
    height: 160px;
    object-fit: cover;
    background: linear-gradient(135deg, var(--dark), var(--primary-dark));
}

.course-card .course-thumb-placeholder {
    width: 100%;
    height: 160px;
    background: linear-gradient(135deg, var(--dark), var(--primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.3);
    font-size: 2.5rem;
}

.course-card .course-body {
    padding: 1.25rem;
}

/* Status badges */
.badge-published { background: #d4edda; color: #155724; }
.badge-draft { background: #fff3cd; color: #856404; }

/* Module accordion */
.module-item {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    overflow: hidden;
}

.module-header {
    padding: 0.875rem 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: #f8f9fa;
    transition: background 0.2s;
}

.module-header:hover { background: #f0f2f5; }

.lesson-item {
    padding: 0.625rem 1rem 0.625rem 2.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-top: 1px solid #f0f0f0;
    font-size: 0.875rem;
}

.lesson-item:hover { background: #fafafa; }

/* ======= MEMBER LAYOUT ======= */
.member-layout {
    min-height: 100vh;
    background: #f4f6f9;
}

.member-navbar {
    background: var(--dark);
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1000;
    gap: 1rem;
}

.member-navbar .brand {
    color: var(--primary-light);
    font-weight: 700;
    font-size: 1.05rem;
}

.member-navbar .nav-links {
    display: flex;
    gap: 0.25rem;
    flex: 1;
    margin-left: 1.5rem;
}

.member-navbar .nav-links a {
    color: rgba(255,255,255,0.7);
    padding: 0.4rem 0.875rem;
    border-radius: 6px;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.member-navbar .nav-links a:hover,
.member-navbar .nav-links a.active {
    color: #fff;
    background: rgba(255,255,255,0.1);
}

.member-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* Lesson player */
.lesson-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 1.5rem;
    min-height: calc(100vh - var(--header-height));
    padding: 0;
}

.lesson-player-area {
    background: #000;
    flex: 1;
}

.lesson-sidebar {
    background: #fff;
    border-left: 1px solid #e9ecef;
    overflow-y: auto;
    height: calc(100vh - var(--header-height));
    position: sticky;
    top: var(--header-height);
}

.video-container {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    background: #000;
}

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

/* Progress bar */
.progress-bar-custom {
    height: 6px;
    background: #e9ecef;
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar-custom .fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: 3px;
    transition: width 0.5s ease;
}

/* Lesson list in sidebar */
.lesson-list-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f5f5f5;
    cursor: pointer;
    transition: background 0.15s;
    font-size: 0.85rem;
}

.lesson-list-item:hover { background: #f8f9fa; }

.lesson-list-item.active { background: #fff5f5; border-left: 3px solid var(--primary); }

.lesson-list-item .check {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.65rem;
}

.lesson-list-item.done .check {
    background: #28a745;
    border-color: #28a745;
    color: #fff;
}

/* Course progress card */
.course-progress-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #f0f0f0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.course-progress-card .course-thumb {
    width: 100%;
    height: 140px;
    object-fit: cover;
    background: linear-gradient(135deg, var(--dark), var(--primary-dark));
}

/* Buttons */
.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    color: #fff;
}

.btn-outline-primary {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-outline-primary:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* Tables */
.table th {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #888;
    border-bottom: 2px solid #f0f0f0;
}

.table td {
    vertical-align: middle;
    font-size: 0.875rem;
}

/* Forms */
.form-label {
    font-weight: 500;
    font-size: 0.875rem;
    color: #555;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 0.2rem rgba(192,57,43,0.15);
}

/* Drag handle */
.drag-handle {
    cursor: grab;
    color: #ccc;
    padding: 0 0.25rem;
}

.drag-handle:active { cursor: grabbing; }

/* Responsive */
@media (max-width: 768px) {
    .admin-sidebar { transform: translateX(-100%); }
    .admin-sidebar.open { transform: translateX(0); }
    .admin-main { margin-left: 0; }
    .lesson-layout { grid-template-columns: 1fr; }
    .lesson-sidebar { display: none; }
    .member-navbar .nav-links { display: none; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #ddd; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #bbb; }

/* ======= COMENTÁRIOS ======= */
.comment-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
    text-transform: uppercase;
}
.comment-avatar.admin { background: var(--dark); }
.comment-avatar.sm { width: 28px; height: 28px; font-size: 0.75rem; }

.comment-bubble {
    background: #f8f9fa;
    border-radius: 0 10px 10px 10px;
    padding: 0.6rem 0.875rem;
    border: 1px solid #e9ecef;
}
.comment-bubble.reply {
    background: #fff;
    border-color: #dee2e6;
}
