/* --- CSS Variables & Theme --- */
:root {
    --primary: #252525;
    --primary-hover: #3a3a3a;
    --primary-light: #F5F5F5;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --bg-main: #F3F4F6;
    /* Light gray background */
    --bg-surface: #FFFFFF;
    /* Pure white surface */
    --bg-surface-hover: #F9FAFB;
    /* Slightly off-white for hover */

    --text-primary: #111827;
    /* Near black text */
    --text-secondary: #4B5563;
    /* Medium gray */
    --text-muted: #9CA3AF;
    /* Light gray */

    --border-color: #E5E7EB;
    /* Subtle light borders */

    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

    --transition: all 0.2s ease-in-out;
}

/* --- Dark Mode Variables --- */
[data-theme="dark"] {
    --primary: #D4D4D8;
    --primary-hover: #F4F4F5;
    --primary-light: #1E2028;
    --bg-main: #0F1015;
    --bg-surface: #17181E;
    --bg-surface-hover: #1E2028;
    --text-primary: #EDEDEF;
    --text-secondary: #8B95A8;
    --text-muted: #4E5668;
    --border-color: #252830;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.6), 0 4px 6px -2px rgba(0, 0, 0, 0.4);
}

/* Dark mode: elements with hardcoded colors or needing text color flip
   (primary in dark mode is light gray — elements using it as bg need dark text) */
[data-theme="dark"] a {
    color: var(--text-primary);
}

[data-theme="dark"] a:hover {
    color: var(--primary-hover);
}

[data-theme="dark"] .btn-primary {
    color: #0F1015;
}

[data-theme="dark"] .nav-item.active {
    color: var(--text-primary);
}

[data-theme="dark"] .chat-user-item.active {
    color: var(--text-primary);
}

[data-theme="dark"] .phase-rule-badge {
    color: var(--text-primary);
}

[data-theme="dark"] .msg-sent {
    color: #0F1015;
}

[data-theme="dark"] .avatar {
    color: #0F1015;
}

[data-theme="dark"] .task-comment-indicator .comment-count {
    color: #0F1015;
}

[data-theme="dark"] .mentee-taskview-item.active {
    color: #0F1015;
}

[data-theme="dark"] .mentee-taskview-item.active .checkbox-custom {
    border-color: rgba(0, 0, 0, 0.35);
    color: rgba(0, 0, 0, 0.65);
}

[data-theme="dark"] .floating-toolbar {
    background: #22252F;
}

[data-theme="dark"] .floating-toolbar .toolbar-select option {
    background: #22252F;
    color: var(--text-primary);
}

[data-theme="dark"] .toast {
    background: #22252F;
    color: var(--text-primary);
}

[data-theme="dark"] input:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] textarea:focus {
    box-shadow: 0 0 0 2px rgba(212, 212, 216, 0.25);
}

[data-theme="dark"] .video-progress-track {
    background: var(--border-color);
}

/* Theme toggle icon state */
.btn-theme-toggle .icon-sun {
    display: none;
}

.btn-theme-toggle .icon-moon {
    display: inline-flex;
}

[data-theme="dark"] .btn-theme-toggle .icon-sun {
    display: inline-flex;
}

[data-theme="dark"] .btn-theme-toggle .icon-moon {
    display: none;
}

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

body {
    font-family: 'DM Sans', sans-serif;
    font-weight: 300;
    background-color: var(--bg-main);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    height: 100vh;
    overflow: hidden;
}

/* Typography */
b,
strong {
    font-weight: 500;
}

h1,
h2,
h3,
h4 {
    color: var(--text-primary);
    font-weight: 600;
}

a {
    color: #000000;
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-hover);
}

/* --- Utility Classes --- */
.view {
    display: none;
    height: 100vh;
    width: 100vw;
}

.view.active {
    display: flex;
}

.mb-4 {
    margin-bottom: 1rem;
}

.hidden {
    display: none !important;
}

/* --- Buttons & Inputs --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

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

.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background-color: var(--bg-surface);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--bg-surface-hover);
    color: var(--text-primary);
}

.btn-block {
    width: 100%;
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background-color: var(--bg-surface-hover);
    color: var(--text-primary);
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.input-icon {
    position: relative;
}

.input-icon i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.input-icon input {
    padding-left: 2.75rem;
}

input[type="email"],
input[type="password"],
input[type="text"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 0.625rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-family: inherit;
    transition: var(--transition);
    outline: none;
    background-color: var(--bg-surface);
    color: var(--text-primary);
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* --- Login View --- */
.login-wrapper {
    display: flex;
    width: 100%;
    height: 100%;
}

.login-card {
    width: 100%;
    max-width: 480px;
    margin: auto;
    padding: 3rem;
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 10;
}

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

.login-header .logo {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1rem;
}

.login-header .community-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-bottom: 1.25rem;
}

/* login logo: wide and centered */
.login-header .community-brand img {
    width: 240px;
    max-width: 100%;
    height: auto;
    display: block;
}

/* login name without logo: large prominent text */
.login-header .community-brand span {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    text-align: center;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

.login-hint {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 0.75rem;
    background: var(--bg-main);
    border-radius: var(--radius-sm);
}

.login-decoration {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
    pointer-events: none;
}

.blob {
    position: absolute;
    filter: blur(80px);
    opacity: 0.15;
    border-radius: 50%;
}

.shape-1 {
    top: -10%;
    right: -5%;
    width: 500px;
    height: 500px;
    background: linear-gradient(135deg, var(--primary), #8B5CF6);
}

.shape-2 {
    bottom: -10%;
    left: -10%;
    width: 600px;
    height: 600px;
    background: linear-gradient(135deg, #10B981, #3B82F6);
}

/* --- Dashboard Layout --- */
.sidebar {
    width: 260px;
    background: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.sidebar .logo {
    height: 70px;
    display: flex;
    align-items: center;
    padding: 0 1rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    gap: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.community-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    overflow: hidden;
}

/* sidebar logo: scales proportionally, max 220px wide, max 60px tall, centered */
.community-brand img {
    max-width: 220px;
    max-height: 60px;
    width: auto;
    height: auto;
    display: block;
    margin: 0 auto;
}

/* sidebar name without logo: larger readable text */
.community-brand span {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-nav {
    flex: 1;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    overflow-y: auto;
}

.sidebar-nav-fixed {
    flex: 0 0 auto;
    padding: 1.5rem 1rem 0 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.875rem;
}

.nav-item i {
    font-size: 1.25rem;
}

.nav-item:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--primary-light);
    color: #000000;
}

.nav-item.locked {
    opacity: 0.6;
    background: transparent;
    cursor: not-allowed;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
}

.user-info .details {
    display: flex;
    flex-direction: column;
}

.user-info .name {
    font-size: 0.875rem;
    font-weight: 600;
}

.user-info .role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* Super Admin / shared layout: content panel next to sidebar */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    min-width: 0;
}

.scrollable-area {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}


.topbar {
    height: 70px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
}

.topbar h2 {
    font-size: 1.25rem;
}

/* ── Notifications dropdown ─────────────────────────────────────────────── */
.mentee-notif-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.15s;
    position: relative;
}
.mentee-notif-item:last-child { border-bottom: none; }
.mentee-notif-item:hover { background: var(--bg-hover, rgba(0,0,0,0.04)); }
.mentee-notif-item--read { opacity: 0.55; }

.mentee-notif-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--primary) 12%, transparent);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.mentee-notif-body { flex: 1; min-width: 0; }
.mentee-notif-title { font-size: 0.8rem; color: var(--text-primary); line-height: 1.4; margin-bottom: 0.2rem; }
.mentee-notif-preview { font-size: 0.75rem; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 0.2rem; }
.mentee-notif-time { font-size: 0.7rem; color: var(--text-muted); }

.mentee-notif-dot {
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    margin-top: 4px;
}

.scroll-area {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
}

/* --- Admin Views --- */
.admin-section {
    display: none;
}

.admin-section.active {
    display: block;
}

/* Phase Cards */
.phase-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.phase-card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    background: var(--bg-surface-hover);
}

.phase-card-title h3 {
    margin-bottom: 0.25rem;
}

.phase-card-title p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.phase-rule-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: var(--primary-light);
    color: #000000;
    font-size: 0.75rem;
    border-radius: 4px;
    margin-top: 0.5rem;
    font-weight: 500;
}

.task-list {
    padding: 1rem 1.5rem;
}

.task-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    background: var(--bg-main);
}

.task-item:last-child {
    margin-bottom: 0;
}

/* Mentee Progress Cards */
.user-progress-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-progress-info h4 {
    margin-bottom: 0.5rem;
}

.user-progress-stats {
    display: flex;
    gap: 1.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.progress-bar-container {
    width: 200px;
}

/* --- Mentee Views --- */
.phase-container {
    max-width: 800px;
    margin: 0 auto;
}

/* Phase banner (full-bleed within scroll-area) */
.phase-banner-wrapper {
    margin: -2rem -2rem 0 -2rem;
}

.phase-banner {
    width: 100%;
    aspect-ratio: 6 / 1;
    object-fit: cover;
    display: block;
}

/* Inner container when banner is present — re-applies the max-width centering */
.phase-inner-container {
    max-width: 800px;
    margin: 0 auto;
}

/* Phase hero card overlapping the banner */
.phase-hero--with-banner {
    margin-top: -2.5rem;
    position: relative;
    z-index: 1;
}

.phase-hero {
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.phase-hero h1 {
    font-size: 1.75rem;
    margin-bottom: 0.75rem;
}

.phase-hero p {
    color: var(--text-secondary);
    line-height: 1.6;
}

.progress-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.progress-track {
    height: 8px;
    background: var(--bg-main);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--success);
    width: 0%;
    transition: width 0.5s ease-in-out;
}

.mentee-task-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.mentee-task-item {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: var(--transition);
}

.task-comment-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    color: var(--text-muted);
    font-size: 0.85rem;
    flex-shrink: 0;
}

.task-comment-indicator .comment-count {
    background: var(--primary);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.mentee-task-item:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.mentee-task-item.completed {
    opacity: 0.8;
    background: var(--bg-main);
}

.mentee-task-item.completed .task-text {
    text-decoration: line-through;
    color: var(--text-muted);
}

.checkbox-custom {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: transparent;
    transition: var(--transition);
    flex-shrink: 0;
}

.mentee-task-item.completed .checkbox-custom {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.locked-state {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    border: 1px dashed var(--border-color);
}

.locked-state i {
    font-size: 4rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

/* --- Modals --- */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 40;
    display: none;
}

.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    width: 90%;
    max-width: 720px;
    height: calc(100vh - 100px);
    background: var(--bg-surface);
    border-radius: 0;
    box-shadow: var(--shadow-lg);
    z-index: 50;
    display: none;
    flex-direction: column;
    opacity: 0;
    transition: all 0.2s ease-in-out;
}

.modal.show {
    display: flex;
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.modal-backdrop.show {
    display: block;
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.modal-body {
    padding: 1.5rem;
    flex: 1;
    overflow-y: auto;
}

.p-0 {
    padding: 0 !important;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
    position: sticky;
    bottom: -1.5rem;
    background: var(--bg-surface);
    padding-bottom: 1.5rem;
    margin-bottom: -1.5rem;
    z-index: 10;
}

.settings-group {
    background: var(--bg-main);
    padding: 1rem;
    border-radius: var(--radius-sm);
    margin-top: 1rem;
}

.settings-group h4 {
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: var(--text-primary);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transform: translateY(100%);
    opacity: 0;
    animation: toast-in 0.3s forwards;
}

.toast.success {
    border-left: 4px solid var(--success);
}

.toast.error {
    border-left: 4px solid var(--danger);
}

@keyframes toast-in {
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* ── Mentee Inline Task View ─────────────────────────────────────────────── */
#view-mentee .scroll-area {
    background: var(--bg-surface);
}

#mentee-task-view {
    margin: -2rem;
}

.mentee-task-view-layout {
    display: flex;
    align-items: flex-start;
    min-height: 100vh;
    position: relative;
}

.mentee-task-view-main {
    flex: 1;
    min-width: 0;
    display: flex;
    justify-content: center;
    padding: 2rem;
    margin-left: 84px;
}

.mentee-task-view-content {
    width: 100%;
    max-width: 720px;
}

.mentee-task-view-sidebar {
    width: 84px;
    flex-shrink: 0;
    background: var(--primary-light);
    border-right: 1px solid var(--border-color);
    overflow: hidden;
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 10;
    transition: width 0.25s ease;
    cursor: pointer;
    overflow-y: auto;
}

/* ── Task view: sidebar fixed (scroll happens inside the content column) ───── */
#view-mentee .scroll-area:has(#mentee-task-view.active) {
    overflow: hidden;
    padding: 0;
}

#view-mentee .scroll-area:has(#mentee-task-view.active) #mentee-task-view {
    margin: 0;
    height: 100%;
}

#view-mentee .scroll-area:has(#mentee-task-view.active) .mentee-task-view-layout {
    height: 100%;
    min-height: 0;
}

#view-mentee .scroll-area:has(#mentee-task-view.active) .mentee-task-view-main {
    overflow-y: auto;
    height: 100%;
}

#view-mentee .scroll-area:has(#mentee-task-view.active) .mentee-task-view-sidebar {
    position: absolute;
    height: 100%;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
}

.mentee-task-view-sidebar:hover {
    width: min(252px, 35%);
    box-shadow: 4px 0 16px rgba(0,0,0,0.08);
}

/* Header: collapsed shows short label, expanded shows full label */
.mentee-task-view-sidebar-title {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 1.5rem 16px 20px;
    white-space: nowrap;
    overflow: hidden;
}

.mentee-task-view-sidebar-title .title-short {
    display: block;
}

.mentee-task-view-sidebar-title .title-full {
    display: none;
}

.mentee-task-view-sidebar:hover .mentee-task-view-sidebar-title .title-short {
    display: none;
}

.mentee-task-view-sidebar:hover .mentee-task-view-sidebar-title .title-full {
    display: block;
}

#mentee-task-view-tasklist {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 0 16px;
}

.mentee-taskview-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    cursor: pointer;
    font-size: 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    transition: background 0.15s;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
}

.mentee-taskview-item:hover {
    background: var(--bg-surface-hover);
}

.mentee-taskview-item.active {
    background: var(--primary);
    font-weight: 600;
    border-color: var(--primary);
    color: white;
}

.mentee-taskview-item.active .checkbox-custom {
    border-color: rgba(255, 255, 255, 0.4);
    color: rgba(255, 255, 255, 0.8);
}

.mentee-taskview-item .checkbox-custom {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-shrink: 0;
    font-weight: 600;
}

.mentee-taskview-item.completed .checkbox-custom {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

/* Task label hidden when retracted, shown on hover */
.mentee-taskview-item .task-label {
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0;
    transition: opacity 0.15s ease 0.1s;
}

.mentee-task-view-sidebar:hover .mentee-taskview-item .task-label {
    opacity: 1;
}


@media (max-width: 768px) {
    .mentee-task-view-layout {
        flex-direction: column;
    }

    .mentee-task-view-main {
        padding: 1rem;
    }

    .mentee-task-view-sidebar {
        width: 100%;
        position: static;
        border-left: none;
        border-top: 1px solid var(--border-color);
    }

    .mentee-task-view-sidebar:hover {
        width: 100%;
    }
}

@keyframes spin-pulse {
    0% {
        transform: rotate(0deg);
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }

    100% {
        transform: rotate(360deg);
        opacity: 1;
    }
}

/* Custom Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    margin: 0;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--danger);
    transition: 0.3s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked+.toggle-slider {
    background-color: var(--success);
}

.toggle-switch input:checked+.toggle-slider:before {
    transform: translateX(20px);
}

/* --- Badges --- */
.badge {
    background: var(--danger);
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    padding: 0.15rem 0.4rem;
    border-radius: 12px;
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
}

/* --- Chat System --- */
.msg-bubble {
    max-width: 85%;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    position: relative;
    word-wrap: break-word;
    font-size: 0.875rem;
}

.msg-sent {
    background: var(--primary);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.msg-received {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    border: 1px solid var(--border-color);
}

.msg-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    margin-bottom: 0.25rem;
    gap: 1rem;
    opacity: 0.8;
}

.msg-task-link {
    display: inline-block;
    margin-bottom: 0.5rem;
    font-size: 0.75rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: underline;
    opacity: 0.9;
}

.msg-task-link:hover {
    color: inherit;
    opacity: 1;
}

.chat-user-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
}

.chat-user-item:hover {
    background: var(--bg-surface-hover);
}

.chat-user-item.active {
    background: var(--primary-light);
    color: #000000;
}

.chat-user-item-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.chat-user-item-name {
    font-weight: 600;
    font-size: 0.875rem;
}

.chat-user-item-preview {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

/* Responsive */
@media (max-width: 768px) {
    .view {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .sidebar-nav {
        flex-direction: row;
        overflow-x: auto;
        padding: 1rem;
    }

    .nav-item {
        white-space: nowrap;
    }

    .sidebar-footer {
        display: none;
    }

    .topbar {
        padding: 0 1rem;
    }

    .scroll-area {
        padding: 1rem;
    }
}

/* --- Quill Content Fixes --- */
.modal-quill-content ul,
.modal-quill-content ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.modal-quill-content li {
    margin-bottom: 0.25rem;
}

.modal-quill-content p:last-child,
.modal-quill-content ul:last-child,
.modal-quill-content ol:last-child {
    margin-bottom: 0;
}

.modal-quill-content a {
    color: var(--primary);
    text-decoration: underline;
}

/* --- Task Editor (Notion-like) --- */
.modal-editor {
    max-width: 1100px !important;
}

.task-editor-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
    height: 100%;
}

.task-editor-sidebar {
    width: 200px;
    background: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    padding: 1rem 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    overflow-y: auto;
}

.draggable-sidebar-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    cursor: grab;
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: background 0.2s;
}

.draggable-sidebar-item:hover {
    background: var(--bg-surface-hover);
}

.draggable-sidebar-item i {
    font-size: 1.125rem;
    color: var(--text-secondary);
}

.task-editor-main {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    background: var(--bg-surface);
}

.editor-canvas {
    width: 100%;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding-bottom: 4rem;
}

.editor-empty-state {
    color: var(--text-muted);
    padding: 3rem 2rem;
    text-align: center;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    max-width: 720px;
    width: 100%;
    margin: 0;
    font-size: 0.95rem;
    background: transparent;
}

.editor-block-wrapper {
    position: relative;
    width: 100%;
    max-width: 720px;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.editor-drag-handle {
    position: absolute;
    left: -2rem;
    top: 50%;
    transform: translateY(-50%);
    cursor: grab;
    opacity: 0;
    color: var(--text-muted);
    font-size: 1.25rem;
    transition: opacity 0.2s;
    user-select: none;
    line-height: 1;
    padding: 0.25rem;
    border-radius: 4px;
}

.editor-drag-handle:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

.editor-block-wrapper:hover .editor-drag-handle {
    opacity: 1;
}

.editor-block-content {
    flex: 1;
    min-height: 1.5rem;
    outline: none;
    padding: 0.25rem 0;
    word-break: break-word;
    width: 100%;
}

.editor-block-content[contenteditable="true"]:empty:before {
    content: attr(data-placeholder);
    color: var(--text-muted);
    pointer-events: none;
    display: block;
}

/* Video Progress UI */
.video-progress-area {
    width: 100%;
    padding: 2rem;
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0.5rem;
}

.video-progress-text {
    font-size: 0.95rem;
    color: var(--text-primary);
    font-weight: 500;
}

.video-progress-subtext {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.video-progress-track {
    width: 100%;
    max-width: 400px;
    height: 6px;
    background: #E5E7EB;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.video-progress-fill {
    height: 100%;
    background: #10B981;
    /* Default emerald green */
    width: 0%;
    transition: width 0.2s ease;
}

/* Floating Toolbar */
.floating-toolbar {
    position: absolute;
    z-index: 1000;
    background: var(--text-primary);
    color: white;
    padding: 0.25rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.25rem;
    transition: opacity 0.2s, transform 0.2s;
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px) translateX(-50%);
}

.floating-toolbar.active {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) translateX(-50%);
}

.floating-toolbar button {
    background: transparent;
    border: none;
    color: white;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.floating-toolbar button:hover,
.floating-toolbar .color-picker-label:hover {
    background: rgba(255, 255, 255, 0.1);
}

.floating-toolbar button.active {
    background: var(--primary);
    color: #fff;
}

.floating-toolbar .divider {
    width: 1px;
    height: 20px;
    background: rgba(255, 255, 255, 0.2);
    margin: 0 0.25rem;
}

.floating-toolbar .color-picker-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    position: relative;
    color: white;
    transition: background 0.2s;
}

.floating-toolbar .color-picker-label input[type="color"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    left: 0;
    top: 0;
    cursor: pointer;
}

.floating-toolbar .toolbar-select {
    background: transparent;
    color: white;
    border: none;
    appearance: none;
    -webkit-appearance: none;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
}

.floating-toolbar .toolbar-select:hover {
    background: rgba(255, 255, 255, 0.1);
}

.floating-toolbar .toolbar-select option {
    background: var(--bg-surface);
    color: var(--text-primary);
}

/* Styles for specific blocks */
.block-divider {
    border: 0;
    border-top: 1px solid var(--border-color);
    margin: 1rem 0;
    width: 100%;
}

.block-upload-area {
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    text-align: center;
    background: var(--bg-surface);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    cursor: pointer;
}

.block-upload-area:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.block-upload-area i {
    font-size: 2rem;
    color: var(--text-muted);
}

.block-media {
    max-width: 100%;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    overflow: hidden;
    display: block;
}

.block-file {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: inherit;
    width: 100%;
}

.block-file i {
    font-size: 1.5rem;
    color: var(--primary);
}

.block-file:hover {
    border-color: var(--primary);
}

/* Drop Indicator */
.drop-indicator {
    height: 4px;
    background: var(--primary);
    border-radius: 2px;
    margin: 0.25rem 0;
    display: none;
}

.drop-indicator.active {
    display: block;
}

/* --- Multi-Tenant Account Selector --- */
.tenant-card {
    display: flex;
    flex-direction: column;
    padding: 1.25rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    position: relative;
    overflow: hidden;
}

.tenant-card:hover {
    border-color: var(--primary);
    background: var(--bg-surface-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.tenant-card h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.tenant-card .tenant-role {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.tenant-card .tenant-arrow {
    position: absolute;
    right: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    transition: transform 0.2s ease, color 0.2s ease;
}

.tenant-card:hover .tenant-arrow {
    transform: translateY(-50%) translateX(4px);
    color: var(--primary);
}

/* ── Task comments redesign ────────────────────────────────────────────────── */
.task-comments-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.task-comments-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.task-comments-privacy {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    color: var(--text-muted);
    background: var(--bg-surface-hover);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 0.25rem 0.65rem;
    white-space: nowrap;
}

.task-comments-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    min-height: 60px;
}

.task-comment {
    display: flex;
    gap: 0.875rem;
    align-items: flex-start;
    position: relative;
}

.task-comment-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 600;
    overflow: hidden;
    user-select: none;
}

.task-comment-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.task-comment-body {
    flex: 1;
    min-width: 0;
    position: relative;
}

.task-comment-meta {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 0.3rem;
    flex-wrap: wrap;
}

.task-comment-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.task-comment-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.task-comment-badge {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 1px 5px;
    border-radius: 4px;
    background: var(--primary);
    color: #fff;
    opacity: 0.85;
    vertical-align: middle;
    line-height: 1.6;
}

/* Admin chat context pill */
.admin-chat-context-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: var(--bg-app);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 3px 10px 3px 8px;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.admin-chat-context-pill:hover {
    border-color: var(--primary);
    color: var(--primary);
}
.admin-chat-context-pill.active {
    border-color: var(--primary);
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 8%, transparent);
}

/* Context dropdown items */
.admin-chat-context-dropdown-phase {
    padding: 0.5rem 0.75rem 0.25rem;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.admin-chat-context-dropdown-task {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem 0.5rem 1.25rem;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.1s;
    border-radius: 4px;
    margin: 0 0.25rem;
    color: var(--text-primary);
}
.admin-chat-context-dropdown-task:hover {
    background: var(--bg-surface);
}
.admin-chat-context-dropdown-task.selected {
    color: var(--primary);
    font-weight: 600;
}
.admin-chat-context-dropdown-task.selected::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary);
    flex-shrink: 0;
}

/* Per-task group reply button */
.chat-group-reply-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0.5rem 0 0.25rem 0;
    padding: 0.35rem 0.875rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #fff;
    background: var(--primary);
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: opacity 0.15s;
}
.chat-group-reply-btn:hover { opacity: 0.85; }

/* Chat filter select */
.admin-chat-filter-select {
    font-size: 0.8rem;
    padding: 0.3rem 0.6rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-app);
    color: var(--text-primary);
    cursor: pointer;
    outline: none;
    max-width: 200px;
}
.admin-chat-filter-select:focus {
    border-color: var(--primary);
}

/* Reply quoted block — appears above the message text */
.chat-reply-block {
    display: flex;
    flex-direction: column;
    border-left: 3px solid var(--primary);
    border-radius: 0 6px 6px 0;
    background: color-mix(in srgb, var(--primary) 8%, transparent);
    padding: 0.35rem 0.65rem;
    margin-bottom: 0.4rem;
    overflow: hidden;
}
.chat-reply-block-sender {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.1rem;
}
.chat-reply-block-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Reply preview in the input area */
.chat-reply-preview {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-left: 3px solid var(--primary);
    border-radius: 0 6px 6px 0;
    background: color-mix(in srgb, var(--primary) 8%, transparent);
    padding: 0.35rem 0.5rem 0.35rem 0.65rem;
    margin-bottom: 0.5rem;
}
.chat-reply-preview-content {
    flex: 1;
    min-width: 0;
}
.chat-reply-preview-sender {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.1rem;
}
.chat-reply-preview-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.task-comment-text {
    font-size: 0.875rem;
    color: var(--text-primary);
    line-height: 1.55;
    word-break: break-word;
    white-space: pre-wrap;
}

.task-comment-file {
    margin-top: 0.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-surface-hover);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm, 6px);
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    text-decoration: none;
    color: var(--text-primary);
}

.task-comment-file:hover {
    background: var(--bg-surface);
}

/* Inline reply button — always visible, low opacity, on all messages */
.task-comment-reply-btn {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    opacity: 0.2;
    transition: opacity 0.15s;
    margin-top: 2px;
    padding: 0 2px;
}
.task-comment:hover .task-comment-reply-btn {
    opacity: 1;
}

.task-comment-actions {
    display: none;
    gap: 0.25rem;
    position: absolute;
    right: 0;
    top: 0;
}

.task-comment:hover .task-comment-actions {
    display: flex;
}

.task-comment-actions .btn-icon {
    padding: 3px 6px;
    height: auto;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.task-comment-actions .btn-icon:hover {
    color: var(--text-primary);
}

.task-comment-actions .btn-del {
    color: var(--danger) !important;
}

/* Input area */
.task-comments-form {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.task-comments-input-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.35rem 0.5rem 0.35rem 0.25rem;
    transition: border-color 0.15s;
}

.task-comments-input-row:focus-within {
    border-color: var(--primary);
}

.task-comments-attach-btn {
    color: var(--text-muted);
    flex-shrink: 0;
}

.task-comments-input {
    flex: 1;
    border: none !important;
    outline: none !important;
    background: transparent !important;
    padding: 0.3rem 0.25rem !important;
    font-size: 0.875rem;
    box-shadow: none !important;
}

.task-comments-send-btn {
    color: var(--primary);
    flex-shrink: 0;
}