/* CSS Variables - Color Palette & Typography */
:root {
    /* Colors */
    --primary-text: #2d3748;
    --primary-brand: #3182ce;
    --primary-brand-hover: #2c5aa0;
    --background-body: #f7fafc;
    --background-white: #ffffff;
    --border-light: #e2e8f0;
    --border-medium: #cbd5e0;
    --text-muted: #718096;
    --text-light: #a0aec0;
    --error-color: #dc3545;
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --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);
    
    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-size-base: 16px;
    --font-size-sm: 14px;
    --font-size-xs: 12px;
    --font-size-lg: 18px;
    --font-size-xl: 20px;
    --font-size-2xl: 24px;
    --font-size-3xl: 30px;
    
    /* Layout */
    --header-height: 64px;
    --sidebar-width-collapsed: 64px;
    --sidebar-width-expanded: 240px;
    
    /* Transitions */
    --transition-fast: 0.15s ease-in-out;
    --transition-normal: 0.3s ease-in-out;
}

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

html {
    font-size: var(--font-size-base);
    line-height: 1.5;
}

body {
    font-family: var(--font-family);
    color: var(--primary-text);
    background-color: var(--background-body);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.25;
    margin-bottom: 0.5rem;
}

h1 {
    font-size: var(--font-size-3xl);
}

h2 {
    font-size: var(--font-size-2xl);
}

h3 {
    font-size: var(--font-size-xl);
}

h4 {
    font-size: var(--font-size-lg);
}

h5, h6 {
    font-size: var(--font-size-base);
}

p {
    margin-bottom: 1rem;
}

a {
    color: var(--primary-brand);
    text-decoration: none;
    transition: color var(--transition-fast);
}

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

/* Header Styles */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background-color: var(--background-white);
    border-bottom: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    z-index: 1000;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 1.5rem;
    max-width: 100%;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.hamburger-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    border-radius: 6px;
    color: var(--primary-text);
    cursor: pointer;
    transition: background-color var(--transition-fast);
}

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

.app-name h1 {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--primary-brand);
    margin: 0;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
}

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

.logout-link {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: all var(--transition-fast);
}

.logout-link:hover {
    background-color: var(--border-light);
    color: var(--primary-text);
}

/* Sidebar Styles */
.sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: var(--sidebar-width-collapsed);
    height: calc(100vh - var(--header-height));
    background-color: var(--background-white);
    border-right: 1px solid var(--border-light);
    transition: width var(--transition-normal);
    z-index: 900;
    overflow: hidden;
}

.sidebar.expanded {
    width: var(--sidebar-width-expanded);
}

.sidebar-nav {
    height: 100%;
    padding: 1rem 0;
}

.nav-list {
    list-style: none;
}

.nav-item {
    margin-bottom: 0.25rem;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: all var(--transition-fast);
    position: relative;
    white-space: nowrap;
}

.nav-link:hover {
    background-color: var(--border-light);
    color: var(--primary-text);
}

.nav-link.active {
    background-color: rgba(49, 130, 206, 0.1);
    color: var(--primary-brand);
    border-right: 3px solid var(--primary-brand);
}

.nav-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin-right: 0.75rem;
}

.nav-text {
    font-size: var(--font-size-sm);
    font-weight: 500;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.sidebar.expanded .nav-text {
    opacity: 1;
}

/* Main Content Area */
.main-content {
    margin-left: var(--sidebar-width-collapsed);
    margin-top: var(--header-height);
    padding: 2rem;
    min-height: calc(100vh - var(--header-height));
    transition: margin-left var(--transition-normal);
}

.main-content.sidebar-expanded {
    margin-left: var(--sidebar-width-expanded);
}

/* Mobile Overlay */
.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 850;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.mobile-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Button Components */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    background-color: var(--primary-brand);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: var(--font-size-sm);
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background-color: var(--primary-brand-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Utility Classes */
.text-muted {
    color: var(--text-muted);
}

.text-light {
    color: var(--text-light);
}

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

.border {
    border: 1px solid var(--border-light);
}

.rounded {
    border-radius: 6px;
}

.shadow-sm {
    box-shadow: var(--shadow-sm);
}

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

.shadow-lg {
    box-shadow: var(--shadow-lg);
}

/* Mobile Responsiveness */
@media (max-width: 767px) {
    .header-content {
        padding: 0 1rem;
    }
    
    .user-name {
        display: none;
    }
    
    .sidebar {
        width: var(--sidebar-width-expanded);
        transform: translateX(-100%);
        transition: transform var(--transition-normal);
        z-index: 900;
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    
    .sidebar .nav-text {
        opacity: 1;
    }
    
    .main-content {
        margin-left: 0;
        padding: 1.5rem 1rem;
    }
    
    .main-content.sidebar-expanded {
        margin-left: 0;
    }
    
    body.sidebar-mobile-open {
        overflow: hidden;
    }
}

@media (max-width: 480px) {
    .header-content {
        padding: 0 0.75rem;
    }
    
    .app-name h1 {
        font-size: var(--font-size-lg);
    }
    
    .main-content {
        padding: 1rem 0.75rem;
    }
    
    .logout-link {
        padding: 0.5rem 0.75rem;
    }
}

/* Focus States for Accessibility */
.hamburger-btn:focus,
.nav-link:focus,
.logout-link:focus,
.btn-primary:focus {
    outline: 2px solid var(--primary-brand);
    outline-offset: 2px;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Print styles */
@media print {
    .header,
    .sidebar,
    .mobile-overlay {
        display: none !important;
    }
    
    .main-content {
        margin: 0 !important;
        padding: 0 !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --border-light: #000000;
        --text-muted: #000000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Authentication Pages Styles */
.auth-main-content {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: linear-gradient(135deg, var(--primary-brand) 0%, var(--primary-brand-hover) 100%);
}

.auth-container {
    width: 100%;
    max-width: 400px;
}

.auth-card {
    background: var(--background-white);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 2.5rem;
    width: 100%;
}

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

.auth-header h1 {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    color: var(--primary-text);
    margin-bottom: 0.5rem;
}

.auth-header p {
    color: var(--text-muted);
    font-size: var(--font-size-sm);
    margin: 0;
}

.auth-form {
    margin-bottom: 1.5rem;
}

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

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

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

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-medium);
    border-radius: 6px;
    font-size: var(--font-size-sm);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    background-color: var(--background-white);
    color: var(--primary-text);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-brand);
    box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
}

.form-input::placeholder {
    color: var(--text-light);
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.form-checkbox {
    width: 16px;
    height: 16px;
    accent-color: var(--primary-brand);
}

.form-checkbox-label {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    cursor: pointer;
}

.btn-full {
    width: 100%;
    padding: 0.875rem 1.5rem;
    font-size: var(--font-size-sm);
    font-weight: 600;
}

.auth-footer {
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-light);
}

.auth-footer p {
    margin: 0;
    font-size: var(--font-size-sm);
    color: var(--text-muted);
}

.auth-footer .link {
    color: var(--primary-brand);
    font-weight: 500;
    text-decoration: none;
}

.auth-footer .link:hover {
    text-decoration: underline;
}

.alert {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1.5rem;
    font-size: var(--font-size-sm);
    font-weight: 500;
}

.alert-error {
    background-color: #fed7d7;
    color: #c53030;
    border: 1px solid #feb2b2;
}

.alert-success {
    background-color: #c6f6d5;
    color: #2f855a;
    border: 1px solid #9ae6b4;
}

.alert-info {
    background-color: #bee3f8;
    color: #2b6cb0;
    border: 1px solid #90cdf4;
}

.error-message {
    display: block;
    color: #e53e3e;
    font-size: var(--font-size-xs);
    margin-top: 0.25rem;
}

/* Dashboard Styles */
.dashboard-container {
    width: 100%;
    max-width: 100%;
}

.dashboard-table-wrapper {
    width: 100%;
    overflow-x: auto;
    background: var(--background-white);
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
}

.dashboard-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-sm);
}

.dashboard-table th {
    background-color: #f8fafc;
    color: var(--primary-text);
    font-weight: 600;
    text-align: left;
    padding: 1rem;
    border-bottom: 1px solid var(--border-light);
    white-space: nowrap;
}

.dashboard-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-light);
    color: var(--primary-text);
    vertical-align: middle;
}

.dashboard-table tr:hover {
    background-color: #f8fafc;
}

.dashboard-table tr:last-child td {
    border-bottom: none;
}

/* Action buttons in tables */
.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: var(--font-size-xs);
    border-radius: 4px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    transition: all var(--transition-fast);
    border: 1px solid transparent;
}

.btn-secondary {
    background-color: #e2e8f0;
    color: var(--primary-text);
    border-color: #cbd5e0;
}

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

.text-center {
    text-align: center;
}

/* Responsive table */
@media (max-width: 767px) {
    .dashboard-table-wrapper {
        border-radius: 6px;
    }
    
    .dashboard-table th,
    .dashboard-table td {
        padding: 0.75rem 0.5rem;
        font-size: var(--font-size-xs);
    }
    
    .dashboard-table th {
        font-size: var(--font-size-xs);
    }
}

@media (max-width: 480px) {
    .dashboard-table th,
    .dashboard-table td {
        padding: 0.5rem 0.375rem;
    }
    
    .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 10px;
    }
}

/* Mobile responsiveness for auth pages */
@media (max-width: 480px) {
    .auth-main-content {
        padding: 1rem;
    }
    
    .auth-card {
        padding: 2rem 1.5rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
    
    .auth-header h1 {
        font-size: var(--font-size-xl);
    }
}

/* Detail Page Styles */
.detail-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-light);
}

.detail-title-section {
    flex: 1;
}

.detail-title {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    color: var(--primary-text);
    margin: 0 0 0.5rem 0;
}

.detail-subtitle {
    font-size: var(--font-size-lg);
    color: var(--secondary-text);
    margin: 0 0 0.75rem 0;
}

.detail-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.detail-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.detail-section {
    background: var(--background-white);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
}

.section-title {
    font-size: var(--font-size-xl);
    font-weight: 600;
    color: var(--primary-text);
    margin: 0 0 1.5rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-light);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-header .section-title {
    margin: 0;
    border: none;
    padding: 0;
}

.subsection-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--primary-text);
    margin: 1.5rem 0 1rem 0;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

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

.info-item label {
    font-weight: 600;
    color: var(--secondary-text);
    font-size: var(--font-size-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.info-item span, .info-item a {
    color: var(--primary-text);
    font-size: var(--font-size-base);
}

.info-item a {
    color: var(--primary-color);
    text-decoration: none;
}

.info-item a:hover {
    text-decoration: underline;
}

.address-block {
    background: #f8fafc;
    padding: 1rem;
    border-radius: 6px;
    border: 1px solid var(--border-light);
    color: var(--primary-text);
    line-height: 1.5;
}

/* Status Badge Styles */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-pending {
    background-color: #fef3c7;
    color: #92400e;
}

.status-active {
    background-color: #d1fae5;
    color: #065f46;
}

.status-completed {
    background-color: #dbeafe;
    color: #1e40af;
}

.status-cancelled {
    background-color: #fee2e2;
    color: #991b1b;
}

/* New Matter Status Styles */
.status-intake {
    background-color: #f3f4f6;
    color: #374151;
}

.status-drafting_uccs {
    background-color: #fef3c7;
    color: #92400e;
}

.status-uccs_sent {
    background-color: #fed7aa;
    color: #9a3412;
}

.status-litigation_pending {
    background-color: #fde68a;
    color: #78350f;
}

.status-litigation_ny {
    background-color: #ddd6fe;
    color: #5b21b6;
}

.status-litigation_fl {
    background-color: #c7d2fe;
    color: #4338ca;
}

.status-judgment_received {
    background-color: #bfdbfe;
    color: #1e40af;
}

.status-settled {
    background-color: #d1fae5;
    color: #065f46;
}

.status-settlement_breached {
    background-color: #fecaca;
    color: #991b1b;
}

.status-breach_litigation {
    background-color: #fbbf24;
    color: #7c2d12;
}

.status-closed {
    background-color: #e5e7eb;
    color: #4b5563;
}

/* Status Dropdown Styles */
.status-dropdown-wrapper {
    position: relative;
    display: inline-block;
}

.status-badge.clickable {
    cursor: pointer;
    user-select: none;
    transition: opacity 0.2s;
}

.status-badge.clickable:hover {
    opacity: 0.8;
}

.status-badge.clickable i {
    margin-left: 0.25rem;
    font-size: 0.75rem;
}

.status-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    z-index: 50;
    min-width: 200px;
    margin-top: 0.25rem;
    max-height: 300px;
    overflow-y: auto;
}

.status-dropdown.hidden {
    display: none;
}

.status-option {
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: background-color 0.15s;
    font-size: 0.875rem;
    border-bottom: 1px solid #f3f4f6;
}

.status-option:last-child {
    border-bottom: none;
}

.status-option:hover {
    background-color: #f3f4f6;
}

.status-option.current {
    background-color: #eff6ff;
    font-weight: 600;
}

.status-option.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* File sync status styles (keep existing) */
.status-synced {
    background-color: #d1fae5;
    color: #065f46;
}

.status-pending {
    background-color: #fef3c7;
    color: #92400e;
}

.status-error {
    background-color: #fee2e2;
    color: #991b1b;
}

/* Notes Section */
.add-note-form {
    background: var(--background-white);
    padding: 0;
    border-radius: 12px;
    border: 1px solid var(--border-light);
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

.note-form-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.note-form-header h4 {
    margin: 0;
    font-size: var(--font-size-lg);
    font-weight: 600;
}

.note-author-info {
    font-size: var(--font-size-sm);
    opacity: 0.9;
    font-style: italic;
}

.modern-form {
    padding: 1.5rem;
}

.modern-form .form-group {
    margin-bottom: 1.5rem;
}

.modern-textarea {
    width: 100%;
    min-height: 120px;
    padding: 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-family: inherit;
    font-size: var(--font-size-base);
    line-height: 1.6;
    resize: vertical;
    transition: all 0.2s ease;
    background: #fafafa;
}

.modern-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    background: var(--background-white);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.modern-textarea::placeholder {
    color: #9ca3af;
    font-style: italic;
}

.notes-timeline {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.modern-note {
    display: flex;
    gap: 1rem;
    background: var(--background-white);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border-light);
    transition: all 0.2s ease;
    position: relative;
}

.modern-note:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.modern-note::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 2px 0 0 2px;
}

/* Pinned Note Styling */
.pinned-note {
    background: var(--background-white);
    border: 2px solid #f59e0b;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.25), 0 2px 4px rgba(245, 158, 11, 0.1);
    position: relative;
}

.pinned-note::before {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    width: 6px;
}

.pin-indicator {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #f59e0b;
    color: white;
    padding: 0.25rem;
    border-radius: 0 8px 0 8px;
    transform: rotate(15deg);
    transform-origin: center;
    z-index: 10;
}

.pin-info {
    background: #fef3c7;
    color: #92400e;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: var(--font-size-xs);
    font-weight: 500;
    border: 1px solid #fbbf24;
    margin-left: 0.5rem;
}

.note-avatar {
    flex-shrink: 0;
}

.avatar-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
}

.note-body {
    flex: 1;
    min-width: 0;
}

.note-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.75rem;
    gap: 1rem;
}

.note-author {
    font-weight: 600;
    color: var(--primary-text);
    font-size: var(--font-size-base);
}

.note-date {
    color: var(--secondary-text);
    font-size: var(--font-size-sm);
    white-space: nowrap;
}

.note-content {
    color: var(--primary-text);
    line-height: 1.6;
    white-space: pre-wrap;
    font-size: var(--font-size-base);
}

/* Cancel Button Styling */
.btn-cancel {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    background: #f8fafc;
    color: #64748b;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: var(--font-size-base);
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 44px;
}

.btn-cancel:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #475569;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-cancel:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn-cancel:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.2);
}

/* Threaded Notes and Replies */
.note-thread {
    margin-bottom: 2rem;
}

.note-actions {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #f1f5f9;
}

.reply-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: transparent;
    color: var(--secondary-text);
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.reply-btn:hover {
    background: #f8fafc;
    color: var(--primary-text);
    border-color: #cbd5e1;
}

.edit-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: transparent;
    color: #64748b;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-right: 0.5rem;
}

.edit-btn:hover {
    background: #fef3c7;
    color: #92400e;
    border-color: #fbbf24;
}

.pin-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: transparent;
    color: #64748b;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-right: 0.5rem;
}

.pin-btn:hover {
    background: #ecfdf5;
    color: #065f46;
    border-color: #10b981;
}

.unpin-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #10b981;
    border-radius: 6px;
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-right: 0.5rem;
}

.unpin-btn:hover {
    background: #d1fae5;
    border-color: #059669;
}

.reply-form {
    margin: 1rem 0;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

/* Standard reply form for top-level notes */
.note-thread > .reply-form {
    margin-left: 3rem;
}

/* Nested reply forms with progressive indentation */
.nested-reply-form[data-depth="1"] {
    margin-left: 2rem;
}

.nested-reply-form[data-depth="2"] {
    margin-left: 1.5rem;
}

.nested-reply-form[data-depth="3"] {
    margin-left: 1rem;
}

.nested-reply-form[data-depth="4"] {
    margin-left: 0.5rem;
}

.nested-reply-form[data-depth="5"] {
    margin-left: 0.25rem;
}

.reply-form-container {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.reply-avatar .avatar-circle.small {
    width: 32px;
    height: 32px;
    font-size: 12px;
}

.reply-form-content {
    flex: 1;
}

.reply-textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-family: inherit;
    font-size: var(--font-size-sm);
    line-height: 1.5;
    resize: vertical;
    transition: all 0.2s ease;
    background: var(--background-white);
}

.reply-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.reply-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: var(--font-size-sm);
    min-height: 36px;
}

.note-reply {
    position: relative;
    margin-top: 1rem;
}

/* Dynamic indentation based on depth */
.note-reply[data-depth="1"] {
    margin-left: 3rem;
}

.note-reply[data-depth="2"] {
    margin-left: 2rem;
}

.note-reply[data-depth="3"] {
    margin-left: 1.5rem;
}

.note-reply[data-depth="4"] {
    margin-left: 1rem;
}

.note-reply[data-depth="5"] {
    margin-left: 0.5rem;
}

.reply-connector {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Dynamic connector positioning based on depth */
.reply-connector[data-depth="1"] {
    left: -1.5rem;
    opacity: 0.4;
}

.reply-connector[data-depth="2"] {
    left: -1rem;
    opacity: 0.35;
}

.reply-connector[data-depth="3"] {
    left: -0.75rem;
    opacity: 0.3;
}

.reply-connector[data-depth="4"] {
    left: -0.5rem;
    opacity: 0.25;
}

.reply-connector[data-depth="5"] {
    left: -0.25rem;
    opacity: 0.2;
}

.reply-connector::before {
    content: '';
    position: absolute;
    top: 1.5rem;
    height: 2px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Dynamic connector line length based on depth */
.reply-connector[data-depth="1"]::before {
    left: -4px;
    width: 10px;
    opacity: 0.5;
}

.reply-connector[data-depth="2"]::before {
    left: -3px;
    width: 8px;
    opacity: 0.45;
}

.reply-connector[data-depth="3"]::before {
    left: -3px;
    width: 6px;
    opacity: 0.4;
}

.reply-connector[data-depth="4"]::before {
    left: -2px;
    width: 4px;
    opacity: 0.35;
}

.reply-connector[data-depth="5"]::before {
    left: -2px;
    width: 3px;
    opacity: 0.3;
}

.reply-note {
    border-left: 3px solid #e2e8f0;
    background: #fafbfc;
    padding: 1rem;
}

.reply-note .avatar-circle {
    width: 32px;
    height: 32px;
    font-size: 12px;
}

.reply-note .note-header {
    margin-bottom: 0.5rem;
}

.reply-note .note-content {
    font-size: var(--font-size-sm);
}

/* Edit Form Styles */
.edit-form {
    margin: 0.75rem 0;
    padding: 1rem;
    background: #fffbeb;
    border: 2px solid #fbbf24;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(251, 191, 36, 0.1);
}

.edit-note-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.edit-textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #fbbf24;
    border-radius: 6px;
    font-family: inherit;
    font-size: var(--font-size-base);
    line-height: 1.5;
    resize: vertical;
    transition: all 0.2s ease;
    background: var(--background-white);
    min-height: 80px;
}

.edit-textarea:focus {
    outline: none;
    border-color: #f59e0b;
    box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.2);
}

.edit-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

/* Modern Empty State */
.modern-empty {
    text-align: center;
    padding: 3rem 2rem;
    background: var(--background-white);
    border-radius: 12px;
    border: 2px dashed #e2e8f0;
}

.empty-icon {
    margin: 0 auto 1rem;
    color: #9ca3af;
}

.modern-empty h4 {
    margin: 0 0 0.5rem 0;
    color: var(--primary-text);
    font-size: var(--font-size-lg);
    font-weight: 600;
}

.modern-empty p {
    margin: 0;
    color: var(--secondary-text);
    font-size: var(--font-size-base);
}

/* Files Hierarchy */
.files-hierarchy {
    margin-top: 1rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--secondary-text);
}

.empty-state p {
    margin: 0 0 1rem 0;
    font-size: var(--font-size-base);
}

/* Matter Information Layout */
.matter-info-layout {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2rem;
    align-items: flex-start;
}

.matter-info-main {
    min-width: 0; /* Allows flex shrinking */
}

.pinned-note-sidebar {
    background: var(--background-white);
    border: 2px solid #f59e0b;
    border-radius: 12px;
    padding: 1rem;
    width: 300px;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.15);
}

.pinned-note-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 1rem 0;
    font-size: var(--font-size-base);
    font-weight: 600;
    color: #f59e0b;
}

.pinned-note-preview {
    font-size: var(--font-size-sm);
}

.pinned-note-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #fbbf24;
}

.pinned-note-author {
    font-weight: 600;
    color: var(--primary-text);
}

.pinned-note-date {
    color: var(--secondary-text);
    font-size: var(--font-size-xs);
}

.pinned-note-content {
    color: var(--primary-text);
    line-height: 1.5;
    margin-bottom: 0.75rem;
    max-height: 80px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
}

.pinned-note-meta {
    background: #fef3c7;
    color: #92400e;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: var(--font-size-xs);
    margin-bottom: 0.75rem;
    border: 1px solid #fbbf24;
}

/* Notes Actions */
.notes-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Collapsible Notes */
.initially-hidden {
    display: none;
}

.collapsible-note {
    transition: all 0.3s ease;
}

/* Compact Notes Timeline */
.notes-timeline {
    max-height: 600px;
    overflow-y: auto;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 1rem;
    background: #fafafa;
}

.notes-timeline::-webkit-scrollbar {
    width: 6px;
}

.notes-timeline::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.notes-timeline::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.notes-timeline::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* Detail Links */
.detail-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.detail-link:hover {
    text-decoration: underline;
}

/* Inbox Styles */
.inbox-content {
    padding: 2rem 0;
}

.inbox-section {
    margin-bottom: 3rem;
}

.unread-badge {
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: var(--font-size-xs);
    font-weight: 600;
    margin-left: 0.5rem;
}

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

.mention-item {
    background: var(--background-white);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    gap: 1rem;
    transition: all 0.2s ease;
    position: relative;
}

.mention-item.unread {
    border-left: 4px solid var(--primary-color);
    background: #fefefe;
    box-shadow: 0 2px 8px rgba(var(--primary-color-rgb), 0.1);
}

.mention-item.read {
    opacity: 0.8;
}

.mention-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.mention-avatar .avatar-circle {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
}

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

.mention-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

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

.mention-matter {
    color: var(--secondary-text);
    font-style: italic;
}

.mention-date {
    color: var(--secondary-text);
    font-size: var(--font-size-sm);
    margin-left: auto;
}

.mention-note-preview {
    color: var(--primary-text);
    line-height: 1.5;
    margin-bottom: 1rem;
    max-height: 120px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    background: #f8fafc;
    padding: 0.75rem;
    border-radius: 8px;
    border-left: 3px solid var(--primary-color);
    font-style: italic;
}

.mention-note-preview .mention-highlight {
    background: transparent;
    color: var(--primary-text);
    padding: 0.125rem 0.25rem;
    border-radius: 3px;
    font-weight: 700;
    font-style: normal;
    text-decoration: underline;
    text-decoration-color: var(--primary-color);
    text-underline-offset: 2px;
}

.mention-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.notification-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: var(--error-color);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

/* Icon containers for notification dots */
.header-icon-container {
    position: relative;
    display: inline-block;
}

.nav-icon-container {
    position: relative;
    display: inline-block;
}

/* Notification dots - simple red dots */
.notification-dot {
    position: absolute;
    top: -3px;
    right: -3px;
    background: var(--error-color);
    border-radius: 50%;
    width: 8px;
    height: 8px;
    border: 1px solid white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Inbox animations */
.mention-item {
    transition: all 0.3s ease;
}

.mention-item.moving {
    opacity: 0.7;
    transform: translateX(10px);
}

.inbox-section {
    transition: opacity 0.3s ease;
}

.fade-out {
    opacity: 0;
    transform: translateY(-10px);
}

/* Inbox Reply Forms */
.reply-form {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--background-body);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    animation: slideDown 0.3s ease;
}

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

.reply-input-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.reply-context {
    margin-bottom: 0.25rem;
}

.reply-label {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    font-weight: 500;
}

.reply-textarea {
    width: 100%;
    min-height: 80px;
    padding: 0.75rem;
    border: 1px solid var(--border-medium);
    border-radius: 6px;
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    line-height: 1.5;
    resize: vertical;
    transition: border-color 0.2s ease;
}

.reply-textarea:focus {
    outline: none;
    border-color: var(--primary-brand);
    box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
}

.reply-textarea::placeholder {
    color: var(--text-muted);
}

.reply-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.reply-actions .btn-sm {
    min-width: 80px;
}

/* Mention actions spacing */
.mention-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Button styling for mention actions */
.mention-actions .btn-sm {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: var(--font-size-xs);
    padding: 0.375rem 0.75rem;
    min-height: 32px;
}

.mention-actions .btn-sm svg {
    flex-shrink: 0;
}

/* Reply button - blue theme */
.btn-reply {
    background: transparent;
    color: var(--primary-brand);
    border: 1px solid var(--primary-brand);
    border-radius: 6px;
    transition: all 0.2s ease;
}

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

/* Mark read button - green theme */
.btn-mark-read {
    background: transparent;
    color: #28a745;
    border: 1px solid #28a745;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.btn-mark-read:hover {
    background: #28a745;
    color: white;
}

/* Mark all read button in header */
.btn-mark-all-read {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: #28a745;
    color: white;
    border: 1px solid #28a745;
    border-radius: 6px;
    padding: 0.5rem 1rem;
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-mark-all-read:hover {
    background: #218838;
    border-color: #218838;
    transform: translateY(-1px);
}

.btn-mark-all-read svg {
    flex-shrink: 0;
}

/* Inbox Link in Header */
.inbox-link {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    color: var(--secondary-text);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.inbox-link:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--primary-color);
}

.inbox-link svg {
    transition: transform 0.2s ease;
}

.inbox-link:hover svg {
    transform: scale(1.1);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Mention highlighting in notes */
.mention-highlight {
    background: #3b82f6;
    color: white;
    padding: 0.125rem 0.25rem;
    border-radius: 4px;
    font-weight: 500;
    font-size: 0.9em;
}

/* Mention Autocomplete Dropdown */
.textarea-container {
    position: relative;
}

.mention-autocomplete {
    position: absolute;
    background: var(--background-white);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-height: 200px;
    overflow-y: auto;
    min-width: 250px;
}

.autocomplete-header {
    padding: 0.5rem 0.75rem;
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--secondary-text);
    border-bottom: 1px solid var(--border-light);
    background: #f8fafc;
}

.autocomplete-list {
    max-height: 150px;
    overflow-y: auto;
}

.autocomplete-item {
    padding: 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    transition: background-color 0.15s ease;
}

.autocomplete-item:hover,
.autocomplete-item.selected,
.autocomplete-item:focus {
    background: #f1f5f9;
    outline: 2px solid #3b82f6;
    outline-offset: -2px;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

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

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

.user-details {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-weight: 600;
    color: var(--primary-text);
    font-size: var(--font-size-sm);
    margin-bottom: 0.125rem;
}

.user-username {
    color: var(--secondary-text);
    font-size: var(--font-size-xs);
}

/* Note highlighting for inbox navigation */
.note-highlighted {
    position: relative;
    background: linear-gradient(135deg, #fef3c7 0%, #fef9e7 100%) !important;
    border: 2px solid #f59e0b !important;
    box-shadow: 0 8px 25px rgba(245, 158, 11, 0.3), 0 4px 10px rgba(245, 158, 11, 0.2) !important;
    transform: scale(1.02);
    transition: all 0.6s ease;
    animation: noteHighlightPulse 1.5s ease-in-out;
}

.note-highlighted::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    background: linear-gradient(45deg, #f59e0b, #fbbf24, #f59e0b);
    border-radius: 15px;
    z-index: -1;
    animation: noteHighlightGlow 2s ease-in-out infinite alternate;
}

@keyframes noteHighlightPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 2px 4px rgba(245, 158, 11, 0.1);
    }
    50% {
        transform: scale(1.03);
        box-shadow: 0 12px 30px rgba(245, 158, 11, 0.4);
    }
    100% {
        transform: scale(1.02);
        box-shadow: 0 8px 25px rgba(245, 158, 11, 0.3);
    }
}

@keyframes noteHighlightGlow {
    0% {
        opacity: 0.3;
        transform: scale(1);
    }
    100% {
        opacity: 0.1;
        transform: scale(1.02);
    }
}

/* Responsive Design for Detail Page */
@media (max-width: 768px) {
    .detail-container {
        padding: 1rem;
    }
    
    .detail-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .detail-actions {
        width: 100%;
        justify-content: flex-start;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
    
    .section-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .matter-info-layout {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .pinned-note-sidebar {
        width: 100%;
        order: -1; /* Show pinned note on top on mobile */
    }
    
    .notes-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .notes-timeline {
        max-height: 400px;
    }
}