/* Kangtao.ai Styles - Modern Malaysian Tender Hunter */

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

:root {
    /* Dark Theme Color Palette - Matching Target Design */
    --primary-color: #14b8a6; /* Teal */
    --primary-hover: #0f766e;
    --secondary-color: #1e40af; /* Blue */
    --secondary-hover: #1d4ed8;
    --accent-color: #f59e0b; /* Amber */
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    
    /* Deep Dark Theme Colors - Matching Perplexity Style */
    --background-color: #0a0a0a; /* Very deep black background */
    --surface-color: #1a1a1a; /* Dark surface */
    --card-color: #1a1a1a; /* Dark card background */
    --border-color: #14b8a6; /* Teal border */
    --text-primary: #ffffff; /* White text */
    --text-secondary: #d1d5db; /* Light secondary text */
    --text-muted: #9ca3af;
    
    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;
    
    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
    
    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    
    /* Shadows - Enhanced for dark theme */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.3);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5), 0 4px 6px -4px rgb(0 0 0 / 0.4);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.6), 0 8px 10px -6px rgb(0 0 0 / 0.5);
}

/* Base Typography */
body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--background-color);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
}

/* Header - Premium Dark Theme */
.header {
    background: #0f0f0f; /* Even darker than main background for subtle depth */
    color: white;
    padding: var(--spacing-xl) 0;
    box-shadow: none;
    border-bottom: 1px solid #1f1f1f; /* Subtle separator */
}

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

/* Logo Container */
.logo-container {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.logo-image {
    height: 80px;
    width: 80px;
    object-fit: contain;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.logo-image:hover {
    transform: scale(1.05);
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo h1 {
    font-size: var(--font-size-3xl);
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
    letter-spacing: -0.025em;
    margin: 0;
}

.tagline {
    font-size: var(--font-size-base);
    opacity: 0.9;
    font-weight: 400;
    margin: 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    background: rgba(255, 255, 255, 0.05); /* More subtle background */
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    border: 1px solid rgba(255, 255, 255, 0.1); /* Subtle border */
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--warning-color);
    animation: pulse 2s infinite;
}

.status-dot.connected {
    background: var(--success-color);
    animation: none;
}

.status-dot.error {
    background: var(--error-color);
}

/* Main Content */
.main {
    padding: var(--spacing-lg) 0;
    min-height: calc(100vh - 200px);
}

/* Hero Section - Compact Design for Content-First Approach */
.hero {
    text-align: center;
    margin-bottom: var(--spacing-sm);
    padding: var(--spacing-sm) 0; /* Further reduced padding for tighter spacing */
    background: #1f2937; /* Darker hero background for deep theme */
    border-radius: var(--radius-lg); /* Slightly smaller radius */
    margin: var(--spacing-sm) 0; /* Further reduced margin */
    border: 1px solid #374151;
    position: relative; /* For integrated counter */
}

.hero h2 {
    font-size: var(--font-size-xl); /* Reduced from 2xl to xl */
    font-weight: 600;
    margin-bottom: var(--spacing-sm); /* Reduced spacing */
    color: var(--text-primary); /* White text on dark hero background */
}

.hero p {
    font-size: var(--font-size-sm); /* Reduced from base to sm */
    color: var(--text-secondary); /* Light text on dark hero background */
    margin-bottom: 0;
    max-width: 600px; /* Reduced width for more concise look */
    margin-left: auto;
    margin-right: auto;
    line-height: 1.5; /* Slightly tighter line height */
}

/* Integrated Opportunities Counter in Hero */
.hero-opportunities-counter {
    background: rgba(20, 184, 166, 0.1);
    border: 1px solid rgba(20, 184, 166, 0.3);
    border-radius: var(--radius-md);
    padding: var(--spacing-sm) var(--spacing-md);
    margin-top: var(--spacing-md);
    display: inline-block;
    font-size: var(--font-size-xs);
    color: var(--primary-color);
    font-weight: 500;
}

.hero-opportunities-counter .count-highlight {
    color: var(--text-primary);
    font-weight: 600;
}

.hero-opportunities-counter .status-text {
    color: var(--text-secondary);
    margin-left: var(--spacing-sm);
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: var(--spacing-xl);
    margin-top: var(--spacing-xl);
}

/* Floating Waitlist Widget - Bottom Right Corner */
.waitlist-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    font-family: var(--font-family);
}

.waitlist-toggle {
    background: var(--primary-color);
    color: white;
    border-radius: 50px;
    padding: 14px 20px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(20, 184, 166, 0.3);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center; /* Center content horizontally */
    gap: 8px;
    font-size: var(--font-size-sm);
    font-weight: 500;
}

.waitlist-toggle:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(20, 184, 166, 0.4);
}

.waitlist-toggle i {
    font-size: 16px;
}

.waitlist-form-container {
    position: absolute;
    bottom: 70px;
    right: 0;
    background: var(--surface-color);
    border: 1px solid #374151;
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    min-width: 320px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

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

.waitlist-form {
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
}

.waitlist-form input[type="email"] {
    flex: 1;
    padding: 12px 16px;
    background: #374151;
    border: 1px solid #6b7280;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: var(--font-size-base);
    font-family: var(--font-family);
    transition: all 0.2s ease;
}

.waitlist-form input[type="email"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(20, 184, 166, 0.2);
}

.waitlist-form input[type="email"]::placeholder {
    color: var(--text-muted);
}

.btn-waitlist {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-family: var(--font-family);
}

.btn-waitlist:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-waitlist:active {
    transform: translateY(0);
}

.btn-waitlist:disabled {
    background: #6b7280;
    cursor: not-allowed;
    transform: none;
}

.waitlist-label {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    text-align: center;
    margin: 0;
}

.waitlist-message {
    margin-top: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    text-align: center;
    font-weight: 500;
}

.waitlist-message.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.waitlist-message.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error-color);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Feedback Widget Styles */
.feedback-widget {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 1000;
    font-family: var(--font-family);
}

.feedback-toggle {
    background: var(--primary-color);
    color: white;
    border-radius: 50px;
    padding: 14px 20px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(20, 184, 166, 0.3);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: var(--font-size-sm);
    font-weight: 500;
}

.feedback-toggle:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(20, 184, 166, 0.4);
}

.feedback-toggle i {
    font-size: 16px;
}

.feedback-form-container {
    position: absolute;
    bottom: 70px;
    left: 0;
    background: var(--surface-color);
    border: 1px solid #374151;
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    min-width: 380px;
    max-width: 420px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

.feedback-form-header {
    margin-bottom: var(--spacing-lg);
    text-align: center;
}

.feedback-form-header h4 {
    margin: 0 0 var(--spacing-xs) 0;
    color: var(--text-primary);
    font-size: var(--font-size-lg);
    font-weight: 600;
}

.feedback-form-header p {
    margin: 0;
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
}

.feedback-form {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.feedback-form .form-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.feedback-form label {
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.feedback-form .char-counter {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    font-weight: 400;
}

.feedback-form select,
.feedback-form input[type="text"],
.feedback-form input[type="email"],
.feedback-form textarea {
    padding: 12px 16px;
    background: #374151;
    border: 1px solid #6b7280;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: var(--font-size-base);
    font-family: var(--font-family);
    transition: all 0.2s ease;
    resize: vertical;
}

.feedback-form select:focus,
.feedback-form input[type="text"]:focus,
.feedback-form input[type="email"]:focus,
.feedback-form textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(20, 184, 166, 0.2);
}

.feedback-form select::placeholder,
.feedback-form input::placeholder,
.feedback-form textarea::placeholder {
    color: var(--text-muted);
}

.feedback-form textarea {
    min-height: 80px;
    line-height: 1.5;
}

.feedback-form select {
    cursor: pointer;
}

.btn-feedback {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 14px 20px;
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    position: relative;
}

.btn-feedback:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-feedback:active {
    transform: translateY(0);
}

.btn-feedback:disabled {
    background: #6b7280;
    cursor: not-allowed;
    transform: none;
}

.btn-feedback .btn-loading {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.feedback-message {
    margin-top: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    text-align: center;
    font-weight: 500;
}

.feedback-message.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.feedback-message.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error-color);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Mobile Responsive for Floating Widgets */
@media (max-width: 480px) {
    .waitlist-widget {
        bottom: 16px;
        right: 16px;
    }
    
    .waitlist-form-container {
        min-width: 280px;
        right: -40px; /* Center better on mobile */
    }
    
    .waitlist-form {
        flex-direction: column;
    }
    
    .waitlist-toggle {
        padding: 12px 16px; /* Maintain padding for good touch targets */
        min-width: 44px; /* iOS minimum touch target */
        justify-content: center;
        gap: 0; /* Remove gap between elements on mobile */
    }
    
    .waitlist-toggle i {
        display: none; /* Hide icon on mobile for better centering */
    }
    
    .waitlist-toggle span {
        display: none; /* Hide original text */
    }
    
    .waitlist-toggle::after {
        content: "Join"; /* Show abbreviated text directly on the toggle */
        font-size: 12px;
        font-weight: 500;
    }
    
    .feedback-widget {
        bottom: 16px;
        left: 16px;
    }
    
    .feedback-form-container {
        min-width: 300px;
        max-width: calc(100vw - 32px);
        left: -40px; /* Center better on mobile */
        right: auto;
    }
    
    .feedback-toggle {
        padding: 12px 16px;
        min-width: 44px; /* iOS minimum touch target */
        justify-content: center;
        gap: 0;
    }
    
    .feedback-toggle i {
        display: none; /* Hide icon on mobile for better centering */
    }
    
    .feedback-toggle span {
        display: none; /* Hide original text */
    }
    
    .feedback-toggle::after {
        content: "Feedback"; /* Show abbreviated text directly on the toggle */
        font-size: 12px;
        font-weight: 500;
    }
    
    .feedback-form-container {
        padding: var(--spacing-md);
    }
    
    .feedback-form textarea {
        min-height: 60px;
    }
}

.stat {
    text-align: center;
    padding: var(--spacing-lg);
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.stat-number {
    display: block;
    font-size: var(--font-size-2xl);
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: var(--spacing-xs);
}

.stat-label {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    font-weight: 500;
}

/* Tender Section */
.tender-section {
    background: transparent;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    border: none;
}

.section-header {
    display: none;
}

.section-header h3 {
    font-size: var(--font-size-xl);
    font-weight: 600;
    color: var(--text-primary);
}

.section-header h3 i {
    margin-right: var(--spacing-sm);
    color: var(--primary-color);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

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

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

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

.btn-secondary:hover {
    background: var(--text-muted);
    color: white;
}

/* Loading States */
.loading {
    text-align: center;
    padding: var(--spacing-2xl);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto var(--spacing-lg);
}

.loading p {
    color: var(--text-secondary);
    font-style: italic;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Error State */
.error-state {
    text-align: center;
    padding: var(--spacing-2xl);
}

.error-state i {
    font-size: var(--font-size-3xl);
    color: var(--error-color);
    margin-bottom: var(--spacing-md);
}

.error-state h4 {
    font-size: var(--font-size-lg);
    margin-bottom: var(--spacing-sm);
    color: var(--text-primary);
}

.error-state p {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-lg);
}

/* Tender List */
.tender-list {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr)) !important;
    gap: var(--spacing-lg);
    margin-top: var(--spacing-lg);
}

.tender-item {
    background: var(--card-color);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-lg);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.tender-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(20, 184, 166, 0.2), 0 0 20px rgba(20, 184, 166, 0.1);
    border-color: var(--primary-color);
    border-width: 2px;
    background: #212121; /* Slightly lighter on hover */
}

.tender-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-color);
}

/* Card Layout - Matching Reference Design Exactly */
.tender-reference {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    font-family: monospace;
    margin-bottom: var(--spacing-sm);
    letter-spacing: 0.05em;
}

.tender-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
    line-height: 1.4;
    
    /* Ensure title doesn't overflow in fixed height cards */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: 2.8em; /* 2 lines * 1.4 line-height */
}

.tender-info-section {
    margin-bottom: var(--spacing-xs); /* Reduced margin */
    flex-shrink: 0;
    flex: 1; /* Allow to grow but not beyond available space */
    min-height: 0; /* Important for flexbox truncation */
}

.tender-info-row {
    display: flex;
    align-items: flex-start; /* Align to top for better text handling */
    margin-bottom: var(--spacing-xs);
    font-size: var(--font-size-sm);
    line-height: 1.3; /* Tighter line height */
    min-height: 18px; /* Consistent row height */
}

.tender-info-label {
    color: var(--text-secondary);
    font-weight: 500;
    min-width: 65px; /* Slightly reduced */
    margin-right: var(--spacing-sm);
    flex-shrink: 0; /* Never shrink labels */
}

.tender-info-value {
    color: var(--text-primary);
    flex: 1;
    min-width: 0; /* Allow shrinking for truncation */
}

/* Smart truncation for both Ministry and Location fields to ensure deadline visibility */
.tender-info-row .location-value,
.tender-info-row .ministry-value {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

/* Priority system: Ministry gets slightly more space than location */
.tender-info-row .ministry-value {
    max-width: 100%;
    line-height: 1.3;
}

.tender-info-row .location-value {
    max-width: 100%;
    line-height: 1.3;
}

.tender-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-sm);
    flex-shrink: 0;
}

.tender-category {
    display: inline-block;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;

    /* Modern minimalist: prevent text wrapping and ensure consistent badge sizing */
    white-space: nowrap;           /* Prevent wrapping */
    overflow: hidden;              /* Hide overflow */
    text-overflow: ellipsis;       /* Show ellipsis if too long */
    max-width: 140px;              /* Limit badge width */
    flex-shrink: 0;                /* Don't shrink when space is tight */
}

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

.category-bekalan {
    background: var(--accent-color);
    color: white;
}

.category-kerja {
    background: var(--success-color);
    color: white;
}

.category-perunding {
    background: #8b5cf6;  /* Purple for consulting services */
    color: white;
}

.category-other {
    background: #6b7280;  /* Gray for unmapped categories */
    color: white;
}

.tender-amount {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--primary-color);
}

.tender-deadline {
    font-size: var(--font-size-sm);
    color: var(--error-color);
    text-align: center;
    font-weight: 600; /* Increased weight for better visibility */
    flex-shrink: 0; /* Never shrink deadline */
    margin-top: auto; /* Push to bottom */
    padding-top: var(--spacing-xs); /* Small padding for separation */
    border-top: 1px solid rgba(255, 255, 255, 0.1); /* Subtle separator */
    min-height: 20px; /* Reserve space for deadline */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Intelligent Tooltip System for Truncated Titles */
.tooltip-container {
    position: relative;
    display: block;
    width: 100%;
    margin-bottom: var(--spacing-sm);
}

.custom-tooltip {
    position: fixed; /* Changed to fixed for portal pattern */
    background: rgba(15, 15, 15, 0.95);
    color: var(--text-primary);
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-lg);
    font-size: var(--font-size-sm);
    font-weight: 500;
    white-space: normal;
    max-width: 280px;
    line-height: 1.5;
    z-index: 10000; /* Even higher z-index for body-level tooltips */
    border: 2px solid var(--primary-color);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    text-align: center;
    
    /* Initially hidden */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    
    /* Smooth transitions */
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    transform: translateY(-8px);
}

/* Visible state for portal tooltips */
.custom-tooltip.tooltip-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Arrow for tooltips positioned below (when near top of viewport) */
.custom-tooltip.tooltip-below::after {
    top: -16px; /* Position arrow above tooltip when tooltip is below */
    border-top-color: transparent;
    border-bottom-color: var(--primary-color);
}

.custom-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-top-color: var(--primary-color);
}

/* Tooltip hover states are now managed by JavaScript portal pattern */

/* Responsive tooltip positioning */
@media (max-width: 768px) {
    .custom-tooltip {
        max-width: 250px;
        font-size: var(--font-size-xs);
        padding: var(--spacing-xs) var(--spacing-sm);
    }
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: var(--spacing-lg);
}

.modal-content {
    background: var(--card-color);
    border-radius: var(--radius-xl);
    max-width: 1000px;
    width: 100%;
    height: 85vh;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: var(--shadow-xl);
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
    background: var(--card-color);
}

.modal-header h4 {
    font-size: var(--font-size-xl);
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
    /* CSS line clamping for long titles */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: 2.6em; /* 2 lines * 1.3 line-height */
}

.modal-close {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-size: var(--font-size-lg);
    cursor: pointer;
    color: var(--text-primary);
    padding: var(--spacing-sm);
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    transform: scale(1.05);
}

.modal-body {
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.modal-loading {
    text-align: center;
    padding: var(--spacing-2xl);
}

#modal-content.modal-sections {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 0;
    flex: 1;
    overflow: hidden;
    min-height: 0;
    height: calc(85vh - 80px);
}

.modal-section {
    background: var(--card-color);
    border-radius: 0;
    padding: var(--spacing-xl);
    border: none;
    overflow-y: auto;
    min-height: 0;
    max-height: 100%;
    border-right: 1px solid var(--border-color);
}

.modal-section:last-child {
    border-right: none;
    background: var(--card-color);
}

.modal-section h5 {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-lg);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.modal-section h5 i {
    color: var(--primary-color);
}

/* Progressive Loading Styles for Modal Sections */
.section-loading, .section-waiting {
    text-align: center;
    padding: var(--spacing-xl) var(--spacing-lg);
    color: var(--text-secondary);
    min-height: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.section-loading .spinner {
    width: 32px;
    height: 32px;
    margin: 0 auto var(--spacing-md);
    border-width: 3px;
}

.section-waiting {
    opacity: 0.7;
    background: var(--surface-color);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
}

.spinner-placeholder {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-color);
    border-radius: 50%;
    margin: 0 auto var(--spacing-md);
    opacity: 0.3;
}

.section-loading p, .section-waiting p {
    font-size: var(--font-size-sm);
    font-style: italic;
    margin: 0;
    color: var(--text-secondary);
}

.section-error {
    text-align: center;
    padding: var(--spacing-xl) var(--spacing-lg);
    color: var(--error-color);
    background: rgba(222, 53, 11, 0.05);
    border: 1px solid rgba(222, 53, 11, 0.2);
    border-radius: var(--radius-md);
    min-height: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.section-error i {
    font-size: var(--font-size-xl);
    margin-bottom: var(--spacing-sm);
    color: var(--error-color);
}

.section-error p {
    font-size: var(--font-size-sm);
    margin: 0 0 var(--spacing-md);
    color: var(--text-secondary);
}

.retry-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: var(--spacing-sm) var(--spacing-lg);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: var(--spacing-sm);
}

.retry-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.retry-btn:active {
    transform: translateY(0);
}

/* Smooth transitions between states */
.modal-section > div {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Enhanced visual feedback during progressive loading */
@keyframes shimmer {
    0% { opacity: 0.5; transform: scaleX(0.8); }
    50% { opacity: 1; transform: scaleX(1); }
    100% { opacity: 0.5; transform: scaleX(0.8); }
}

/* Custom Neural Network Loading Indicator */
.neural-network-loader {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto var(--spacing-lg);
    position: relative;
}

.neural-network-loader::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, rgba(20, 184, 166, 0.05) 0%, transparent 70%);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    z-index: -1;
    animation: background-pulse 4s ease-in-out infinite;
}

.neural-network-loader--small::before {
    width: 80px;
    height: 80px;
}

@keyframes background-pulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.5;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.1);
        opacity: 0.8;
    }
}

#neural-k {
    width: 80px;
    height: 80px;
    max-width: 100%;
}

.neural-k-small {
    width: 60px;
    height: 60px;
    max-width: 100%;
}

/* Network node styles */
.network-node {
    transition: all 0.3s ease;
}

.golden-node, .golden-node-small {
    animation: golden-pulse 2s ease-in-out infinite;
}

@keyframes golden-pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.9;
    }
}

/* Connection line styles */
.connection-line {
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Highlight path styles */
.highlight-path {
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: url(#glow);
    transition: opacity 0.3s ease;
}

/* Traveler styles */
.traveler {
    stroke: #14b8a6;
    stroke-width: 1;
    transition: opacity 0.3s ease;
}

/* Animation classes for JavaScript control */
.path-active {
    opacity: 1 !important;
    animation: path-highlight 1.5s ease-in-out;
}

@keyframes dash {
    0% {
        stroke-dashoffset: 10;
    }
    100% {
        stroke-dashoffset: 0;
    }
}

@keyframes path-highlight {
    0% {
        stroke-dasharray: 0 200;
        stroke-dashoffset: 0;
    }
    50% {
        stroke-dasharray: 100 200;
        stroke-dashoffset: -50;
    }
    100% {
        stroke-dasharray: 200 200;
        stroke-dashoffset: -200;
    }
}

.traveler-active {
    opacity: 1 !important;
}

/* Node glow animation for when reached by traveler */
.node-reached {
    animation: node-glow 0.5s ease-out;
}

@keyframes node-glow {
    0% {
        filter: url(#node-glow);
        transform: scale(1);
    }
    50% {
        filter: url(#node-glow) brightness(1.5);
        transform: scale(1.2);
    }
    100% {
        filter: url(#node-glow);
        transform: scale(1);
    }
}

/* Enhanced hover effects */
.neural-network-loader:hover {
    transform: scale(1.02);
    transition: transform 0.3s ease;
}

.neural-network-loader:hover::before {
    opacity: 1;
}

/* Focus and accessibility improvements */
.neural-network-loader:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 4px;
}

/* Responsive design for neural loader */
@media (max-width: 768px) {
    #neural-k {
        width: 60px;
        height: 60px;
    }
    
    .neural-k-small {
        width: 48px;
        height: 48px;
    }
    
    .neural-network-loader::before {
        width: 80px;
        height: 80px;
    }
    
    .neural-network-loader--small::before {
        width: 65px;
        height: 65px;
    }
}

@media (max-width: 480px) {
    #neural-k {
        width: 50px;
        height: 50px;
    }
    
    .neural-k-small {
        width: 40px;
        height: 40px;
    }
    
    .neural-network-loader::before {
        width: 70px;
        height: 70px;
    }
    
    .neural-network-loader--small::before {
        width: 55px;
        height: 55px;
    }
}

/* Tender Info Styles */
.info-item {
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
}

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

.info-label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    margin-bottom: var(--spacing-xs);
}

.info-value {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    line-height: 1.6;
}

/* Analysis Styles */
.analysis-section {
    margin-bottom: var(--spacing-xl);
}

.analysis-section:last-child {
    margin-bottom: 0;
}

.analysis-section h6 {
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-sm);
    border-bottom: 2px solid var(--border-color);
}

.analysis-content {
    color: var(--text-secondary);
    line-height: 1.7;
}

.analysis-list {
    list-style: none;
    padding: 0;
}

.analysis-list li {
    padding: var(--spacing-sm) 0;
    border-bottom: 1px solid var(--border-color);
    position: relative;
    padding-left: var(--spacing-lg);
}

.analysis-list li:last-child {
    border-bottom: none;
}

.analysis-list li:before {
    content: "•";
    color: var(--primary-color);
    font-weight: bold;
    position: absolute;
    left: 0;
}

.key-info-grid {
    display: grid;
    gap: var(--spacing-md);
}

.key-info-item {
    background: var(--surface-color);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

/* Footer */
.footer {
    background: #000000; /* Pure black for footer on very dark theme */
    color: white;
    padding: var(--spacing-lg) 0;
    margin-top: var(--spacing-2xl);
    border-top: 1px solid #374151;
}

.footer .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer p {
    font-size: var(--font-size-sm);
    opacity: 0.8;
}

.footer-links {
    display: flex;
    gap: var(--spacing-lg);
}

.footer-links a {
    color: white;
    text-decoration: none;
    font-size: var(--font-size-sm);
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.footer-links a:hover {
    opacity: 1;
}

/* Infinite Scroll and Virtual Rendering Styles */
.infinite-scroll-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: var(--spacing-xl) var(--spacing-md);
    margin-top: var(--spacing-lg);
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    opacity: 0.9;
}

.infinite-scroll-loading .loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-md);
}

.infinite-scroll-loading span {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    font-weight: 500;
}

/* Virtual Rendering Spacers */
.virtual-spacer-top,
.virtual-spacer-bottom {
    width: 100%;
    background: transparent;
    pointer-events: none;
}

/* Enhanced Tender List for Virtual Rendering - Maintain Original Grid Layout */
.tender-list {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr)) !important;
    gap: var(--spacing-lg);
    position: relative;
    min-height: 200px;
}

/* Virtual Tender Items - Fixed Height with Smart Content Management */
.tender-list .tender-item {
    /* Fixed height for consistent virtual rendering calculations */
    height: 220px;
    min-height: 220px;
    max-height: 220px;
    
    /* Keep original tender card styling */
    background: var(--card-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md); /* Reduced padding for more content space */
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-md);
    
    /* Remove margin since grid handles spacing */
    margin-bottom: 0;
    width: 100%;
    
    /* Smart content layout - priority system */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    gap: var(--spacing-xs); /* Consistent small gaps */
}

.tender-list .tender-item:hover {
    background: #202020;
    border-color: var(--primary-color);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

/* Virtual Rendering Spacers - Must work with CSS Grid */
.virtual-spacer-top,
.virtual-spacer-bottom {
    grid-column: 1 / -1; /* Span all columns */
    width: 100%;
    background: transparent;
    pointer-events: none;
}

/* Loading States for Infinite Scroll */
.neural-network-loader--small {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
}

.neural-network-loader--small svg {
    width: 100%;
    height: 100%;
}

/* Remove will-change for better performance - only use when actively animating */
/* .tender-list * {
    will-change: transform;
    transform: translateZ(0);
} */

/* Only enable hardware acceleration on hover/active states */
.tender-item:hover {
    will-change: transform;
}

.tender-item:not(:hover) {
    will-change: auto;
}

/* Virtual Rendering & Skeleton Loading Enhancements */

/* Skeleton Loading Animation */
@keyframes skeleton-shimmer {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

/* Skeleton Elements Base */
.skeleton-element {
    background: linear-gradient(
        90deg,
        var(--card-color) 25%,
        rgba(255, 255, 255, 0.05) 50%,
        var(--card-color) 75%
    );
    background-size: 200px 100%;
    animation: skeleton-shimmer 1.5s infinite ease-in-out;
    border-radius: var(--radius-sm);
    opacity: 0.8;
}

/* Skeleton Text Elements */
.skeleton-text {
    height: 1rem;
    margin: 0.25rem 0;
}

.skeleton-text--xsmall {
    width: 20%;
    height: 0.75rem;
}

.skeleton-text--small {
    width: 30%;
    height: 0.875rem;
}

.skeleton-text--medium {
    width: 60%;
    height: 1rem;
}

.skeleton-text--long {
    width: 85%;
    height: 1.25rem;
}

.skeleton-text--short {
    width: 40%;
    height: 0.875rem;
}

/* Skeleton Pill (for categories) */
.skeleton-pill {
    width: 80px;
    height: 24px;
    border-radius: 12px;
}

/* Skeleton Tender Card */
.tender-skeleton {
    pointer-events: none;
    user-select: none;
    background: var(--card-color);
    border: 2px solid rgba(20, 184, 166, 0.3);
    opacity: 0.7;
}

.tender-skeleton .tender-title {
    margin-bottom: var(--spacing-sm);
}

.tender-skeleton .tender-info-section {
    margin: var(--spacing-md) 0;
}

.tender-skeleton .tender-info-row {
    margin: var(--spacing-sm) 0;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

/* Fade Animations */
.skeleton-fade-out {
    opacity: 0;
    transform: translateY(-4px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tender-fade-in {
    opacity: 0;
    transform: translateY(4px);
    animation: fade-in-up 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    animation-delay: 0.1s;
}

@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Virtual Rendering Container Enhancements */
.tender-list {
    /* Optimize for virtual rendering */
    contain: layout;
    will-change: scroll-position;
    overflow-anchor: none; /* Prevent scroll anchoring issues */
}

/* Performance optimizations for virtual rendering */
.tender-item {
    /* Enable hardware acceleration for positioned items */
    backface-visibility: hidden;
    perspective: 1000px;
    contain: layout style paint;
}

/* Smooth transitions for virtual rendering updates */
.tender-list.updating {
    pointer-events: none;
}

.tender-list.updating .tender-item {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Loading states for infinite scroll */
.infinite-scroll-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: var(--spacing-lg);
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    gap: var(--spacing-sm);
}

.infinite-scroll-loading .loading-spinner {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

/* Accessibility improvements for skeleton loading */
@media (prefers-reduced-motion: reduce) {
    .skeleton-element {
        animation: none;
        background: var(--card-color);
        opacity: 0.6;
    }
    
    .skeleton-fade-out,
    .tender-fade-in {
        animation: none;
        transition: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .skeleton-element {
        background: var(--text-muted);
        opacity: 0.8;
    }
    
    .tender-skeleton {
        border-color: var(--text-secondary);
    }
}

/* Fallback Notification */
.fallback-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--card-color);
    border: 1px solid rgba(20, 184, 166, 0.3);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    z-index: 9999;
    backdrop-filter: blur(10px);
    animation: slide-in-right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 300px;
}

.fallback-notification .fas {
    color: var(--warning-color);
    font-size: 1rem;
    flex-shrink: 0;
}

.fallback-notification.fade-out {
    opacity: 0;
    transform: translateX(100%);
}

@keyframes slide-in-right {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Mobile responsiveness for notification */
@media (max-width: 768px) {
    .fallback-notification {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
        font-size: var(--font-size-xs);
        padding: var(--spacing-sm);
    }
}

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

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
    
    .tender-item {
        transition: none !important;
        transform: none !important;
    }
}

/* Enhanced loading indicators for better UX */
.infinite-scroll-loading {
    animation: fadeInUp 0.3s ease-out;
}

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

/* Large dataset indicators */
.tender-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
    padding: var(--spacing-md);
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.tender-stats .loaded-count {
    color: var(--primary-color);
    font-weight: 600;
}

.tender-stats .total-count {
    color: var(--text-primary);
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 768px) {
    .tender-list {
        grid-template-columns: 1fr !important; /* Single column on mobile */
        gap: var(--spacing-md);
        margin-top: var(--spacing-md);
    }
    
    .tender-list .tender-item {
        height: 240px; /* Increased height to prevent deadline cutoff */
        min-height: 240px;
        max-height: 240px;
    }
    
    .infinite-scroll-loading {
        padding: var(--spacing-lg) var(--spacing-sm);
        margin-top: var(--spacing-md);
    }
    
    .hero {
        padding: var(--spacing-lg) 0;
        margin: var(--spacing-md) 0;
    }
    
    .tender-item {
        padding: var(--spacing-md);
    }
    
    /* Logo responsive adjustments */
    .logo-container {
        gap: var(--spacing-sm);
    }
    
    .logo-image {
        height: 64px;
        width: 64px;
    }
    
    .logo h1 {
        font-size: var(--font-size-2xl);
    }
    
    .tagline {
        font-size: var(--font-size-sm);
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 var(--spacing-md);
    }
    
    .hero {
        padding: var(--spacing-md) 0;
    }
    
    .hero h2 {
        font-size: var(--font-size-xl);
    }
    
    .tender-item {
        padding: var(--spacing-sm) var(--spacing-md);
    }
    
    .tender-title {
        font-size: var(--font-size-base);
        margin-bottom: var(--spacing-md);
    }
    
    .tender-info-row {
        font-size: var(--font-size-xs);
    }
    
    .tender-amount {
        font-size: var(--font-size-lg);
    }
    
    /* Ultra-small screen logo adjustments */
    .logo-container {
        gap: var(--spacing-xs);
    }
    
    .logo-image {
        height: 56px;
        width: 56px;
    }
    
    .logo h1 {
        font-size: var(--font-size-xl);
    }
    
    .tagline {
        font-size: var(--font-size-xs);
    }
}

@media (max-width: 768px) {
    .modal-content {
        height: 90vh;
        max-height: 90vh;
        margin: var(--spacing-sm);
        width: calc(100vw - 2 * var(--spacing-sm));
    }
    
    .modal-header {
        padding: var(--spacing-md);
        position: sticky;
        top: 0;
        z-index: 10;
        background: var(--card-color);
        border-bottom: 1px solid var(--border-color);
    }
    
    .modal-header h4 {
        font-size: var(--font-size-lg);
        -webkit-line-clamp: 3; /* Allow 3 lines on mobile */
        max-height: 3.9em; /* 3 lines * 1.3 line-height */
    }
    
    #modal-content.modal-sections {
        grid-template-columns: 1fr !important;
        height: calc(90vh - 80px); /* Adjust for sticky header */
    }
    
    .modal-section {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding: var(--spacing-md);
        max-height: none; /* Remove height constraints on mobile */
    }
    
    .modal-section:last-child {
        border-bottom: none;
    }
    
    .footer .container {
        flex-direction: column;
        gap: var(--spacing-md);
        text-align: center;
    }
}

@media (max-width: 480px) {
    .modal-content {
        height: 95vh;
        max-height: 95vh;
        margin: var(--spacing-xs);
        width: calc(100vw - 2 * var(--spacing-xs));
    }
    
    .modal-header {
        padding: var(--spacing-sm) var(--spacing-md);
    }
    
    .modal-header h4 {
        font-size: var(--font-size-base);
        -webkit-line-clamp: 4; /* Allow 4 lines on very small screens */
        max-height: 5.2em; /* 4 lines * 1.3 line-height */
    }
    
    #modal-content.modal-sections {
        height: calc(95vh - 60px); /* Adjust for smaller header */
    }
    
    .modal-section {
        padding: var(--spacing-sm) var(--spacing-md);
    }
}