:root {
    --primary: #4f46e5;
    --primary-light: #e0e7ff;
    --primary-hover: #4338ca;
    
    --success: #10b981;
    --success-light: #d1fae5;
    
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    
    --danger: #ef4444;
    --danger-light: #fee2e2;
    
    --bg-base: #f8fafc;
    --bg-surface: #ffffff;
    --bg-surface-hover: #f1f5f9;
    
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 9999px;
    
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 15px -1px rgba(0,0,0,0.06), 0 2px 8px -1px rgba(0,0,0,0.04);
    --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);

    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.header-search {
    position: relative;
    margin-right: 20px;
    margin-left: 20px;
    flex: 1;
    max-width: 450px;
}

.header-search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.9rem;
}

#task-search {
    width: 100%;
    padding: 0.65rem 1rem 0.65rem 2.6rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-surface);
    font-size: 0.9rem;
    transition: var(--transition);
    color: var(--text-main);
}

#task-search:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
    background: white;
    outline: none;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--bg-base);
    color: var(--text-main);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

.app-container {
    display: flex;
    height: 100vh;
}

/* Typography Enhancements */
h1, h2, h3, h4 { letter-spacing: -0.02em; }
.subtitle { color: var(--text-muted); font-size: 0.95rem; margin-top: 0.25rem; }

/* Utilities */
.hidden { display: none !important; }
.text-primary { color: var(--primary); }
.text-warning { color: var(--warning); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-cancelled { color: #94a3b8; }
.bg-primary-light { background-color: var(--primary-light); }
.bg-warning-light { background-color: var(--warning-light); }
.bg-success-light { background-color: var(--success-light); }
.bg-danger-light { background-color: var(--danger-light); }
.bg-cancelled-light { background-color: #f1f5f9; }
.bg-light { background-color: var(--bg-surface-hover); }

.flex-1 { flex: 1; }

/* Navigation */
.main-nav {
    width: 260px;
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1rem;
    z-index: 10;
    overflow-y: auto;
    max-height: 100vh;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 2.5rem;
    padding: 0 0.5rem;
}

.logo-icon {
    background: linear-gradient(135deg, var(--primary), #818cf8);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
}

.nav-links { list-style: none; flex: 1; }
.nav-links li {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1rem;
    margin-bottom: 0.5rem;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}
.nav-links li i { font-size: 1.1rem; width: 20px; text-align: center; transition: transform 0.2s; }
.nav-links li:hover {
    background-color: var(--bg-surface-hover);
    color: var(--primary);
}
.nav-links li:hover i { transform: scale(1.1); }
.nav-links li.active {
    background-color: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.nav-user {
    margin-top: auto;
    padding: 1rem 0.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-top: 1px solid var(--border);
}
.avatar { width: 44px; height: 44px; border-radius: var(--radius-full); box-shadow: var(--shadow-md); }
.user-info { display: flex; flex-direction: column; }
.user-info .name { font-weight: 600; font-size: 0.95rem; }
.user-info .role { font-size: 0.75rem; color: var(--text-muted); }

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 2.5rem;
    position: sticky;
    top: 0;
    z-index: 5;
    background: rgba(248, 250, 252, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(226, 232, 240, 0.6);
}

#page-title { font-size: 1.8rem; font-weight: 700; color: #1e293b; }

.view-container {
    padding: 2rem 2.5rem;
    animation: fadeUpIn 0.4s ease-out;
}

@keyframes fadeUpIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Cards & Stats */
.todays-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: var(--bg-surface);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 1.25rem;
    transition: var(--transition);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
    border-color: #cbd5e1;
}

.stat-icon {
    width: 54px;
    height: 54px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-info h3 {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}
.stat-value { font-size: 1.6rem; font-weight: 700; }

.section-container { margin-top: 1rem; }
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}
.section-header h2 { font-size: 1.3rem; font-weight: 600; }
.view-all-link {
    font-size: 0.9rem;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.view-all-link:hover { text-decoration: underline; }

/* Filter Tabs */
.filter-group { display: flex; gap: 0.5rem; }
.modern-tabs { background: var(--border); padding: 0.25rem; border-radius: var(--radius-sm); }
.filter-btn {
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}
.modern-tabs .filter-btn:hover { color: var(--text-main); }
.modern-tabs .filter-btn.active {
    background: white;
    color: var(--text-main);
    box-shadow: var(--shadow-sm);
}
.section-header > .filter-group:not(.modern-tabs) .filter-btn {
    border: 1px solid var(--border);
    background: white;
}
.section-header > .filter-group:not(.modern-tabs) .filter-btn.active {
    background: var(--text-main);
    color: white;
    border-color: var(--text-main);
}

/* Tasks */
.task-list { display: flex; flex-direction: column; gap: 1rem; }
.task-card {
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: var(--transition);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.task-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.task-history-inline {
    margin-top: 0.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    max-height: 300px;
    overflow-y: auto;
    animation: fadeIn 0.3s ease-out;
    cursor: default;
}

.history-item {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px dashed var(--border);
}

.history-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.history-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.25rem;
}

.history-action {
    font-weight: 600;
    color: var(--primary);
    font-size: 0.8rem;
}

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

.history-user {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

.history-details {
    font-size: 0.8rem;
    line-height: 1.5;
    color: var(--text-main);
    padding: 0.5rem 0.75rem;
    background: var(--bg-base);
    border-radius: var(--radius-sm);
    white-space: pre-wrap;
    border-left: 3px solid var(--primary-light);
}

.history-toggle-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

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

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

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

.task-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--primary);
    opacity: 0;
    transition: var(--transition);
}

.task-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: var(--primary-light);
}
.task-card:hover::before { opacity: 1; }

/* Subtask indentation in task list */
.subtask-indent-row {
    display: flex;
    align-items: stretch;
    padding-left: 5rem; /* Significantly increased indentation */
    margin-top: -0.5rem;
    margin-bottom: 0.5rem;
}

.subtask-tree-line {
    width: 24px;
    min-width: 24px;
    position: relative;
    flex-shrink: 0;
}

.subtask-tree-line::before {
    content: '';
    position: absolute;
    left: 11px;
    top: -1rem; /* Connect to parent above */
    bottom: 50%;
    width: 3px; /* Thicker */
    background: var(--primary);
    opacity: 0.3;
}

.subtask-tree-line::after {
    content: '';
    position: absolute;
    left: 11px;
    top: 50%;
    width: 20px; /* Longer */
    height: 3px; /* Thicker */
    background: var(--primary);
    opacity: 0.3;
    border-radius: 0 0 0 8px;
}

.subtask-tree-last::before {
    bottom: 50%;
}

.subtask-card-wrap {
    flex: 1;
    padding-top: 0.5rem;
    padding-bottom: 0.25rem;
}

.subtask-card-wrap .task-card {
    border-left: 3px solid var(--primary-light);
    background: #fafbff;
    opacity: 0.95;
}

.subtask-card-wrap .task-card:hover {
    border-left-color: var(--primary);
    opacity: 1;
}

.task-info { display: flex; flex-direction: column; gap: 0.4rem; }
.task-title { font-weight: 600; font-size: 1.05rem; }
.task-meta {
    display: flex;
    gap: 1.25rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.task-meta span { display: flex; align-items: center; gap: 0.4rem; }

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

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); }
.btn-glow { box-shadow: 0 8px 15px -4px rgba(79, 70, 229, 0.4); }

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

.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }

.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover { background: #d97706; }

.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.8rem; border-radius: var(--radius-sm); }
.btn-icon { background: none; border: none; font-size: 1.2rem; color: var(--text-muted); cursor: pointer; transition: 0.2s;}
.btn-icon:hover { color: var(--primary); }

.tag {
    padding: 0.35rem 0.85rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
}

/* Modals with Glassmorphism */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    padding: 1.5rem;
}

.modal-content {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 540px;
    box-shadow: var(--shadow-lg);
    animation: scaleZoom 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(255,255,255,0.7);
}

.modal-content.large { max-width: 900px; }

@keyframes scaleZoom {
    from { opacity: 0; transform: scale(0.92); }
    to { opacity: 1; transform: scale(1); }
}

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}
.header-chips { display: flex; gap: 0.5rem; align-items: center; margin-left: 1rem; }

.btn-close {
    background: var(--bg-surface-hover);
    width: 32px; height: 32px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    border: none; color: var(--text-muted);
    cursor: pointer; transition: var(--transition);
}
.btn-close:hover { background: var(--danger-light); color: var(--danger); transform: rotate(90deg); }

.modal-body { padding: 2rem; overflow-y: auto; }

/* Layout Custom Modals */
.layout-split { display: flex; gap: 2rem; padding: 0; height: 600px; }
.detail-main { flex: 1.5; padding: 2rem; overflow-y: auto; }
.detail-sidebar {
    flex: 1;
    background: #f8fafc;
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.title-large { font-size: 1.6rem; color: #1e293b; margin-bottom: 1.5rem; }

.meta-info-bar {
    display: flex;
    gap: 2rem;
    padding: 1.25rem;
    background: var(--bg-base);
    border-radius: var(--radius-md);
    margin-bottom: 2rem;
    border: 1px dashed #cbd5e1;
}
.meta-item { display: flex; align-items: center; gap: 1rem; }
.meta-item i { font-size: 1.5rem; background: var(--primary-light); padding: 0.75rem; border-radius: var(--radius-md); }
.meta-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.meta-item b { font-size: 0.95rem; }

.detail-section { margin-bottom: 2rem; }
.detail-section h4 { font-size: 1.05rem; margin-bottom: 0.75rem; color: #334155; }
.detail-desc { color: #475569; line-height: 1.7; font-size: 0.95rem; }

.attachment-cards { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.attachment-card {
    display: flex; align-items: center; gap: 0.6rem;
    padding: 0.6rem 1rem; background: white;
    border: 1px solid var(--border); border-radius: var(--radius-md);
    font-size: 0.85rem; font-weight: 500; cursor: pointer;
    transition: var(--transition);
}
.attachment-card:hover { border-color: var(--primary); color: var(--primary); }

.gradient-top {
    position: relative;
    padding-top: 1.5rem;
    margin-top: auto;
    display: flex; justify-content: space-between; align-items: center;
}
.gradient-top::before {
    content: ''; position: absolute; top: -1.5rem; left: -2rem; right: -2rem; height: 1.5rem;
    background: linear-gradient(to top, rgba(255,255,255,1), rgba(255,255,255,0));
    pointer-events: none;
}

/* Discussion / Comments */
.supervisor-comments h4 {
    padding: 1.5rem 1.5rem 1rem;
    margin: 0;
    border-bottom: 1px solid var(--border);
    font-size: 1.05rem;
}
.comments-list {
    flex: 1; padding: 1.5rem; overflow-y: auto;
    display: flex; flex-direction: column; gap: 1.25rem;
}
.comment-item {
    background: white; padding: 1rem; border-radius: var(--radius-md) var(--radius-md) var(--radius-md) 0;
    box-shadow: var(--shadow-sm); border: 1px solid var(--border);
    position: relative;
    animation: fadeInSlide 0.3s ease-out;
}
.comment-me {
    background: var(--primary-light);
    border-color: #c7d2fe;
    border-radius: var(--radius-md) var(--radius-md) 0 var(--radius-md);
    align-self: flex-end;
}
@keyframes fadeInSlide {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}
.comment-author { font-weight: 600; font-size: 0.85rem; margin-bottom: 0.4rem; color: #1e293b; display: flex; justify-content: space-between;}
.comment-time { font-size: 0.7rem; color: #94a3b8; font-weight: 400; }
.comment-text { font-size: 0.875rem; line-height: 1.5; color: #334155; }

.comment-input-area {
    padding: 1.5rem; background: white; border-top: 1px solid var(--border);
    display: flex; flex-direction: column; gap: 0.75rem;
}
.comment-input-area textarea {
    border-radius: var(--radius-md); resize: none; background: #f8fafc;
}
.comment-input-area textarea:focus { background: white; }

/* Forms Configuration */
.form-group { margin-bottom: 1.25rem; display: flex; flex-direction: column; gap: 0.4rem; }
.form-row { display: flex; gap: 1.25rem; }
form label { font-size: 0.85rem; font-weight: 600; color: #475569; }

input, select, textarea {
    padding: 0.75rem 1rem; border-radius: var(--radius-md);
    border: 1px solid var(--border); background: var(--bg-surface);
    font-family: inherit; font-size: 0.9rem; transition: var(--transition);
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

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

/* Calendar Mock */
.calendar-wrapper {
    background: white; border-radius: var(--radius-lg);
    border: 1px solid var(--border); box-shadow: var(--shadow-sm);
    padding: 1.5rem;
}
.calendar-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.month-title { font-size: 1.25rem; font-weight: 600; }
.calendar-grid {
    display: grid; grid-template-columns: repeat(7, 1fr);
    border-top: 1px solid var(--border); border-left: 1px solid var(--border);
}

.cal-day.head {
    padding: 1rem; font-weight: 600; text-align: center;
    border-bottom: 1px solid var(--border); border-right: 1px solid var(--border);
    color: var(--text-muted); font-size: 0.85rem; text-transform: uppercase;
}

.cal-cell {
    min-height: 100px; padding: 0.75rem;
    border-bottom: 1px solid var(--border); border-right: 1px solid var(--border);
    font-size: 0.9rem; position: relative; cursor: pointer; transition: 0.2s;
}

.cal-cell:hover { background: var(--bg-surface-hover); }
.cal-cell.today { background: var(--primary-light); font-weight: 700; color: var(--primary); }
.cal-dots { display: flex; gap: 4px; position: absolute; bottom: 10px; left: 10px; }
.cal-dots::-webkit-scrollbar { width: 4px; }
.cal-dots::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
.cal-dots::-webkit-scrollbar-track { background: transparent; }
.dot { width: 8px; height: 8px; border-radius: 50%; }

/* Mobile Responsive adjustments - Collapsable Sidebar */
@media (max-width: 900px) {
    .layout-split { flex-direction: column; height: auto;}
    .detail-main { border-right: none; border-bottom: 1px solid var(--border); }
}

@media (min-width: 769px) {
    .mobile-only { display: none !important; }
}

@media (max-width: 768px) {
    .app-container { flex-direction: column; }
    
    .main-nav {
        position: fixed;
        left: -280px; /* Pull off-canvas */
        top: 0;
        bottom: 0;
        width: 260px;
        height: 100vh;
        background: #1e1b4b; /* Darker blue for premium drawer feel */
        border-right: none;
        padding: 2rem 1.5rem;
        transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 100;
        box-shadow: 10px 0 25px rgba(0,0,0,0.1);
        overflow-y: auto !important; /* Ensure scrolling works on fixed container */
    }

    .main-nav.nav-open {
        transform: translateX(280px);
    }
    
    .main-nav .logo span, .main-nav .nav-links span { color: white; }
    .main-nav .nav-links li { color: #94a3b8; }
    .main-nav .nav-links li:hover, .main-nav .nav-links li.active { color: white; background: rgba(255,255,255,0.1); }
    .main-nav .nav-user { border-top-color: rgba(255,255,255,0.1); }
    .main-nav .nav-user .name { color: white; }

    .main-content { margin-left: 0; width: 100%; transition: filter 0.3s ease; }
    .main-nav.nav-open ~ .main-content { filter: blur(2px); }

    .top-header { 
        padding: 1.25rem 1.5rem; 
        background: rgba(255,255,255,0.9);
        border-bottom: 1px solid var(--border);
    }
    
    #page-title { font-size: 1.4rem; }
    .subtitle { font-size: 0.8rem; }
    
    .view-container { padding: 1.25rem; }
    
    .todays-overview {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
        margin-bottom: 1.5rem;
    }

    .stat-card { 
        padding: 1rem 0.5rem; 
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }

    .stat-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
        border-radius: var(--radius-sm);
    }

    .stat-info h3 {
        font-size: 0.65rem;
        margin-bottom: 0.1rem;
    }

    .stat-value {
        font-size: 1rem;
    }
    
    .btn span { display: inline; } /* Keep text in buttons if space allows, or use utility */
}

#nav-overlay.active {
    display: block !important;
    opacity: 1;
}
/* Messaging Feature Styles */
.contact-item {
    transition: var(--transition);
}

.contact-item:hover {
    background: rgba(79, 70, 229, 0.05) !important;
}

.contact-item.active {
    background: var(--primary-light) !important;
}

.contact-item.active h4 {
    color: var(--primary) !important;
}

#view-messaging {
    height: calc(100vh - 180px);
    display: flex;
    gap: 1.5rem;
}

.conversation-sidebar {
    width: 300px;
}

@media (max-width: 768px) {
    #view-messaging {
        flex-direction: column !important; /* Force stacking */
        height: auto !important;
        min-height: calc(100vh - 140px);
        gap: 1rem;
    }

    .conversation-sidebar {
        width: 100% !important;
        max-height: 250px;
        flex: none !important;
    }

    #chat-content, #folder-content {
        height: 450px !important;
        flex: 1 !important;
    }
}

.glass-effect {
    background: rgba(255, 255, 255, 0.8) !important;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07) !important;
}

#message-history::-webkit-scrollbar {
    width: 6px;
}

#message-history::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

#message-history::-webkit-scrollbar-track {
    background: transparent;
}

.msg-in {
    animation: msgIn 0.3s ease-out;
}

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

#contact-list::-webkit-scrollbar {
    width: 4px;
}

#contact-list::-webkit-scrollbar-thumb {
    background: #e2e8f0;
    border-radius: 10px;
}

/* Task Updated Badge Animation */
@keyframes badgePulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.05); }
}

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

@keyframes refreshBlink {
    0%, 100% { background: var(--primary); color: white; box-shadow: 0 0 8px rgba(79, 70, 229, 0.4); }
    50% { background: #ef4444; color: white; box-shadow: 0 0 12px rgba(239, 68, 68, 0.5); }
}

.refresh-blink {
    animation: refreshBlink 1.5s ease-in-out infinite !important;
    border-color: transparent !important;
}

.task-updated-badge {
    display: inline-block;
    vertical-align: middle;
}

/* Mobile Search Adjustment */
@media (max-width: 768px) {
    .header-search {
        margin: 10px 0;
        max-width: none;
        order: 3;
        width: 100%;
        margin-left: 0;
        margin-right: 0;
    }
    .top-header {
        flex-wrap: wrap;
        height: auto !important;
        padding-bottom: 0.75rem !important;
    }
    .header-info {
        flex: 1;
    }
}
/* History Timeline */
.history-timeline {
    position: relative;
    padding-left: 2rem;
    margin-top: 1rem;
}

.history-timeline::before {
    content: '';
    position: absolute;
    left: 0.5rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.history-item {
    position: relative;
    margin-bottom: 1.5rem;
}

.history-item::before {
    content: '';
    position: absolute;
    left: -1.75rem;
    top: 0.25rem;
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
    background: white;
    border: 2px solid var(--primary);
    z-index: 1;
}

.history-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-action {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-base);
}

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

.history-details {
    font-size: 0.85rem;
    color: var(--text-muted);
    background: #f1f5f9;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    margin-top: 0.25rem;
}
