/* ============================================================
   Eaton EDU Client Portal Styles
   ============================================================ */

:root {
    /* Brand Colors (from Eaton EDU) */
    --color-bg: #FDFEFE;
    --color-pink: #F4ADCE;
    --color-purple: #9473A7;
    --color-purple-dark: #341D40;
    --color-teal: #3C9893;
    --color-teal-light: #6DC7B7;
    --color-teal-lighter: #88DED0;
    --color-yellow: #FAB64D;
    --color-orange: #E56119;
    --color-red: #AA0309;

    /* UI Colors */
    --color-text: #1a1a2e;
    --color-text-light: #4a4a5a;
    --color-text-muted: #7a7a8a;
    --color-border: #e5e5e5;
    --color-border-light: #f0f0f0;

    /* Semantic */
    --color-primary: var(--color-teal);
    --color-primary-hover: #2d7a75;

    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;

    /* Sizing */
    --sidebar-width: 280px;
    --header-height: 64px;

    /* Borders */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* ============================================================
   Reset & Base
   ============================================================ */

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

html, body {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--color-text);
    background: var(--color-bg);
}

/* ============================================================
   Buttons
   ============================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s ease;
}

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

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

.btn-secondary {
    background: var(--color-border-light);
    color: var(--color-text);
}

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

.btn-sm {
    padding: var(--space-2) var(--space-3);
    font-size: 0.875rem;
}

.btn-icon {
    background: none;
    border: none;
    padding: var(--space-2);
    cursor: pointer;
    color: var(--color-text-light);
    border-radius: var(--radius-sm);
}

.btn-icon:hover {
    background: var(--color-border-light);
}

/* ============================================================
   Login Page
   ============================================================ */

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #e8faf7 0%, #f0f4ff 100%);
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: var(--space-4);
}

.login-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.login-header {
    background: var(--color-purple-dark);
    color: white;
    padding: var(--space-8) var(--space-6);
    text-align: center;
}

.login-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: var(--space-1);
}

.login-logo {
    max-width: 200px;
    height: auto;
    margin-bottom: var(--space-2);
}

.login-subtitle {
    font-size: 1rem;
    opacity: 0.9;
}

.login-body {
    padding: var(--space-6);
    text-align: center;
}

.login-description {
    color: var(--color-text-light);
    margin-bottom: var(--space-6);
}

.btn-login {
    width: 100%;
    padding: var(--space-4) var(--space-6);
    font-size: 1.1rem;
}

.login-note {
    margin-top: var(--space-4);
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

.login-error {
    background: #fef2f2;
    color: var(--color-red);
    padding: var(--space-4);
    text-align: center;
    border-top: 1px solid #fecaca;
}

.login-footer {
    text-align: center;
    padding: var(--space-4);
    color: var(--color-text-muted);
    font-size: 0.875rem;
}

/* ============================================================
   Dashboard Layout
   ============================================================ */

.dashboard-page {
    height: 100vh;
    overflow: hidden;
}

.dashboard-layout {
    display: flex;
    height: 100%;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--color-purple-dark);
    color: white;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow-y: auto;
}

.sidebar-logo {
    padding: var(--space-4);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: center;
}

.sidebar-logo img {
    max-width: 160px;
    height: auto;
}

.sidebar-section {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-section:last-child {
    border-bottom: none;
}

.sidebar-section-header {
    padding: var(--space-3) var(--space-4);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.5);
}

.sidebar-header {
    padding: var(--space-4) var(--space-4);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h2 {
    font-size: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.7);
}

.channel-list {
    padding: var(--space-1) 0;
}

.sidebar-nav {
    padding: var(--space-1) 0;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-4);
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    transition: background 0.15s ease;
    font-size: 0.9rem;
}

.sidebar-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.sidebar-item.active {
    background: var(--color-primary);
}

.sidebar-item-highlight {
    background: rgba(255, 193, 7, 0.15);
    border-left: 3px solid #ffc107;
    padding-left: calc(var(--space-4) - 3px);
}

.sidebar-item-highlight:hover {
    background: rgba(255, 193, 7, 0.25);
}

.sidebar-item-highlight.active {
    background: rgba(255, 193, 7, 0.3);
}

.badge {
    background: var(--color-red);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: auto;
    min-width: 18px;
    text-align: center;
    display: none;
}

.sidebar-icon {
    font-size: 1rem;
}

.channel-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s ease;
}

.channel-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.channel-item.active {
    background: var(--color-primary);
}

.channel-icon {
    font-size: 1.25rem;
}

.channel-name {
    flex: 1;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Course List (in sidebar) */
.course-list {
    padding: var(--space-2) 0;
}

.course-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s ease;
}

.course-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

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

.course-icon {
    font-size: 1.1rem;
}

.course-name {
    flex: 1;
    font-weight: 500;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Sidebar expand icon */
.sidebar-expand-icon {
    font-size: 0.7rem;
    margin-left: auto;
    transition: transform 0.2s ease;
}

.sidebar-expand-icon.expanded {
    transform: rotate(90deg);
}

/* Doc Page List (in sidebar) */
.doc-page-list {
    padding: var(--space-1) 0;
    padding-left: var(--space-4);
}

.doc-page-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s ease;
    font-size: 0.85rem;
}

.doc-page-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.doc-page-item.active {
    background: var(--color-primary);
}

.doc-page-icon {
    font-size: 1rem;
}

.doc-page-name {
    flex: 1;
    font-weight: 500;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Doc Page Content */
.doc-page-content {
    line-height: 1.7;
    color: var(--color-text);
    max-width: 800px;
    padding: var(--space-4);
}

.doc-page-content h1 {
    font-size: 1.75rem;
    margin-bottom: var(--space-4);
}

.doc-page-content h2 {
    font-size: 1.4rem;
    margin-top: var(--space-5);
    margin-bottom: var(--space-3);
}

.doc-page-content h3 {
    font-size: 1.15rem;
    margin-top: var(--space-4);
    margin-bottom: var(--space-2);
}

.doc-page-content p {
    margin-bottom: var(--space-3);
}

.doc-page-content ul,
.doc-page-content ol {
    margin-bottom: var(--space-3);
    padding-left: var(--space-5);
}

.doc-page-content li {
    margin-bottom: var(--space-2);
}

.doc-page-content blockquote {
    border-left: 3px solid var(--color-teal);
    margin: var(--space-3) 0;
    padding-left: var(--space-4);
    color: var(--color-text-muted);
}

.doc-page-content pre {
    background: var(--color-bg-dark);
    padding: var(--space-3);
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin: var(--space-3) 0;
}

.doc-page-content code {
    background: var(--color-border-light);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-size: 0.85em;
}

.doc-page-content pre code {
    background: none;
    padding: 0;
}

.doc-page-content hr {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: var(--space-4) 0;
}

.doc-page-content a {
    color: var(--color-teal);
    text-decoration: none;
}

.doc-page-content a:hover {
    text-decoration: underline;
}

.doc-page-content img {
    max-width: 100%;
    border-radius: var(--radius-md);
    margin: var(--space-3) 0;
}

.doc-page-content table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--space-3) 0;
}

.doc-page-content th,
.doc-page-content td {
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--color-border);
    text-align: left;
}

.doc-page-content th {
    background: var(--color-border-light);
    font-weight: 600;
}

/* Video embeds in doc content */
.doc-page-content iframe {
    max-width: 100%;
    margin: var(--space-4) 0;
    border-radius: var(--radius-md);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Header */
.dashboard-header {
    height: var(--header-height);
    padding: 0 var(--space-4);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--color-border);
    background: white;
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.sidebar-toggle {
    display: none;
}

.channel-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-text);
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.user-name {
    font-weight: 500;
    color: var(--color-text-light);
}

/* View As Dropdown (admin only) */
.view-as-dropdown {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--color-bg-alt);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
}

.view-as-dropdown label {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    white-space: nowrap;
}

.view-as-dropdown select {
    font-size: 0.875rem;
    padding: var(--space-1) var(--space-2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: white;
    color: var(--color-text);
    max-width: 200px;
    cursor: pointer;
}

.view-as-dropdown select:focus {
    outline: none;
    border-color: var(--color-teal);
}

/* Messages Container */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-4);
    background: #fafafa;
}

.no-channel-selected {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--color-text-muted);
}

.message {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-3);
    margin-bottom: var(--space-2);
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--color-teal-lighter);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--color-purple-dark);
    flex-shrink: 0;
}

.message-avatar img {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-full);
    object-fit: cover;
}

.message-content {
    flex: 1;
    min-width: 0;
}

.message-header {
    display: flex;
    align-items: baseline;
    gap: var(--space-2);
    margin-bottom: var(--space-1);
}

.message-author {
    font-weight: 600;
    color: var(--color-text);
}

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

.reply-btn {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    margin-left: auto;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.reply-btn:hover {
    color: var(--color-teal);
}

.message:hover .reply-btn {
    opacity: 1;
}

.reply-indicator {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-2) var(--space-3);
    background: var(--color-background-alt);
    border-bottom: 1px solid var(--color-border);
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

.reply-indicator strong {
    color: var(--color-text);
}

.reply-cancel {
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: var(--space-1);
    font-size: 1rem;
    line-height: 1;
}

.reply-cancel:hover {
    color: var(--color-text);
}

.message-text {
    color: var(--color-text-light);
    word-wrap: break-word;
}

.message-text a {
    color: var(--color-teal);
    text-decoration: none;
}

.message-text a:hover {
    text-decoration: underline;
}

.message-text p {
    margin: 0 0 var(--space-2) 0;
}

.message-text p:last-child {
    margin-bottom: 0;
}

.message-list {
    margin: var(--space-2) 0;
    padding-left: var(--space-5);
    list-style: disc;
}

.message-list li {
    margin-bottom: var(--space-1);
}

.attachment-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-2);
    background: var(--color-border-light);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}

.attachment-link:hover {
    background: var(--color-border);
    text-decoration: none !important;
}

.video-link {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
}

.image-link {
    background: linear-gradient(135deg, #f3e5f5 0%, #e1bee7 100%);
}

.mention {
    color: var(--color-purple);
    font-weight: 500;
    background: rgba(148, 115, 167, 0.1);
    padding: 0 var(--space-1);
    border-radius: var(--radius-sm);
}

.message-table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--space-2) 0;
    font-size: 0.9rem;
}

.message-table th,
.message-table td {
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--color-border);
    text-align: left;
}

.message-table th {
    background: var(--color-border-light);
    font-weight: 600;
    color: var(--color-text);
}

.message-table tr:nth-child(even) td {
    background: rgba(0, 0, 0, 0.02);
}

/* ClickUp Table Embeds */
.clickup-table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--space-3) 0;
    font-size: 0.9rem;
}

.clickup-table th,
.clickup-table td {
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--color-border);
    text-align: left;
}

.clickup-table th {
    background: var(--color-teal-lighter);
    font-weight: 600;
    color: var(--color-text);
}

.clickup-table tr:nth-child(even) td {
    background: rgba(0, 0, 0, 0.02);
}

/* Reply Threads */
.message-replies {
    margin-left: 52px; /* Avatar width + gap */
    margin-top: var(--space-2);
    padding-left: var(--space-4);
    border-left: 2px solid var(--color-teal-lighter);
}

.message.reply {
    background: var(--color-border-light);
    margin-bottom: var(--space-1);
    padding: var(--space-2);
}

.message-avatar.small {
    width: 28px;
    height: 28px;
    font-size: 0.7rem;
}

/* Message Input */
.message-input-container {
    padding: var(--space-4);
    background: white;
    border-top: 1px solid var(--color-border);
}

.message-form {
    display: flex;
    gap: var(--space-2);
}

.message-input {
    flex: 1;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: inherit;
    line-height: 1.5;
    outline: none;
    transition: border-color 0.15s ease;
    resize: none;
    min-height: 44px;
    max-height: 120px;
    overflow-y: auto;
}

.message-input:focus {
    border-color: var(--color-primary);
}

.btn-send {
    padding: var(--space-3);
    align-self: flex-end;
}

/* Task Cards */
.task-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.task-card {
    background: white;
    border-radius: var(--radius-md);
    padding: var(--space-4);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: box-shadow 0.15s ease;
}

.task-card:hover {
    box-shadow: var(--shadow-md);
}

.task-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-2);
}

.task-name {
    font-weight: 500;
    color: var(--color-text);
    flex: 1;
}

.task-status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}

.task-meta {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.task-due {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.task-due.overdue {
    color: var(--color-red);
}

/* Subtasks */
.task-subtasks {
    margin-left: 24px;
    margin-top: var(--space-1);
    padding-left: var(--space-4);
    border-left: 2px solid var(--color-teal-lighter);
}

.task-card.subtask {
    background: var(--color-border-light);
    margin-bottom: var(--space-1);
    padding: var(--space-2) var(--space-3);
}

.task-card.subtask .task-card-header {
    margin-bottom: 0;
}

.task-card.subtask .task-name {
    font-size: 0.9rem;
}

.task-card.subtask .task-status {
    font-size: 0.7rem;
}

/* Doc List */
.doc-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.doc-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: box-shadow 0.15s ease;
}

.doc-item:hover {
    box-shadow: var(--shadow-md);
}

.doc-icon {
    font-size: 1.5rem;
}

.doc-info {
    flex: 1;
    min-width: 0;
}

.doc-name {
    font-weight: 500;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.doc-updated {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

/* Loading */
.loading-spinner {
    padding: var(--space-4);
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
}

/* ============================================================
   Modal
   ============================================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
}

.modal {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--color-border);
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-text);
    line-height: 1.3;
}

.modal-close {
    flex-shrink: 0;
    color: var(--color-text-muted);
}

.modal-close:hover {
    color: var(--color-text);
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-5) var(--space-6);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--color-border);
    background: var(--color-border-light);
}

/* Ticket Form */
.ticket-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    padding: var(--space-5) var(--space-6);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.form-group label {
    font-weight: 500;
    color: var(--color-text);
    font-size: 0.95rem;
}

.form-row {
    display: flex;
    gap: var(--space-4);
}

.form-group-half {
    flex: 1;
}

.form-group input,
.form-group textarea,
.form-group select {
    padding: var(--space-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: inherit;
    background: white;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    width: 100%;
}

.form-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--color-teal);
    box-shadow: 0 0 0 3px rgba(60, 152, 147, 0.1);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--color-text-muted);
    opacity: 0.7;
}

.form-error {
    color: #dc3545;
    font-size: 0.9rem;
    padding: var(--space-3);
    background: #fff5f5;
    border-radius: var(--radius-md);
    border: 1px solid #f5c2c7;
}

.form-actions {
    display: flex;
    gap: var(--space-3);
    justify-content: flex-end;
    margin-top: var(--space-2);
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-border);
}

/* Sidebar action button (Submit Ticket) */
.sidebar-item-action {
    background: rgba(60, 152, 147, 0.1);
    border-left: 3px solid var(--color-teal);
    padding-left: calc(var(--space-4) - 3px);
}

.sidebar-item-action:hover {
    background: rgba(60, 152, 147, 0.2);
}

/* Task Detail Styles */
.task-detail-row {
    display: flex;
    margin-bottom: var(--space-4);
}

.task-detail-label {
    width: 100px;
    flex-shrink: 0;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding-top: 2px;
}

.task-detail-value {
    flex: 1;
    color: var(--color-text);
}

.task-description {
    white-space: pre-wrap;
    color: var(--color-text-light);
    line-height: 1.6;
}

.task-description:empty::before {
    content: 'No description';
    color: var(--color-text-muted);
    font-style: italic;
}

.task-assignees {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.assignee-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-3);
    background: var(--color-border-light);
    border-radius: var(--radius-full);
    font-size: 0.875rem;
}

.assignee-avatar {
    width: 20px;
    height: 20px;
    border-radius: var(--radius-full);
    background: var(--color-teal-lighter);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    font-weight: 600;
    color: var(--color-purple-dark);
}

.assignee-avatar img {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-full);
    object-fit: cover;
}

/* Time & Budget Section */
.task-metrics-section {
    margin-bottom: var(--space-4);
}

.task-detail-section {
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-border);
}

.task-detail-section-header {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-3);
}

.task-metrics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
}

.task-metric {
    background: var(--color-border-light);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    text-align: center;
}

.task-metric-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-1);
}

.task-metric-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-teal);
}

/* Action Required Banner */
.action-required-banner {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border: 2px solid #ffc107;
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    margin-bottom: var(--space-4);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: var(--space-3);
}

.action-required-icon {
    font-size: 2rem;
}

.action-required-content {
    color: #856404;
}

.action-required-content strong {
    display: block;
    font-size: 1.1rem;
    margin-bottom: var(--space-1);
    color: #856404;
}

.action-required-content p {
    margin: 0;
    font-size: 0.9rem;
    color: #856404;
}

.btn-action-required {
    background: var(--color-purple);
    color: white;
    padding: var(--space-3) var(--space-5);
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: background 0.15s ease, transform 0.1s ease;
}

.btn-action-required:hover {
    background: var(--color-purple-dark);
    transform: translateY(-1px);
}

/* Task Instructions */
.task-instructions-section {
    margin-bottom: var(--space-4);
}

.task-instructions-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-2);
}

.task-instructions {
    background: var(--color-border-light);
    border-left: 3px solid var(--color-teal);
    padding: var(--space-3) var(--space-4);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    white-space: pre-wrap;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--color-text-light);
}

/* Task Description (Resources) */
.task-description-section {
    margin-bottom: var(--space-4);
}

.task-description-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-2);
}

.task-description {
    background: var(--color-border-light);
    border-left: 3px solid var(--color-purple);
    padding: var(--space-3) var(--space-4);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--color-text-light);
}

.task-description p {
    margin: 0 0 var(--space-2) 0;
}

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

.task-description h1,
.task-description h2,
.task-description h3 {
    margin: var(--space-3) 0 var(--space-2) 0;
    color: var(--color-text);
}

.task-description h1:first-child,
.task-description h2:first-child,
.task-description h3:first-child {
    margin-top: 0;
}

.task-description h1 {
    font-size: 1.25rem;
}

.task-description h2 {
    font-size: 1.1rem;
}

.task-description h3 {
    font-size: 1rem;
}

.task-description table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--space-3) 0;
    font-size: 0.9rem;
}

.task-description th,
.task-description td {
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--color-border);
    text-align: left;
}

.task-description th {
    background: var(--color-border);
    font-weight: 600;
}

.task-description ul,
.task-description ol {
    margin: var(--space-2) 0;
    padding-left: var(--space-4);
}

.task-description li {
    margin-bottom: var(--space-1);
}

.task-description code {
    background: var(--color-border);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-size: 0.85em;
}

.task-description pre {
    background: var(--color-bg-dark);
    padding: var(--space-3);
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin: var(--space-3) 0;
}

.task-description pre code {
    background: none;
    padding: 0;
    color: var(--color-text-light);
}

.task-description blockquote {
    border-left: 3px solid var(--color-teal);
    margin: var(--space-3) 0;
    padding-left: var(--space-4);
    color: var(--color-text-muted);
}

.task-description hr {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: var(--space-4) 0;
}

.task-description a {
    color: var(--color-teal);
    text-decoration: none;
}

.task-description a:hover {
    text-decoration: underline;
}

.task-description img {
    max-width: 100%;
    border-radius: var(--radius-md);
    margin: var(--space-3) 0;
}

.modal-subtasks {
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-border);
}

.modal-subtasks-header {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-3);
}

.modal-subtask {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    background: var(--color-border-light);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-2);
    cursor: pointer;
}

.modal-subtask:hover {
    background: var(--color-border);
}

.modal-subtask-name {
    flex: 1;
    font-size: 0.9rem;
}

/* Task Comment Section */
.task-comment-section {
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-border);
}

.task-comment-header {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-3);
}

.task-comment-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.task-comment-input {
    width: 100%;
    padding: var(--space-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-family: inherit;
    line-height: 1.5;
    resize: vertical;
    min-height: 80px;
    outline: none;
    transition: border-color 0.15s ease;
}

.task-comment-input:focus {
    border-color: var(--color-primary);
}

.task-comment-input:disabled {
    background: var(--color-border-light);
    cursor: not-allowed;
}

.task-comment-attachment {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.task-file-input {
    display: none;
}

.task-file-label {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}

.task-file-label:hover {
    background: var(--color-border);
}

.file-icon {
    font-size: 1rem;
}

.task-comment-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.comment-status {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.comment-status.success {
    color: var(--color-teal);
}

.comment-status.error {
    color: var(--color-red);
}

/* Task Complete Inline (within comment form) */
.task-complete-inline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3);
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border: 1px solid #a5d6a7;
    border-radius: var(--radius-md);
}

.task-complete-checkbox-inline {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
    font-size: 0.9rem;
    color: #2e7d32;
}

.task-complete-checkbox-inline input[type="checkbox"] {
    display: none;
}

.task-complete-checkbox-inline .checkmark-inline {
    width: 18px;
    height: 18px;
    border: 2px solid #4caf50;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.task-complete-checkbox-inline input[type="checkbox"]:checked + .checkmark-inline {
    background: #4caf50;
    border-color: #4caf50;
}

.task-complete-checkbox-inline input[type="checkbox"]:checked + .checkmark-inline::after {
    content: '✓';
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.task-complete-checkbox-inline input[type="checkbox"]:disabled + .checkmark-inline {
    opacity: 0.5;
}

.status-update-msg {
    font-size: 0.8rem;
    color: #558b2f;
}

.status-update-msg.success {
    color: #2e7d32;
}

.status-update-msg.error {
    color: var(--color-red);
}

/* Large Modal (for docs) */
.modal.modal-large {
    max-width: 90vw;
    max-height: 90vh;
    width: 900px;
    height: 85vh;
}

/* Doc Content Styles */
.doc-content {
    line-height: 1.7;
    color: var(--color-text);
}

.doc-content h1 {
    font-size: 1.75rem;
    font-weight: 600;
    margin: 0 0 var(--space-4) 0;
    color: var(--color-text);
}

.doc-content h2 {
    font-size: 1.4rem;
    font-weight: 600;
    margin: var(--space-6) 0 var(--space-3) 0;
    color: var(--color-text);
}

.doc-content h3 {
    font-size: 1.15rem;
    font-weight: 600;
    margin: var(--space-5) 0 var(--space-2) 0;
    color: var(--color-text);
}

.doc-content p {
    margin: 0 0 var(--space-4) 0;
}

.doc-content ul, .doc-content ol {
    margin: 0 0 var(--space-4) 0;
    padding-left: var(--space-6);
}

.doc-content li {
    margin-bottom: var(--space-2);
}

.doc-content a {
    color: var(--color-teal);
    text-decoration: none;
}

.doc-content a:hover {
    text-decoration: underline;
}

.doc-content code {
    background: var(--color-border-light);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 0.9em;
}

.doc-content pre {
    background: var(--color-border-light);
    padding: var(--space-4);
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin: 0 0 var(--space-4) 0;
}

.doc-content pre code {
    background: none;
    padding: 0;
}

.doc-content blockquote {
    border-left: 3px solid var(--color-teal);
    margin: 0 0 var(--space-4) 0;
    padding-left: var(--space-4);
    color: var(--color-text-light);
}

.doc-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 var(--space-4) 0;
    font-size: 0.9rem;
}

.doc-content th,
.doc-content td {
    border: 1px solid var(--color-border);
    padding: var(--space-2) var(--space-3);
    text-align: left;
}

.doc-content th {
    background: var(--color-border-light);
    font-weight: 600;
}

.doc-content tr:hover {
    background: var(--color-border-light);
}

.doc-content hr {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: var(--space-6) 0;
}

.doc-content ol {
    list-style-type: decimal;
}

.doc-page {
    margin-bottom: var(--space-6);
    padding-bottom: var(--space-6);
    border-bottom: 1px solid var(--color-border);
}

.doc-page:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.doc-page-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-purple);
    margin-bottom: var(--space-3);
}

/* Video Embeds (Documents) */
.video-embed {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    margin: var(--space-4) 0;
    background: var(--color-border-light);
    border-radius: var(--radius-md);
    overflow: hidden;
}

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

/* Video Embeds (Chat Messages) */
.video-embed-chat {
    margin: var(--space-2) 0;
    max-width: 500px;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--color-border-light);
}

.video-embed-chat video {
    width: 100%;
    display: block;
    border-radius: var(--radius-md);
}

/* Image Embeds (Chat Messages) */
.image-embed {
    margin: var(--space-2) 0;
    max-width: 400px;
}

.image-embed img {
    max-width: 100%;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: opacity 0.15s ease;
}

.image-embed img:hover {
    opacity: 0.9;
}

/* ============================================================
   Welcome Page
   ============================================================ */

.welcome-container {
    max-width: 900px;
    margin: 0 auto;
    padding: var(--space-4);
}

.welcome-header {
    text-align: center;
    margin-bottom: var(--space-8);
}

.welcome-header h2 {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: var(--space-2);
}

.welcome-header p {
    color: var(--color-text-muted);
    font-size: 1.1rem;
}

.welcome-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-8);
}

.welcome-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    box-shadow: var(--shadow-sm);
    display: flex;
    gap: var(--space-4);
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.welcome-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--color-teal-light);
    transform: translateY(-2px);
}

.welcome-card-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.welcome-card-content h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: var(--space-1);
}

.welcome-card-content p {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    line-height: 1.4;
    margin: 0;
}

.welcome-info {
    background: white;
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    box-shadow: var(--shadow-sm);
}

.welcome-info h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: var(--space-5);
    text-align: center;
}

.welcome-info-grid {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.welcome-info-item {
    display: flex;
    gap: var(--space-4);
    align-items: flex-start;
}

.welcome-info-number {
    width: 32px;
    height: 32px;
    background: var(--color-teal);
    color: white;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.welcome-info-text {
    flex: 1;
}

.welcome-info-text strong {
    display: block;
    font-size: 0.95rem;
    color: var(--color-text);
    margin-bottom: var(--space-1);
}

.welcome-info-text p {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    margin: 0;
    line-height: 1.4;
}

/* Sidebar Home Item */
.sidebar-item-home {
    background: rgba(60, 152, 147, 0.15);
    border-left: 3px solid var(--color-teal);
    padding-left: calc(var(--space-4) - 3px);
}

.sidebar-item-home:hover {
    background: rgba(60, 152, 147, 0.25);
}

.sidebar-item-home.active {
    background: var(--color-teal);
}

/* ============================================================
   Courses
   ============================================================ */

.courses-view {
    padding: var(--space-6);
    max-width: 1000px;
}

.course-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-4);
}

.course-card {
    background: white;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    cursor: pointer;
    transition: all 0.2s;
}

.course-card:hover {
    border-color: var(--color-teal);
    box-shadow: var(--shadow-md);
}

.course-card-icon {
    font-size: 2rem;
    margin-bottom: var(--space-3);
}

.course-card h3 {
    margin: 0 0 var(--space-2) 0;
    font-size: 1.1rem;
    color: var(--color-text);
}

.course-card p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

/* Lesson View */
.lesson-view {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.lesson-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4);
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg);
}

.lesson-progress {
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

.lesson-layout {
    display: grid;
    grid-template-columns: 250px 1fr;
    flex: 1;
    overflow: hidden;
}

.lesson-sidebar {
    padding: var(--space-4);
    border-right: 1px solid var(--color-border);
    overflow-y: auto;
    background: var(--color-bg);
}

.lesson-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.875rem;
    line-height: 1.4;
}

.lesson-item:hover {
    background: var(--color-bg-alt);
}

.lesson-item.active {
    background: var(--color-teal);
    color: white;
}

.lesson-item.active .lesson-check {
    color: white;
}

.lesson-item.completed .lesson-check {
    color: var(--color-teal);
}

.lesson-check {
    flex-shrink: 0;
    width: 1.2em;
}

.lesson-title {
    flex: 1;
}

.lesson-content {
    padding: var(--space-6);
    overflow-y: auto;
    max-width: 900px;
}

.lesson-content h1 {
    margin: 0 0 var(--space-4) 0;
    font-size: 1.75rem;
    color: var(--color-text);
}

.lesson-body {
    margin-bottom: var(--space-6);
    line-height: 1.7;
}

.lesson-body h2 {
    margin: var(--space-5) 0 var(--space-3) 0;
    font-size: 1.3rem;
    color: var(--color-text);
}

.lesson-body h3 {
    margin: var(--space-4) 0 var(--space-2) 0;
    font-size: 1.1rem;
    color: var(--color-text);
}

.lesson-body p {
    margin: 0 0 var(--space-3) 0;
}

.lesson-body ul, .lesson-body ol {
    margin: 0 0 var(--space-3) 0;
    padding-left: var(--space-5);
}

.lesson-body li {
    margin-bottom: var(--space-2);
}

.lesson-body table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--space-4) 0;
    font-size: 0.9rem;
}

.lesson-body th, .lesson-body td {
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--color-border);
    text-align: left;
}

.lesson-body th {
    background: var(--color-bg-alt);
    font-weight: 600;
}

.lesson-body hr {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: var(--space-5) 0;
}

.lesson-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-border);
    gap: var(--space-3);
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

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

    .sidebar-toggle {
        display: block;
    }

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 99;
        display: none;
    }

    .sidebar-overlay.visible {
        display: block;
    }

    /* Welcome page responsive */
    .welcome-container {
        padding: var(--space-2);
    }

    .welcome-header h2 {
        font-size: 1.4rem;
    }

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

    .welcome-card {
        padding: var(--space-4);
    }

    .welcome-info {
        padding: var(--space-4);
    }

    /* Ticket form responsive */
    .form-row {
        flex-direction: column;
        gap: var(--space-3);
    }

    .ticket-form {
        padding: var(--space-4);
    }

    /* Course responsive */
    .courses-view {
        padding: var(--space-4);
    }

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

    .lesson-layout {
        grid-template-columns: 1fr;
    }

    .lesson-sidebar {
        display: none;
    }

    .lesson-content {
        padding: var(--space-4);
    }

    .lesson-content h1 {
        font-size: 1.4rem;
    }

    .lesson-nav {
        flex-wrap: wrap;
        gap: var(--space-2);
    }

    .lesson-nav > * {
        flex: 1 1 auto;
        min-width: 100px;
    }
}
