/**
 * Case Flow Lifecycle Manager - Modern Portal Design System
 * 
 * A standalone, theme-independent design system with:
 * - Scoped CSS Reset
 * - Modern Typography (Inter)
 * - Glassmorphism & Premium Aesthetics
 * - Robust Layout Engine
 */

/* Import Inter Font */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ===== SCOPED RESET & VARIABLES ===== */
#case-flow-portal-app {
    /* Design Tokens */
    --cf-font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    /* Brand Colors - Amos PLLC (Red/Burgundy) */
    --cf-primary: #D32F2F;
    /* Amos Red */
    --cf-primary-hover: #B71C1C;
    /* Darker Red */
    --cf-secondary: #5d6778;
    /* Slate-600 */

    /* Stage Colors (Semantic) */
    --cf-stage-intake: #1976D2;
    /* Blue-700 */
    --cf-stage-processed: #F57C00;
    /* Orange-700 */
    --cf-stage-attorney-ready: #7B1FA2;
    /* Purple-700 */
    --cf-stage-trial-ready: #388E3C;
    /* Green-700 */
    --cf-stage-results: #D32F2F;
    /* Red-700 */
    --cf-stage-archive: #616161;
    /* Grey-700 */

    /* Backgrounds & Surfaces */
    --cf-bg-body: #f1f5f9;
    --cf-bg-sidebar: #7f1d1d;
    /* Deep Burgundy Sidebar */
    --cf-bg-surface: #ffffff;
    --cf-bg-glass: rgba(255, 255, 255, 0.95);

    /* Text Colors */
    --cf-text-main: #0f172a;
    /* Slate-900 */
    --cf-text-muted: #64748b;
    /* Slate-500 */
    --cf-text-light: #f8fafc;
    /* Slate-50 */
    --cf-text-on-primary: #ffffff;

    /* Spacing & Layout */
    --cf-spacing-xs: 0.25rem;
    --cf-spacing-sm: 0.5rem;
    --cf-spacing-md: 1rem;
    --cf-spacing-lg: 1.5rem;
    --cf-spacing-xl: 2rem;

    /* Effects */
    --cf-radius-sm: 0.375rem;
    --cf-radius-md: 0.5rem;
    --cf-radius-lg: 0.75rem;
    --cf-radius-xl: 1rem;
    --cf-shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --cf-shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --cf-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --cf-shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

    /* Layout Reset */
    all: initial;
    /* Resets inherited properties */
    font-family: var(--cf-font-sans);
    color: var(--cf-text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    box-sizing: border-box;
    display: block;
    width: 100%;
    min-height: 100vh;
    background: var(--cf-bg-body);
}

/* Ensure all children use border-box */
#case-flow-portal-app *,
#case-flow-portal-app *::before,
#case-flow-portal-app *::after {
    box-sizing: border-box;
    font-family: var(--cf-font-sans);
    /* Force font inheritance */
}

/* ===== LAYOUT ENGINE ===== */

/* Portal wrapper to break out of theme constraints if needed */
.case-flow-portal {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
    width: 100%;
}

/* Sidebar Styling */
.case-flow-nav {
    background: var(--cf-bg-sidebar);
    color: var(--cf-text-light);
    height: 100vh;
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    z-index: 50;
    box-shadow: var(--cf-shadow-lg);
}

.nav-header {
    padding: var(--cf-spacing-lg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-header h1 {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    background: linear-gradient(135deg, #a5b4fc, #e0e7ff);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.025em;
}

.nav-menu {
    flex: 1;
    padding: var(--cf-spacing-md);
    overflow-y: auto;
    list-style: none;
    /* Reset list style */
    margin: 0;
    /* Reset margin */
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--cf-spacing-md);
    padding: var(--cf-spacing-md);
    margin-bottom: var(--cf-spacing-xs);
    border-radius: var(--cf-radius-md);
    color: #94a3b8;
    /* Muted text */
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #f8fafc;
}

.nav-item.active {
    background: var(--cf-primary);
    color: white;
    box-shadow: var(--cf-shadow-md);
}

.nav-label {
    flex: 1;
    font-size: 0.95rem;
}

.nav-badge {
    background: rgba(0, 0, 0, 0.2);
    padding: 0.125rem 0.5rem;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
}

.nav-item.active .nav-badge {
    background: rgba(255, 255, 255, 0.2);
}

/* Main Content Area */
.case-flow-content {
    padding: var(--cf-spacing-xl);
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
}

.view-container {
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.view-header {
    margin-bottom: var(--cf-spacing-xl);
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.view-header h2 {
    font-size: 2rem;
    font-weight: 800;
    color: var(--cf-text-main);
    margin: 0 0 var(--cf-spacing-xs) 0;
    letter-spacing: -0.025em;
}

.view-header p {
    color: var(--cf-text-muted);
    margin: 0;
    font-size: 1.1rem;
}

/* ===== COMPONENT SYSTEM ===== */

/* Modern Cards */
.cases-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: var(--cf-spacing-lg);
}

.case-card {
    background: var(--cf-bg-surface);
    border-radius: var(--cf-radius-xl);
    padding: var(--cf-spacing-lg);
    box-shadow: var(--cf-shadow-sm);
    border: 1px solid #e2e8f0;
    /* Slate-200 */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.case-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--cf-shadow-xl);
    border-color: #cbd5e1;
    /* Slate-300 */
}

/* Top Border Accent */
.case-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--cf-primary), #818cf8);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.case-card:hover::before {
    opacity: 1;
}

.case-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--cf-spacing-lg);
}

.case-card-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--cf-text-main);
    margin: 0;
    line-height: 1.4;
}

/* Status Badges */
.lifecycle-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.75rem;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.lifecycle-badge svg {
    width: 12px;
    height: 12px;
}

/* Info Rows */
.case-info .info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--cf-spacing-sm) 0;
    border-bottom: 1px solid #f1f5f9;
}

.case-info .label {
    color: var(--cf-text-muted);
    font-size: 0.875rem;
    font-weight: 500;
}

.case-info .value {
    color: var(--cf-text-main);
    font-weight: 600;
    font-size: 0.95rem;
}

/* Primary Action Button */
.primary-action-btn {
    width: 100%;
    margin-top: var(--cf-spacing-lg);
    padding: 0.75rem;
    background: var(--cf-bg-body);
    color: var(--cf-primary);
    border: 1px solid #e2e8f0;
    border-radius: var(--cf-radius-lg);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

.primary-action-btn:hover {
    background: var(--cf-primary);
    color: white;
    border-color: var(--cf-primary);
    box-shadow: var(--cf-shadow-md);
}

/* Create Case Floating Button */
.create-case-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--cf-primary);
    color: white;
    padding: 1rem 2rem;
    border-radius: 99px;
    font-weight: 700;
    box-shadow: var(--cf-shadow-lg);
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.create-case-btn:hover {
    transform: translateY(-2px) scale(1.05);
    background: var(--cf-primary-hover);
    box-shadow: 0 20px 30px -10px rgba(79, 70, 229, 0.5);
}

/* ===== MODALS & OVERLAYS ===== */
.case-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    /* Slate-900 / 60% */
    backdrop-filter: blur(8px);
    z-index: 9999;
    /* High Z-Index to stay on top */
    display: flex;
    justify-content: center;
    align-items: center;
    padding: var(--cf-spacing-lg);
}

.case-modal {
    background: var(--cf-bg-surface);
    border-radius: var(--cf-radius-2xl, 1.5rem);
    width: 100%;
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--cf-shadow-2xl, 0 25px 50px -12px rgb(0 0 0 / 0.25));
    animation: modalSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    padding: var(--cf-spacing-xl);
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    z-index: 10;
}

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 800;
    margin: 0;
}

.modal-close {
    background: #f1f5f9;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.25rem;
    color: var(--cf-text-muted);
    transition: all 0.2s;
}

.modal-close:hover {
    background: #e2e8f0;
    color: var(--cf-text-main);
}

.modal-body {
    padding: var(--cf-spacing-xl);
}

.modal-section {
    margin-bottom: var(--cf-spacing-xl);
    padding-bottom: var(--cf-spacing-xl);
    border-bottom: 1px dashed #e2e8f0;
}

.modal-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.modal-section h3 {
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--cf-text-muted);
    margin-bottom: var(--cf-spacing-lg);
}

/* Form Styles */
.form-group {
    margin-bottom: var(--cf-spacing-lg);
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--cf-text-main);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: var(--cf-radius-lg);
    font-size: 1rem;
    transition: all 0.2s;
    background: #f8fafc;
}

.form-control:focus {
    outline: none;
    border-color: var(--cf-primary);
    background: white;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

/* Action Buttons */
.form-actions {
    display: flex;
    gap: var(--cf-spacing-md);
    margin-top: var(--cf-spacing-xl);
}

.btn {
    padding: 0.75rem 1.5rem;
    border-radius: var(--cf-radius-lg);
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    font-size: 1rem;
}

.btn-primary {
    background: var(--cf-primary);
    color: white;
    box-shadow: var(--cf-shadow-md);
}

.btn-primary:hover {
    background: var(--cf-primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: white;
    border: 1px solid #e2e8f0;
    color: var(--cf-text-main);
}

.btn-secondary:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

/* ===== AUTH PAGES ===== */
.case-flow-auth-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: var(--cf-spacing-lg);
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

.case-flow-auth-container {
    background: white;
    border-radius: 1.5rem;
    box-shadow: 0 50px 100px -20px rgba(50, 50, 93, 0.25);
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    max-width: 1100px;
    width: 100%;
    overflow: hidden;
}

.case-flow-auth-column {
    padding: 3rem;
}

.login-column {
    background: white;
}

.register-column {
    background: #f8fafc;
}

.case-flow-auth-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 0;
    z-index: 10;
}

.divider-text {
    background: white;
    padding: 0.5rem;
    border-radius: 50%;
    border: 1px solid #e2e8f0;
    color: #94a3b8;
    font-weight: 600;
    font-size: 0.8rem;
    box-shadow: var(--cf-shadow-md);
}

/* ===== UTILITIES ===== */
.cf-text-center {
    text-align: center;
}

.cf-mb-4 {
    margin-bottom: 2rem;
}

.cf-fw-bold {
    font-weight: 700;
}

/* Responsive */
@media (max-width: 900px) {
    .case-flow-portal {
        grid-template-columns: 1fr;
    }

    .case-flow-nav {
        height: auto;
        position: relative;
    }

    .case-flow-auth-container {
        grid-template-columns: 1fr;
    }

    .case-flow-auth-divider {
        width: 100%;
        height: 40px;
    }

    /* Tabbed modal responsive */
    .modal-content-wrapper {
        flex-direction: column;
    }

    .modal-tabs {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.5rem;
        padding: 0.75rem;
    }

    .tab-btn {
        flex: 1 1 auto;
        text-align: center;
    }
}

/* ===== TABBED MODAL SYSTEM ===== */

/* Modal with tabbed layout */
.case-modal-tabbed {
    max-width: 1000px !important;
    max-height: 90vh;
}

.case-modal-tabbed .modal-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
}

.case-modal-tabbed .modal-header h2 {
    flex: 1;
    margin: 0;
    font-size: 1.25rem;
}

.modal-header-info {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.modal-content-wrapper {
    display: flex;
    min-height: 500px;
    max-height: calc(90vh - 80px);
}

/* Tab Navigation Sidebar */
.modal-tabs {
    width: 200px;
    min-width: 200px;
    background: #f8fafc;
    border-right: 1px solid #e2e8f0;
    padding: 1rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    overflow-y: auto;
}

.tab-btn {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    text-align: left;
    background: transparent;
    border: none;
    border-radius: var(--cf-radius-md);
    color: var(--cf-text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    background: #e2e8f0;
    color: var(--cf-text-main);
}

.tab-btn.active {
    background: var(--cf-primary);
    color: white;
}

.tab-btn.tab-highlight {
    border: 2px solid #f59e0b;
    animation: pulse-highlight 2s infinite;
}

@keyframes pulse-highlight {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4);
    }

    50% {
        box-shadow: 0 0 0 6px rgba(245, 158, 11, 0);
    }
}

/* Tab Content Area */
.case-modal-tabbed .modal-body {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    max-height: calc(90vh - 80px);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tab-content h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 1.25rem 0;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #e2e8f0;
    color: var(--cf-text-main);
}

.highlighted-section {
    background: linear-gradient(135deg, #fef3c7 0%, #fef9c3 100%);
    border: 2px solid #f59e0b;
    border-radius: var(--cf-radius-lg);
    padding: 1rem !important;
    margin: -0.5rem;
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.75rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.status-red {
    background: #fee2e2;
    color: #dc2626;
}

.status-green {
    background: #dcfce7;
    color: #16a34a;
}

.status-yellow {
    background: #fef3c7;
    color: #ca8a04;
}

.status-blue {
    background: #dbeafe;
    color: #2563eb;
}

.status-gray {
    background: #f1f5f9;
    color: #64748b;
}

.status-default {
    background: #f1f5f9;
    color: #475569;
}

/* Read-only Sections */
.readonly-section {
    background: #f8fafc;
    border-radius: var(--cf-radius-md);
    padding: 1rem;
    border: 1px solid #e2e8f0;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.info-item {
    padding: 0.75rem;
    background: white;
    border-radius: var(--cf-radius-sm);
    border: 1px solid #e2e8f0;
}

.info-item span {
    display: block;
    color: var(--cf-text-muted);
    font-size: 0.8rem;
    margin-bottom: 0.25rem;
}

.info-item strong {
    color: var(--cf-text-main);
    font-weight: 600;
}

.info-item p {
    margin: 0;
    color: var(--cf-text-main);
    font-size: 0.9rem;
    line-height: 1.5;
}

.info-item.full-width {
    grid-column: span 2;
}

/* Currency Input with Prefix */
.input-with-prefix {
    display: flex;
    align-items: stretch;
}

.input-prefix {
    display: flex;
    align-items: center;
    padding: 0 0.75rem;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-right: none;
    border-radius: var(--cf-radius-md) 0 0 var(--cf-radius-md);
    color: var(--cf-text-muted);
    font-weight: 600;
}

.input-with-prefix .form-control {
    border-radius: 0 var(--cf-radius-md) var(--cf-radius-md) 0;
}

/* Required Field Indicator */
.required {
    color: #ef4444;
    font-weight: 700;
}

/* Sticky Form Actions */
.form-actions-sticky {
    position: sticky;
    bottom: 0;
    background: white;
    padding: 1rem 0;
    margin-top: 1.5rem;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 0.75rem;
    z-index: 10;
}

/* Date Picker Styling */
input[type="date"].date-picker,
input[type="datetime-local"].date-picker {
    cursor: pointer;
}

input[type="date"].date-picker::-webkit-calendar-picker-indicator,
input[type="datetime-local"].date-picker::-webkit-calendar-picker-indicator {
    background: transparent;
    cursor: pointer;
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
}

/* ===== FILE UPLOAD SYSTEM ===== */

/* File Upload Dropzone */
.file-upload-area {
    margin-bottom: 1rem;
}

.file-upload-dropzone {
    border: 2px dashed #cbd5e1;
    border-radius: var(--cf-radius-lg);
    padding: 2rem;
    text-align: center;
    background: #f8fafc;
    transition: all 0.2s ease;
    cursor: pointer;
}

.file-upload-dropzone:hover,
.file-upload-dropzone.dragover {
    border-color: var(--cf-primary);
    background: #eef2ff;
}

.file-upload-dropzone .upload-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 0.5rem;
}

.file-upload-dropzone p {
    margin: 0;
    color: var(--cf-text-muted);
}

.file-upload-dropzone .upload-link {
    color: var(--cf-primary);
    cursor: pointer;
    font-weight: 600;
    text-decoration: underline;
}

.file-input-hidden {
    display: none;
}

/* Upload Progress */
.upload-progress {
    margin-top: 1rem;
    padding: 1rem;
    background: #f1f5f9;
    border-radius: var(--cf-radius-md);
}

.progress-bar {
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--cf-primary), #818cf8);
    width: 50%;
    animation: progress-indeterminate 1.5s infinite;
}

@keyframes progress-indeterminate {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(200%);
    }
}

.progress-text {
    display: block;
    text-align: center;
    margin-top: 0.5rem;
    color: var(--cf-text-muted);
    font-size: 0.875rem;
}

/* Files List */
.files-list {
    border: 1px solid #e2e8f0;
    border-radius: var(--cf-radius-md);
    background: white;
    max-height: 200px;
    overflow-y: auto;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e2e8f0;
}

.file-item:last-child {
    border-bottom: none;
}

.file-item .file-icon {
    font-size: 1.25rem;
}

.file-item .file-name {
    flex: 1;
    font-weight: 500;
    color: var(--cf-text-main);
    word-break: break-all;
}

.file-item .btn-view,
.file-item .btn-download {
    padding: 0.35rem 0.5rem;
    font-size: 0.8rem;
    text-decoration: none;
    border-radius: var(--cf-radius-sm);
    transition: background 0.2s;
}

.file-item .btn-view {
    background: #dbeafe;
    color: #2563eb;
}

.file-item .btn-view:hover {
    background: #bfdbfe;
}

.file-item .btn-download {
    background: #dcfce7;
    color: #16a34a;
}

.file-item .btn-download:hover {
    background: #bbf7d0;
}

.file-item .btn-delete-file {
    background: #fee2e2;
    color: #dc2626;
    border: none;
    padding: 0.35rem 0.5rem;
    border-radius: var(--cf-radius-sm);
    cursor: pointer;
    font-size: 0.8rem;
    transition: background 0.2s;
}

.file-item .btn-delete-file:hover {
    background: #fecaca;
}

.no-files {
    padding: 1.5rem;
    text-align: center;
    color: #999;
    font-style: italic;
}

/* File "View All" Button */
.file-view-all {
    padding: 0.75rem;
    text-align: center;
    border-top: 1px dashed #e5e7eb;
    margin-top: 0.5rem;
}

.btn-view-all {
    background: transparent;
    border: none;
    color: var(--cf-primary);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    padding: 0.5rem 1rem;
    border-radius: var(--cf-radius-sm);
    transition: all 0.2s ease;
}

.btn-view-all:hover {
    background: var(--cf-primary-light);
    color: var(--cf-primary);
    transform: translateY(-1px);
}

/* ===== SKELETON LOADING ===== */
.skeleton-loader-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: var(--cf-spacing-lg);
    padding: var(--cf-spacing-lg);
}

.skeleton-card {
    background: var(--cf-bg-surface);
    border-radius: var(--cf-radius-xl);
    border: 1px solid #e2e8f0;
    padding: var(--cf-spacing-md);
    height: 320px;
    display: flex;
    flex-direction: column;
    gap: var(--cf-spacing-md);
}

.skeleton-pulse {
    background: linear-gradient(90deg, #f1f5f9 0%, #e2e8f0 50%, #f1f5f9 100%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--cf-radius-sm);
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.skeleton-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--cf-spacing-md);
}

.skeleton-title {
    height: 24px;
    width: 60%;
    border-radius: var(--cf-radius-md);
}

.skeleton-badge {
    height: 24px;
    width: 80px;
    border-radius: 99px;
}

.skeleton-row {
    height: 16px;
    width: 100%;
    margin-bottom: 8px;
}

.skeleton-row:nth-child(2) {
    width: 90%;
}

.skeleton-row:nth-child(3) {
    width: 75%;
}

.skeleton-footer {
    margin-top: auto;
    height: 40px;
    width: 100%;
    border-radius: var(--cf-radius-lg);
}

/* Button Styles & Alignment */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: var(--cf-radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.95rem;
    line-height: 1;
    white-space: nowrap;
    min-width: 100px;
}

.btn-primary {
    background-color: var(--cf-primary);
    color: white !important;
}

.btn-primary:hover {
    background-color: var(--cf-primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: #f1f5f9;
    color: #475569 !important;
    border: 1px solid #cbd5e1;
}

.btn-secondary:hover {
    background-color: #e2e8f0;
    color: #1e293b !important;
}

.btn-danger {
    background-color: #dc3545;
    color: white !important;
}

.btn-danger:hover {
    background-color: #c82333;
}

.form-actions-sticky {
    padding: var(--cf-spacing-md);
    background: white;
    border-top: 1px solid #e2e8f0;
    position: sticky;
    bottom: -1px;
    margin: 0 calc(var(--cf-spacing-lg) * -1);
    margin-bottom: calc(var(--cf-spacing-lg) * -1);
    border-radius: 0 0 var(--cf-radius-xl) var(--cf-radius-xl);
    z-index: 10;

    /* Flex alignment */
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* ===== FILTER PANEL STYLES ===== */
.filter-panel {
    background: var(--cf-bg-surface);
    border-radius: var(--cf-radius-lg);
    box-shadow: var(--cf-shadow-sm);
    margin-bottom: var(--cf-spacing-lg);
    overflow: hidden;
    transition: all 0.3s ease;
}

.filter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 1px solid var(--cf-border-color);
}

.btn-toggle-filters {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    font-family: var(--cf-font-sans);
    font-size: 14px;
    font-weight: 600;
    color: var(--cf-text-main);
    cursor: pointer;
    padding: 6px 12px;
    border-radius: var(--cf-radius-md);
    transition: all 0.2s;
}

.btn-toggle-filters:hover {
    background: rgba(0, 0, 0, 0.05);
}

.toggle-icon {
    font-size: 12px;
    transition: transform 0.3s;
}

.filter-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: var(--cf-primary);
    color: white;
    font-size: 11px;
    font-weight: 700;
    border-radius: 10px;
}

.btn-clear-all-filters {
    background: transparent;
    border: 1px solid var(--cf-border-color);
    color: var(--cf-text-secondary);
    font-size: 12px;
    font-weight: 500;
    padding: 4px 12px;
    border-radius: var(--cf-radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-clear-all-filters:hover:not(:disabled) {
    background: var(--cf-primary);
    color: white;
    border-color: var(--cf-primary);
}

.btn-clear-all-filters:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.filter-body {
    padding: 16px;
    display: none;
}

.filter-panel.expanded .filter-body {
    display: block;
}

.filter-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 16px;
    align-items: start;
}

.filter-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-item label {
    font-size: 13px;
    font-weight: 600;
    color: var(--cf-text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.filter-input,
.filter-select {
    width: 100%;
    padding: 10px 12px;
    font-family: var(--cf-font-sans);
    font-size: 14px;
    border: 1px solid #d1d5db;
    border-radius: var(--cf-radius-md);
    background: #f9fafb;
    /* Light gray background */
    color: var(--cf-text-main);
    transition: all 0.2s;
}

.filter-input:focus,
.filter-select:focus {
    outline: none;
    border-color: var(--cf-primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(211, 47, 47, 0.1);
}

.filter-input::placeholder {
    color: #9ca3af;
    /* Lighter placeholder */
}

/* Better styling for select dropdowns */
.filter-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

.btn-sort-order {
    width: 100%;
    padding: 10px 12px;
    font-family: var(--cf-font-sans);
    font-size: 13px;
    font-weight: 500;
    background: white;
    border: 1px solid var(--cf-border-color);
    border-radius: var(--cf-radius-md);
    color: var(--cf-text-main);
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.btn-sort-order:hover {
    background: #f8f9fa;
    border-color: var(--cf-primary);
}

.case-count {
    font-size: 13px;
    color: var(--cf-text-muted);
    font-weight: 500;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .filter-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

/* Additional Filter Components */
.filter-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.filter-full-width {
    grid-column: 1 / -1;
}

.quick-filters-row {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.btn-quick-date {
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 500;
    background: white;
    border: 1px solid var(--cf-border-color);
    border-radius: var(--cf-radius-sm);
    color: var(--cf-text-main);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-quick-date:hover {
    background: var(--cf-primary);
    color: white;
    border-color: var(--cf-primary);
}

.status-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 8px;
    margin-top: 8px;
}

.status-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border: 1px solid var(--cf-border-color);
    border-radius: var(--cf-radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.status-checkbox-label:hover {
    background: #f8f9fa;
}

.status-checkbox-label input[type="checkbox"] {
    cursor: pointer;
}

.preset-save-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.preset-save-row .filter-input {
    flex: 1;
}

.btn-save-preset {
    padding: 10px 20px;
    background: var(--cf-primary);
    color: white;
    border: none;
    border-radius: var(--cf-radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-save-preset:hover {
    background: var(--cf-primary-hover);
}

.preset-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 150px;
    overflow-y: auto;
}

.preset-item {
    display: flex;
    gap: 6px;
    align-items: center;
}

.btn-load-preset {
    flex: 1;
    text-align: left;
    padding: 8px 12px;
    background: white;
    border: 1px solid var(--cf-border-color);
    border-radius: var(--cf-radius-sm);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-load-preset:hover {
    background: #f8f9fa;
    border-color: var(--cf-primary);
}

.btn-delete-preset {
    width: 28px;
    height: 28px;
    padding: 0;
    background: transparent;
    border: 1px solid var(--cf-border-color);
    border-radius: var(--cf-radius-sm);
    color: var(--cf-text-secondary);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-delete-preset:hover {
    background: var(--cf-primary);
    color: white;
    border-color: var(--cf-primary);
}

/* ===================================================================
   COMPREHENSIVE MOBILE & TABLET RESPONSIVE DESIGN
   ================================================================= */

/* ===== TABLET (768px - 1024px) ===== */
@media (max-width: 1024px) {
    .cases-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .case-flow-modal-content {
        width: 90%;
        max-width: 700px;
        margin: 20px;
    }

    .case-flow-nav {
        width: 200px;
    }
}

/* ===== MOBILE (max-width: 767px) ===== */
@media (max-width: 767px) {
    .case-flow-portal {
        grid-template-columns: 1fr;
    }

    .case-flow-nav {
        width: 100%;
        height: auto;
        position: sticky;
        top: 0;
        z-index: 100;
        overflow-x: auto;
    }

    .nav-list {
        display: flex;
        flex-direction: row;
        gap: 0;
        padding: 8px;
    }

    .nav-link {
        white-space: nowrap;
        padding: 10px 16px;
        font-size: 13px;
        flex-shrink: 0;
    }

    .cases-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 12px;
    }

    .case-card {
        padding: 14px;
    }

    .case-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .case-flow-modal-content {
        width: 100%;
        height: 100vh;
        max-width: 100%;
        margin: 0;
        border-radius: 0;
    }

    .modal-header {
        position: sticky;
        top: 0;
        z-index: 10;
        background: white;
    }

    .modal-tabs {
        width: 100%;
        overflow-x: auto;
        padding: 0 12px;
    }

    .modal-tab {
        flex-shrink: 0;
        font-size: 13px;
    }

    .modal-body {
        padding: 16px;
    }

    .form-grid,
    .form-row {
        grid-template-columns: 1fr;
    }

    .filter-row {
        grid-template-columns: 1fr;
    }

    .quick-filters-row {
        flex-wrap: wrap;
    }

    .status-checkbox-grid {
        grid-template-columns: 1fr;
    }

    .modal-actions {
        flex-direction: column;
    }

    .modal-actions .btn {
        width: 100%;
    }

    .view-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

/* ===== SMALL MOBILE (max-width: 480px) ===== */
@media (max-width: 480px) {
    .case-card {
        padding: 12px;
    }

    .case-card-title {
        font-size: 14px;
    }

    .form-input,
    .form-select {
        font-size: 14px;
        padding: 8px 10px;
    }

    .btn {
        font-size: 13px;
        padding: 8px 14px;
    }
}

/* ===== TOUCH DEVICE OPTIMIZATIONS ===== */
@media (hover: none) and (pointer: coarse) {

    .btn,
    .nav-link {
        min-height: 44px;
    }
}