/* STE Check Specific Styles - Enhanced Professional Layout */
.ste-check-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Anchored modal tweaks: allow content to be positioned near clicked word */
#wordModal.modal-overlay {
    position: fixed;
    inset: 0;
    background: transparent; /* fully transparent overlay for word modal */
    display: none;
    align-items: flex-start; /* overridden when anchoring */
    justify-content: flex-start; /* overridden when anchoring */
}

#wordModal.modal-overlay .modal-content {
    max-width: min(420px, 90vw); /* Reduced from 520px */
    /* Default center behavior preserved by existing styles; JS may override with absolute positioning */
}

/* Small pointer indicating relation to clicked word (optional) */
#wordModal.modal-overlay .modal-content::after {
    content: '';
    position: absolute;
    width: 0; height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid rgba(0,0,0,0.08);
    top: -8px;
    left: 16px;
}

/* Main Content Wrapper - Prevents layout shifts */
.main-content-wrapper {
    flex: 0 0 auto;
    isolation: isolate;
    z-index: 10;
}

/* Results Wrapper - Dedicated container for results */
.results-wrapper {
    flex: 1;
    position: relative;
    isolation: isolate;
    z-index: 5;
}

/* Layout Stabilization System - Enhanced */
.ste-layout-stable {
    box-sizing: border-box !important;
    position: relative;
    contain: layout style;
}

/* Container-specific stabilization */
.ste-check-container.ste-layout-stable {
    will-change: auto; /* Optimize for layout changes */
}

/* Form stabilization - Improved */
.check-form.ste-layout-stable {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    isolation: isolate;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 20px;
    padding: 1rem;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

/* Textarea container stability */
.professional-textarea-container.ste-layout-stable {
    position: relative;
    z-index: 1;
    isolation: isolate;
    min-height: 300px; /* Ensure minimum height */
}

/* Statistics container stability */
.document-statistics.ste-layout-stable {
    position: relative;
    z-index: 2;
    margin-top: 1rem;
    margin-bottom: 1rem;
    flex-shrink: 0; /* Prevent shrinking */
}

/* Analyze section stability */
.analyze-section.ste-layout-stable {
    position: relative;
    z-index: 3;
    margin-top: auto; /* Push to bottom */
    flex-shrink: 0;
}

/* Results section stability */
.results-section.ste-layout-stable {
    position: relative;
    z-index: 4;
    margin-top: 2rem;
    clear: both; /* Clear any floats */
}

/* Character counter improved positioning */
.character-counter.ste-layout-stable {
    position: absolute;
    bottom: 12px;
    right: 12px;
    z-index: 10;
    pointer-events: none;
    background: rgba(255, 255, 255, 0.95);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Grid system improvements */
.stats-grid.ste-layout-stable {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    align-items: stretch;
}

.stat-card {
    flex-shrink: 0;
    min-width: 180px;
    isolation: isolate;
}

/* Prevent text overflow in all elements */
.ste-layout-stable * {
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}

/* Enhanced Responsive Design */
@media (max-width: 1200px) {
    .ste-check-container {
        max-width: 100%;
        padding: 1.5rem;
    }
    
    .main-content-wrapper {
        max-width: 100%;
    }
    
    .check-form.ste-layout-stable {
        padding: 0.75rem;
    }
}

@media (max-width: 768px) {
    .ste-check-container {
        padding: 0.5rem;
        gap: 1rem;
    }
    
    .hero-section h1 {
        font-size: 2rem;
        line-height: 1.3;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .hero-features {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .feature-badge {
        justify-content: center;
    }
    
    .stats-grid.ste-layout-stable {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .professional-textarea-container.ste-layout-stable {
        min-height: 250px;
    }
    
    .character-counter.ste-layout-stable {
        bottom: 8px;
        right: 8px;
        font-size: 0.85rem;
        padding: 4px 8px;
    }
    
    .results-card {
        margin-bottom: 1rem;
        border-radius: 12px;
    }
    
    .results-card-header {
        padding: 1rem;
        border-radius: 12px 12px 0 0;
    }
    
    .results-card-body {
        padding: 1rem;
        border-radius: 0 0 12px 12px;
    }
    
    /* Enhanced Mobile File Operations Toolbar */
    .file-operations-toolbar {
        display: flex;
        flex-direction: column;
        gap: 1rem;
        padding: 0.75rem;
        border-radius: 12px;
        background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 252, 0.98) 100%);
        border: 1px solid rgba(226, 232, 240, 0.6);
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    }
    
    /* Mobile-first button layout */
    .operations-section.primary-section {
        order: 1;
    }
    
    .operations-section.secondary-section {
        order: 3;
        display: none; /* Hide clipboard section on mobile to save space */
    }
    
    .status-panel {
        order: 2;
        background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
        border: 1px solid #7dd3fc;
        border-radius: 8px;
        padding: 0.6rem;
        margin: 0;
    }
    
    .status-header {
        font-size: 0.8rem;
        font-weight: 600;
        color: #0369a1;
        margin-bottom: 0.4rem;
        display: flex;
        align-items: center;
        gap: 0.3rem;
    }
    
    .status-content {
        display: flex;
        flex-direction: column;
        gap: 0.2rem;
    }
    
    .status-item {
        font-size: 0.75rem;
        color: #0c4a6e;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .status-label {
        font-weight: 500;
        opacity: 0.8;
    }
    
    .file-status, .file-name {
        font-weight: 600;
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    .operations-section {
        align-items: stretch;
    }
    
    .section-label {
        justify-content: center;
        font-size: 0.8rem;
        margin-bottom: 0.6rem;
        font-weight: 600;
        color: #475569;
        padding: 0.3rem 0;
        background: rgba(248, 250, 252, 0.8);
        border-radius: 6px;
        border: 1px solid rgba(226, 232, 240, 0.5);
    }
    
    .button-group {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    /* Mobile-optimized buttons */
    .btn-professional {
        min-height: 48px;
        padding: 0.75rem 1rem;
        justify-content: center;
        border-radius: 8px;
        font-size: 0.9rem;
        font-weight: 500;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
        border: 1px solid #e2e8f0;
        background: white;
        transition: all 0.2s ease;
    }
    
    .btn-professional:hover {
        transform: translateY(-1px);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
        background: #f8fafc;
    }
    
    .btn-professional.danger {
        background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
        border-color: #fca5a5;
        color: #dc2626;
    }
    
    .btn-professional:disabled {
        opacity: 0.5;
        cursor: not-allowed;
        transform: none !important;
    }
    
    /* Enhanced analyze button for mobile */
    .btn-analyze-professional {
        min-height: 56px !important;
        font-size: 1rem !important;
        font-weight: 600 !important;
        margin-bottom: 0.5rem;
        background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%) !important;
        border: none !important;
        color: white !important;
        box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3) !important;
        border-radius: 10px !important;
    }
    
    .btn-analyze-professional:hover:not(:disabled) {
        transform: translateY(-2px) !important;
        box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4) !important;
    }
    
    .btn-analyze-professional .btn-content {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
    }
    
    .btn-analyze-professional .btn-icon i {
        font-size: 1.1rem;
    }
    
    .btn-analyze-professional .btn-title {
        font-size: 1rem;
        font-weight: 600;
    }
    
    /* Compact secondary buttons in mobile */
    .button-group .btn-professional:not(.btn-analyze-professional) {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        text-align: left;
        padding: 0.6rem 0.8rem;
        min-height: 44px;
    }
    
    .button-group .btn-professional i {
        font-size: 0.9rem;
        width: 16px;
        text-align: center;
        opacity: 0.8;
    }
    
    .button-group .btn-professional span {
        flex: 1;
        font-weight: 500;
    }
    
    /* Save space by grouping file actions */
    .primary-section .button-group {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto auto;
        gap: 0.4rem;
    }
    
    .btn-analyze-professional {
        grid-column: 1 / -1; /* Span full width */
        grid-row: 1;
    }
    
    #openFileBtn { grid-column: 1; grid-row: 2; }
    #saveFileBtn { grid-column: 2; grid-row: 2; }
    #saveAsFileBtn { grid-column: 1; grid-row: 3; }
    #closeFileBtn { grid-column: 2; grid-row: 3; }
    
    /* Word Categories Grid Mobile */
    .word-categories-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .word-category-card {
        border-radius: 10px;
        overflow: hidden;
    }
    
    .word-category-header,
    .collapsible-header {
        min-height: 48px;
        padding: 0.75rem 1rem;
        cursor: pointer;
        touch-action: manipulation;
    }
    
    /* Legend Mobile Improvements */
    .legend {
        flex-direction: column;
        align-items: center;
        gap: 0.5rem !important;
    }
    
    .legend-item {
        margin: 0.25rem !important;
        padding: 0.5rem 1rem !important;
        border-radius: 20px;
        font-size: 0.85rem;
        min-width: 140px;
        text-align: center;
    }
    
    /* Statistics Grid Mobile */
    .statistics-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .stat-card-mobile {
        padding: 0.75rem;
        border-radius: 10px;
        text-align: center;
        min-height: 80px;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
    
    /* Modal Mobile Improvements */
    .modal-content {
        width: 95% !important;
        max-width: 400px !important;
        margin: 5vh auto !important;
        max-height: 90vh;
        overflow-y: auto;
        border-radius: 16px;
    }
    
    .modal-header {
        padding: 1rem;
        border-bottom: 1px solid #e2e8f0;
    }
    
    .modal-body {
        padding: 1rem;
        max-height: 60vh;
        overflow-y: auto;
    }
    
    .modal-footer {
        padding: 1rem;
        border-top: 1px solid #e2e8f0;
    }
    
    /* Close button touch target */
    .modal-close {
        min-width: 48px;
        min-height: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .loading {
        padding: 2rem 1rem;
        margin: 1rem 0;
        border-radius: 12px;
    }
    
    .loading-spinner {
        width: 50px;
        height: 50px;
        margin-bottom: 1rem;
    }
    
    .loading-spinner::before {
        width: 50px;
        height: 50px;
    }
    
    .loading-spinner::after {
        width: 32px;
        height: 32px;
        top: 9px;
        left: 9px;
    }
    
    .loading-text {
        font-size: 1.1rem;
    }
    
    .loading-subtitle {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .ste-check-container {
        padding: 0.4rem;
        gap: 0.8rem;
    }
    
    .hero-section {
        padding: 1.2rem 0;
    }
    
    .hero-section h1 {
        font-size: 1.6rem;
        line-height: 1.2;
    }
    
    .stats-grid.ste-layout-stable {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .stat-card {
        padding: 0.6rem;
        min-height: 65px;
    }
    
    .hero-description {
        font-size: 0.9rem;
        line-height: 1.5;
    }
    
    /* Ultra-compact file operations toolbar */
    .file-operations-toolbar {
        padding: 0.6rem;
        gap: 0.8rem;
        margin-bottom: 0.8rem;
    }
    
    .section-label {
        font-size: 0.75rem;
        padding: 0.25rem;
        margin-bottom: 0.5rem;
    }
    
    .section-label i {
        font-size: 0.7rem;
    }
    
    /* Compact button layout for small screens */
    .primary-section .button-group {
        grid-template-columns: 1fr;
        grid-template-rows: auto repeat(4, auto);
        gap: 0.3rem;
    }
    
    .btn-analyze-professional {
        grid-column: 1;
        grid-row: 1;
        min-height: 50px !important;
        font-size: 0.95rem !important;
    }
    
    #openFileBtn { grid-column: 1; grid-row: 2; }
    #saveFileBtn { grid-column: 1; grid-row: 3; }
    #saveAsFileBtn { grid-column: 1; grid-row: 4; }
    #closeFileBtn { grid-column: 1; grid-row: 5; }
    
    .btn-professional {
        min-height: 42px;
        padding: 0.6rem 0.8rem;
        font-size: 0.85rem;
        border-radius: 6px;
    }
    
    .btn-professional i {
        font-size: 0.8rem;
        width: 14px;
    }
    
    .btn-professional span {
        font-size: 0.85rem;
    }
    
    /* Compact status panel */
    .status-panel {
        padding: 0.5rem;
        border-radius: 6px;
    }
    
    .status-header {
        font-size: 0.75rem;
        margin-bottom: 0.3rem;
    }
    
    .status-item {
        font-size: 0.7rem;
        gap: 0.3rem;
    }
    
    .file-status, .file-name {
        max-width: 100px;
        font-size: 0.7rem;
    }
    
/* Ultra-mobile form adjustments */
    .check-form.ste-layout-stable {
        padding: 0.4rem;
        border-radius: 12px;
        gap: 0.8rem;
    }

    .professional-textarea-container.ste-layout-stable {
        min-height: 180px;
    }
    
    /* FORCE button text to be HIDDEN on mobile devices */
    .btn-professional span {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        font-size: 0 !important;
        color: transparent !important;
        text-indent: -9999px !important;
        overflow: hidden !important;
        text-overflow: clip !important;
        width: 0 !important;
        height: 0 !important;
        line-height: 0 !important;
    }
    
    /* Keep main analyze button text visible but compact */
    .btn-analyze-professional .btn-title,
    .btn-analyze-professional .btn-text {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        font-size: 0 !important;
        color: transparent !important;
        text-indent: -9999px !important;
        overflow: hidden !important;
        text-overflow: clip !important;
        width: 0 !important;
        height: 0 !important;
        line-height: 0 !important;
    }
    
    /* Ensure analyze button icon is visible */
    .btn-analyze-professional .btn-content,
    .btn-analyze-professional .btn-icon,
    .btn-analyze-professional .btn-icon i {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        color: white !important;
        align-items: center !important;
        justify-content: center !important;
    }    .textarea-header {
        padding: 0.6rem;
        font-size: 0.85rem;
    }
    
    .professional-textarea {
        padding: 0.8rem;
        font-size: 16px !important; /* Still prevent zoom */
        line-height: 1.4;
    }
    
    /* Show clipboard actions on very small screens if needed */
    .operations-section.secondary-section {
        display: block;
        margin-top: 0.5rem;
    }
    
    .secondary-section .button-group {
        grid-template-columns: 1fr 1fr;
        gap: 0.3rem;
    }
    
    .secondary-section .btn-professional {
        min-height: 40px;
        padding: 0.5rem;
        font-size: 0.8rem;
    }
    
    .secondary-section .section-label {
        font-size: 0.7rem;
        margin-bottom: 0.4rem;
    }
    
    /* Improve touch targets and spacing */
    .collapsible-header {
        min-height: 54px;
        padding: 0.8rem;
    }
    
    .collapsible-header-right {
        gap: 0.6rem;
    }
    
    .badge {
        padding: 0.3rem 0.6rem;
        font-size: 0.7rem;
        border-radius: 10px;
    }
}

/* Additional Mobile Enhancements */
@media (max-width: 768px) {
    /* Sentence Analysis Mobile Improvements */
    .sentence-grid {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }
    
    .sentence-item {
        padding: 1rem;
        border-radius: 12px;
        border: 1px solid #e2e8f0;
        background: white;
    }
    
    .sentence-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 0.75rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .sentence-number {
        font-weight: 600;
        color: #3b82f6;
        font-size: 0.875rem;
    }
    
    .sentence-badges {
        display: flex;
        flex-wrap: wrap;
        gap: 0.25rem;
    }
    
    .sentence-text {
        font-size: 0.95rem;
        line-height: 1.6;
        margin-bottom: 0.75rem;
        padding: 0.75rem;
        background: #f8fafc;
        border-radius: 8px;
        border-left: 3px solid #3b82f6;
    }
    
    /* Word Status Breakdown Mobile */
    .word-status-bars {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .word-status-bar {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.75rem;
        background: white;
        border-radius: 10px;
        border: 1px solid #e2e8f0;
    }
    
    .word-status-label {
        font-size: 0.875rem;
        font-weight: 600;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .word-status-progress {
        height: 8px;
        background: #f1f5f9;
        border-radius: 4px;
        overflow: hidden;
    }
    
    .word-status-fill {
        height: 100%;
        border-radius: 4px;
        transition: width 0.3s ease;
    }
    
    /* Enhanced table responsiveness */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 10px;
        border: 1px solid #e2e8f0;
    }
    
    .table-mobile {
        width: 100%;
        border-collapse: separate;
        border-spacing: 0;
        font-size: 0.875rem;
    }
    
    .table-mobile th,
    .table-mobile td {
        padding: 0.75rem 0.5rem;
        border-bottom: 1px solid #e2e8f0;
        vertical-align: top;
    }
    
    .table-mobile th {
        background: #f8fafc;
        font-weight: 600;
        color: #475569;
        position: sticky;
        top: 0;
        z-index: 10;
    }
    
    /* Word grids mobile optimization */
    .word-grid {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
        padding: 1rem;
    }
    
    .word-tag {
        display: inline-flex;
        align-items: center;
        gap: 0.25rem;
        padding: 0.5rem 0.75rem;
        border-radius: 20px;
        font-size: 0.875rem;
        font-weight: 500;
        cursor: pointer;
        transition: all 0.2s ease;
        min-height: 44px; /* Touch target */
        touch-action: manipulation;
    }
    
    .word-tag:hover {
        transform: translateY(-1px);
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    }
    
    .word-tag.approved {
        background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
        color: #16a34a;
        border: 1px solid #86efac;
    }
    
    .word-tag.unapproved {
        background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
        color: #dc2626;
        border: 1px solid #fca5a5;
    }
    
    .word-tag.unclassified {
        background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
        color: #64748b;
        border: 1px solid #cbd5e1;
    }
    
    .word-tag.non-us {
        background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
        color: #d97706;
        border: 1px solid #facc15;
    }
}

@media (max-width: 480px) {
    /* Ultra-mobile sentence analysis */
    .sentence-text {
        font-size: 0.9rem;
        padding: 0.6rem;
    }
    
    .word-tag {
        font-size: 0.8rem;
        padding: 0.4rem 0.6rem;
        min-height: 40px;
    }
    
    .table-mobile th,
    .table-mobile td {
        padding: 0.5rem 0.25rem;
        font-size: 0.8rem;
    }
    
    /* Compact word status bars */
    .word-status-bar {
        padding: 0.5rem;
    }
    
    .word-status-label {
        font-size: 0.8rem;
    }
    
    .word-status-progress {
        height: 6px;
    }
}

/* Enhanced Mobile Textarea and Button Improvements */
@media (max-width: 768px) {
    /* Professional textarea mobile enhancements */
    .professional-textarea {
        font-size: 16px !important; /* Prevent zoom on iOS */
        line-height: 1.5;
        padding: 1rem;
        border-radius: 12px;
        resize: vertical;
        min-height: 200px;
    }
    
    .textarea-wrapper {
        position: relative;
        border-radius: 12px;
        overflow: hidden;
    }
    
    .textarea-header {
        background: #f8fafc;
        border-bottom: 1px solid #e2e8f0;
        padding: 0.75rem 1rem;
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-radius: 12px 12px 0 0;
    }
    
    .textarea-title {
        font-size: 0.9rem;
        font-weight: 600;
        color: #475569;
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }
    
    .btn-clear-text {
        min-width: 44px;
        min-height: 44px;
        border-radius: 8px;
        border: 1px solid #e2e8f0;
        background: white;
        color: #64748b;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.2s ease;
        touch-action: manipulation;
    }
    
    .btn-clear-text:hover {
        background: #fee2e2;
        color: #dc2626;
        border-color: #fca5a5;
    }
    
    /* Enhanced analyze button mobile */
    .btn-analyze-professional {
        width: 100% !important;
        min-height: 56px !important;
        font-size: 1rem !important;
        font-weight: 600 !important;
        border-radius: 12px !important;
        background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%) !important;
        border: none !important;
        color: white !important;
        box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3) !important;
        transition: all 0.2s ease !important;
        touch-action: manipulation;
        position: relative;
        overflow: hidden;
    }
    
    .btn-analyze-professional:hover:not(:disabled) {
        transform: translateY(-2px) !important;
        box-shadow: 0 8px 24px rgba(59, 130, 246, 0.4) !important;
    }
    
    .btn-analyze-professional:active {
        transform: translateY(0) !important;
    }
    
    .btn-analyze-professional .btn-content {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        width: 100%;
    }
    
    .btn-analyze-professional .btn-icon {
        font-size: 1.2rem;
    }
    
    .btn-analyze-professional .btn-text {
        font-weight: 600;
    }
    
    /* Loading state for analyze button */
    .btn-analyze-professional.loading {
        cursor: not-allowed !important;
        opacity: 0.8 !important;
        transform: none !important;
    }
    
    .btn-analyze-professional.loading .btn-icon {
        animation: spin 1s linear infinite;
    }
    
    @keyframes spin {
        from { transform: rotate(0deg); }
        to { transform: rotate(360deg); }
    }
    
    /* Character counter mobile */
    .character-counter {
        position: absolute;
        bottom: 12px;
        right: 12px;
        background: rgba(255, 255, 255, 0.95);
        padding: 0.25rem 0.6rem;
        border-radius: 12px;
        font-size: 0.8rem;
        color: #64748b;
        border: 1px solid #e2e8f0;
        backdrop-filter: blur(4px);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }
    
    .character-counter.warning {
        color: #d97706;
        border-color: #facc15;
        background: rgba(254, 252, 232, 0.95);
    }
    
    .character-counter.danger {
        color: #dc2626;
        border-color: #fca5a5;
        background: rgba(254, 242, 242, 0.95);
    }
}

@media (max-width: 480px) {
    .professional-textarea {
        min-height: 180px;
        padding: 0.875rem;
        font-size: 16px !important; /* Still prevent zoom */
    }
    
    .textarea-header {
        padding: 0.6rem 0.875rem;
    }
    
    .character-counter {
        bottom: 8px;
        right: 8px;
        font-size: 0.75rem;
        padding: 0.2rem 0.5rem;
    }
    
    .btn-analyze-professional {
        min-height: 52px !important;
    }
}

/* Emergency layout fixes */
.ste-layout-stable.emergency-fix {
    transform: translateZ(0); /* Force hardware acceleration */
    backface-visibility: hidden;
}

/* Smooth transitions for layout changes */
.ste-check-container * {
    transition: all 0.2s ease-out;
}

/* Prevent content jump when results appear */
.ste-check-container.analyzing {
    position: relative;
}

.ste-check-container.analyzing::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: transparent;
    pointer-events: none;
}

/* Results section fade in enhancement */
.results-section {
    will-change: opacity, transform;
}

.results-section:not(.show) {
    pointer-events: none;
}

/* Collapsible sections improvements */
.collapsible-content {
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.collapsible-content.collapsed {
    max-height: 0;
    opacity: 0;
    transform: translateY(-10px);
}

.collapsible-content:not(.collapsed) {
    max-height: none; /* Remove height limit */
    opacity: 1;
    transform: translateY(0);
    overflow: visible; /* Allow content to flow naturally */
}

/* Special handling for sentence analysis section */
#sentenceAnalysis-content.collapsible-content:not(.collapsed) {
    max-height: 80vh; /* Reasonable viewport height limit */
    overflow-y: auto; /* Enable vertical scrolling */
    overflow-x: hidden; /* Prevent horizontal scrolling */
}

/* Enhanced button hover states */
.btn-analyze-professional {
    will-change: transform, box-shadow;
}

/* Loading overlay improvements */
.loading {
    position: relative;
    z-index: 100;
    will-change: opacity, transform;
}

/* Analysis Complete Indicator */
.analysis-complete-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    z-index: 1000;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 1.5rem 2rem;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(16, 185, 129, 0.4);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.analysis-complete-indicator.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.completion-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
}

.completion-content i {
    font-size: 1.5rem;
    animation: checkPulse 0.6s ease-out;
}

@keyframes checkPulse {
    0% { transform: scale(0.5); opacity: 0; }
    50% { transform: scale(1.2); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

/* Enhanced scroll behavior and parallax effects */
html {
    scroll-behavior: smooth;
}

body {
    overflow-x: hidden;
}

/* Smooth transitions for all elements */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Page entrance animation */
.ste-check-container {
    animation: pageEntrance 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    opacity: 0;
    transform: translateY(20px);
}

@keyframes pageEntrance {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Staggered animation for form elements */
.check-form .form-group > * {
    animation: elementSlideIn 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    opacity: 0;
    transform: translateY(15px);
}

.check-form .form-group > *:nth-child(1) { animation-delay: 0.1s; }
.check-form .form-group > *:nth-child(2) { animation-delay: 0.2s; }
.check-form .form-group > *:nth-child(3) { animation-delay: 0.3s; }
.check-form .form-group > *:nth-child(4) { animation-delay: 0.4s; }

@keyframes elementSlideIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Enhanced Professional File Operations Toolbar */
.file-operations-toolbar {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(248, 250, 252, 0.95) 100%);
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 2rem;
    align-items: start;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.operations-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.section-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.section-label i {
    font-size: 0.75rem;
    opacity: 0.8;
}

.button-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.btn-professional {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    color: #475569;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.btn-professional:hover {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    border-color: #cbd5e1;
    color: #334155;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

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

.btn-professional:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.btn-professional.danger {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border-color: #fca5a5;
    color: #dc2626;
}

.btn-professional.danger:hover:not(:disabled) {
    background: linear-gradient(135deg, #fecaca 0%, #fca5a5 100%);
    border-color: #f87171;
    color: #b91c1c;
}

.btn-professional i {
    font-size: 0.875rem;
    opacity: 0.8;
}

.btn-professional span {
    white-space: nowrap;
}

.status-panel {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1px solid #bae6fd;
    border-radius: 12px;
    padding: 1rem;
    min-width: 200px;
}

.status-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #0369a1;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    margin-bottom: 0.75rem;
}

.status-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.status-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.875rem;
}

.status-label {
    color: #64748b;
    font-weight: 500;
}

.file-status, .file-name {
    color: #1e293b;
    font-weight: 600;
}

.save-indicator {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: #059669;
    font-weight: 500;
}

.save-indicator.unsaved {
    color: #dc2626;
}

/* Professional Textarea Container */
.professional-textarea-container {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 252, 0.98) 100%);
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

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

.textarea-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
}

.textarea-title i {
    color: #6366f1;
    font-size: 1.125rem;
}

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

.btn-clear-text {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border: 1px solid #fca5a5;
    border-radius: 8px;
    color: #dc2626;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-clear-text:hover {
    background: linear-gradient(135deg, #fecaca 0%, #fca5a5 100%);
    border-color: #f87171;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.2);
}

.textarea-wrapper {
    position: relative;
}

.professional-textarea {
    width: 100%;
    min-height: 300px;
    max-height: 500px;
    padding: 1.25rem;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: #ffffff;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    color: #334155;
    resize: vertical;
    transition: all 0.2s ease;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.03);
}

.professional-textarea:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1), inset 0 2px 4px rgba(0, 0, 0, 0.03);
}

.professional-textarea::placeholder {
    color: #94a3b8;
    font-style: italic;
    white-space: pre-line;
}

.character-counter {
    position: absolute;
    bottom: 0.75rem;
    right: 0.75rem;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: #64748b;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    z-index: 10; /* Ensure it's above other content */
    pointer-events: none; /* Don't block clicks */
}

/* Document Statistics - Subtle and Less Prominent */
.document-statistics {
    background: rgba(248, 250, 252, 0.3);
    border: 1px solid rgba(226, 232, 240, 0.4);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.document-statistics:hover {
    opacity: 1;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    align-items: stretch;
}

.stat-card {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(226, 232, 240, 0.3);
    border-radius: 8px;
    padding: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.2s ease;
    min-width: 0;
    flex-shrink: 0;
    min-height: 84px; /* ensure consistent height when labels wrap */
}

.stat-card:hover {
    transform: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border-color: rgba(203, 213, 225, 0.6);
}

.stat-card.limit-warning {
    background: rgba(254, 243, 199, 0.4);
    border-color: rgba(245, 158, 11, 0.3);
}

.stat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 6px;
    color: #6366f1;
    font-size: 1rem;
    flex-shrink: 0;
}

.stat-card.limit-warning .stat-icon {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

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

.stat-value {
    font-size: 1.4rem;
    font-weight: 600;
    color: #475569;
    line-height: 1;
    margin-bottom: 0.2rem;
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.015em; /* slightly tighter to fit long labels */
    opacity: 0.8;
    line-height: 1.15;
    white-space: normal; /* allow wrapping */
    word-break: break-word; /* break long tokens like CHARS/SENTENCE if needed */
}

/* Compact analyze button when placed in the toolbar */
.file-operations-toolbar .btn-analyze-professional {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    height: 42px; /* more compact height */
    min-height: 42px; /* override base min-height */
    line-height: 1.2;
    border-radius: 8px;
    white-space: nowrap;
    max-width: 240px; /* tighter to avoid wrapping */
    width: auto; /* don't stretch to full width in toolbar */
    overflow: hidden;
}

.file-operations-toolbar .btn-analyze-professional .btn-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.6rem; /* reduce internal padding */
}

.file-operations-toolbar .btn-analyze-professional .btn-icon i {
    font-size: 0.95rem; /* smaller icon */
}

.file-operations-toolbar .btn-analyze-professional .btn-icon {
    width: 2rem; /* smaller icon container */
    height: 2rem;
    border-radius: 8px;
}

.file-operations-toolbar .btn-analyze-professional .btn-text .btn-title {
    font-size: 0.9rem; /* smaller text */
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-operations-toolbar .btn-analyze-professional .btn-text {
    margin-left: 0.5rem; /* tighter spacing */
}

.file-operations-toolbar .btn-analyze-professional .btn-shimmer {
    display: none; /* hide shimmer effect in compact toolbar context */
}

/* On small screens, let it grow naturally */
@media (max-width: 768px) {
    .file-operations-toolbar .btn-analyze-professional {
        max-width: 100%;
        height: 40px;
    }
}

/* Keep primary toolbar buttons on one row when space allows */
.file-operations-toolbar .primary-section .button-group {
    flex-wrap: nowrap;
}

/* On semi-narrow viewports, hide the icon to save width for the label */
@media (max-width: 1280px) {
    .file-operations-toolbar .btn-analyze-professional .btn-icon {
        display: none;
    }
}

/* Professional Analyze Button */
.analyze-section {
    text-align: center;
    margin: 2rem 0;
}

.btn-analyze-professional {
    /* Fallback styles */
    background: #6366f1;
    border: none;
    border-radius: 16px;
    padding: 20px 40px;
    color: white;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    max-width: 500px;
    min-height: 80px;
    text-align: center;
    
    /* Enhanced styles */
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.btn-analyze-professional:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 15px 40px rgba(99, 102, 241, 0.4);
}

.btn-analyze-professional:active:not(:disabled) {
    transform: translateY(-1px);
}

.btn-analyze-professional:disabled,
.btn-analyze-professional.analyzing {
    opacity: 0.7;
    cursor: not-allowed;
    background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
    transform: none;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.btn-analyze-professional.analyzing {
    position: relative;
    overflow: hidden;
}

.btn-analyze-professional.analyzing::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.1) 50%, 
        transparent 100%);
    animation: analyzing-shimmer 2s ease-in-out infinite;
    z-index: 1;
}

@keyframes analyzing-shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.btn-content {
    display: flex;
    align-items: center;
    padding: 1.5rem 2rem;
    position: relative;
    z-index: 2;
}

.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3.5rem;
    height: 3.5rem;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.btn-text {
    flex: 1;
    text-align: left;
    margin-left: 1.5rem;
}

.btn-title {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 0.25rem;
}

.btn-subtitle {
    display: block;
    font-size: 0.875rem;
    opacity: 0.8;
    font-weight: 500;
}

.btn-arrow {
    font-size: 1.25rem;
    opacity: 0.8;
    transition: transform 0.3s ease;
}

.btn-analyze-professional:hover .btn-arrow {
    transform: translateX(4px);
}

.btn-shimmer {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn-analyze-professional:hover .btn-shimmer {
    left: 100%;
}

.quick-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.quick-stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #64748b;
    font-weight: 500;
}

.quick-stat-item i {
    color: #6366f1;
    font-size: 1rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .file-operations-toolbar {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .document-statistics {
        padding: 0.75rem;
        margin-bottom: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    
    .stat-card {
        padding: 0.75rem;
        gap: 0.5rem;
        min-height: 60px;
    }
    
    .stat-icon {
        width: 2rem;
        height: 2rem;
        font-size: 0.875rem;
    }
    
    .stat-value {
        font-size: 1.2rem;
    }
    
    .stat-label {
        font-size: 0.7rem;
    }
    
    .btn-content {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    
    .btn-text {
        margin-left: 0;
        text-align: center;
    }
    
    .quick-stats {
        gap: 1rem;
    }
    
    .quick-stat-item {
        font-size: 0.8rem;
    }
}

/* Subscription Prompt Styles */
#subscriptionPrompt {
    margin: 2rem 0;
}

#subscriptionPrompt .results-card-body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
    border: none;
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.3);
    position: relative;
    overflow: hidden;
}

.subscription-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    padding: 2rem !important;
    border-radius: 12px !important;
    text-align: center !important;
    border: none !important;
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.3) !important;
    position: relative;
    overflow: hidden;
}

#subscriptionPrompt .results-card-body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="subscription-grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="white" opacity="0.03"/><circle cx="75" cy="75" r="1" fill="white" opacity="0.03"/></pattern></defs><rect width="100" height="100" fill="url(%23subscription-grain)"/></svg>');
    pointer-events: none;
}

#subscriptionPrompt .subscription-icon {
    margin-bottom: 1rem;
}

#subscriptionPrompt .subscription-icon i {
    font-size: 3rem;
    color: #ffd700;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

#subscriptionPrompt h3 {
    color: white;
    margin-bottom: 1rem;
    font-size: 1.8rem;
    font-weight: 600;
    position: relative;
    z-index: 1;
}

#subscriptionPrompt p {
    color: rgba(255,255,255,0.9);
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 1;
}

#subscriptionPrompt .subscription-benefits .benefit-item {
    text-align: center;
    margin-bottom: 1rem;
    padding: 0.5rem;
}

#subscriptionPrompt .subscription-benefits .benefit-item i {
    font-size: 1.5rem;
    color: #ffd700;
    margin-bottom: 0.5rem;
    display: block;
}

#subscriptionPrompt .subscription-benefits .benefit-item div {
    color: rgba(255,255,255,0.9) !important;
    font-size: 0.95rem !important;
    font-weight: 500 !important;
    margin-top: 0.25rem;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Additional specific styling for benefit text */
.subscription-card .benefit-item div {
    color: rgba(255,255,255,0.9) !important;
    font-size: 0.95rem !important;
    font-weight: 500 !important;
    text-align: center !important;
    margin-top: 0.25rem !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    line-height: 1.2;
}

#subscriptionPrompt .btn {
    background: #ffd700;
    color: #333;
    font-weight: bold;
    padding: 12px 30px;
    border-radius: 25px;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
    border: none;
    font-size: 1rem;
    position: relative;
    z-index: 1;
}

#subscriptionPrompt .btn:hover {
    background: #ffed4e;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.4);
    color: #333;
    text-decoration: none;
}

#subscriptionPrompt .btn i {
    margin-right: 8px;
}

.subscription-btn {
    background: #ffd700 !important;
    color: #333 !important;
    font-weight: bold !important;
    padding: 12px 30px !important;
    border-radius: 25px !important;
    text-decoration: none !important;
    display: inline-block !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3) !important;
    border: none !important;
    font-size: 1rem !important;
    position: relative;
    z-index: 1;
}

.subscription-btn:hover {
    background: #ffed4e !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.4) !important;
    color: #333 !important;
    text-decoration: none !important;
}

/* Ensure subscription benefits are visible */
.subscription-benefits {
    position: relative;
    z-index: 2;
}

.subscription-benefits .row {
    margin: 0 -15px;
}

.subscription-benefits .col-md-4 {
    padding: 0 15px;
}

.subscription-benefits .benefit-item {
    background: rgba(255,255,255,0.1);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid rgba(255,255,255,0.2);
    transition: all 0.3s ease;
}

.subscription-benefits .benefit-item:hover {
    background: rgba(255,255,255,0.15);
    transform: translateY(-2px);
}

/* STE Check Layout - Layout Stabilization */
.ste-check-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden; /* Prevent horizontal scroll */
}

.ste-check-form {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.ste-check-form * {
    box-sizing: border-box;
}

/* Prevent layout breaking */
.professional-textarea-container,
.document-statistics,
.analyze-section {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    position: relative; /* Establish stacking context */
}

.hero-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 4rem 1rem;
    text-align: center;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
    animation: heroGlow 8s ease-in-out infinite alternate;
}

@keyframes heroGlow {
    0% { box-shadow: 0 0 20px rgba(102, 126, 234, 0.3); }
    100% { box-shadow: 0 0 40px rgba(118, 75, 162, 0.4); }
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="white" opacity="0.03"/><circle cx="75" cy="75" r="1" fill="white" opacity="0.03"/><circle cx="50" cy="10" r="0.5" fill="white" opacity="0.02"/><circle cx="10" cy="50" r="0.5" fill="white" opacity="0.02"/><circle cx="90" cy="30" r="0.5" fill="white" opacity="0.02"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    pointer-events: none;
    animation: floatPattern 20s linear infinite;
}

@keyframes floatPattern {
    0% { transform: translateX(0) translateY(0); }
    25% { transform: translateX(-10px) translateY(-5px); }
    50% { transform: translateX(5px) translateY(-10px); }
    75% { transform: translateX(-5px) translateY(5px); }
    100% { transform: translateX(0) translateY(0); }
}

.hero-section h1 {
    font-size: 2.8rem;
    margin-bottom: 1rem;
    font-weight: 700;
    position: relative;
    z-index: 1;
    letter-spacing: -0.02em;
}

.hero-subtitle {
    font-size: 1.4rem;
    opacity: 0.95;
    max-width: 700px;
    margin: 0 auto 1.5rem auto;
    font-weight: 500;
    position: relative;
    z-index: 1;
    letter-spacing: 0.01em;
}

.hero-description {
    font-size: 1.1rem;
    opacity: 0.85;
    max-width: 800px;
    margin: 0 auto 2.5rem auto;
    line-height: 1.6;
    position: relative;
    z-index: 1;
}

.hero-features {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-top: 2rem;
    position: relative;
    z-index: 1;
}

.feature-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.15);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    padding: 0.75rem 1.25rem;
    border-radius: 25px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    cursor: default;
    animation: featureBadgeFloat 6s ease-in-out infinite;
}

.feature-badge:nth-child(1) { animation-delay: 0s; }
.feature-badge:nth-child(2) { animation-delay: 1.5s; }
.feature-badge:nth-child(3) { animation-delay: 3s; }
.feature-badge:nth-child(4) { animation-delay: 4.5s; }

@keyframes featureBadgeFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-5px) rotate(0.5deg); }
    50% { transform: translateY(-2px) rotate(-0.5deg); }
    75% { transform: translateY(-7px) rotate(0.3deg); }
}

.feature-badge:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
}

.feature-badge i {
    font-size: 1.1rem;
    opacity: 0.9;
    transition: all 0.3s ease;
}

.feature-badge:hover i {
    opacity: 1;
    transform: scale(1.1);
}

.feature-badge span {
    font-size: 0.95rem;
    white-space: nowrap;
}

.check-form {
    background: white;
    padding: 2rem;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

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

.form-group label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.form-control {
    width: 100%;
    padding: 0.875rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    box-sizing: border-box;
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-control.textarea {
    min-height: 400px;
    resize: vertical;
}

.textarea-container {
    position: relative;
}

/* File Operations Toolbar */
.file-operations-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.8);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.file-operations-group {
    display: flex;
    gap: 0.5rem;
}

.btn-file-op {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    color: #495057;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-file-op:hover:not(:disabled) {
    background: #667eea;
    color: white;
    border-color: #667eea;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.btn-file-op:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-file-op i {
    font-size: 0.875rem;
}

.file-info-group {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.875rem;
}

.file-status {
    color: #6c757d;
    font-style: italic;
    min-width: 80px; /* Ensure consistent layout */
}

.file-name {
    color: #495057;
    font-weight: 500;
    background: rgba(102, 126, 234, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    border-left: 2px solid rgba(102, 126, 234, 0.3);
}

.file-name:empty {
    display: none;
}

.document-name {
    font-weight: 600;
    color: #495057;
    background: rgba(102, 126, 234, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    display: inline-block;
}

.warning-text {
    color: #856404;
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 6px;
    padding: 0.75rem;
    margin: 1rem 0;
    font-size: 0.9rem;
}

.warning-text i {
    color: #b08800;
    margin-right: 0.5rem;
}

#fileInput {
    display: none !important;
}

.btn-clear {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(108, 117, 125, 0.1);
    color: #6c757d;
    border: none;
    padding: 6px;
    border-radius: 6px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    z-index: 10;
}

.btn-clear:hover {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
    transform: scale(1.05);
}

.btn-check {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-check:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
}

.btn-check:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Professional Full-Screen Loading Overlay */
.professional-loading-overlay {
    display: none !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 999999 !important;
    opacity: 0;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: auto !important;
}

.professional-loading-overlay.show {
    display: flex !important;
    opacity: 1 !important;
    animation: overlayFadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.loading-backdrop {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(255, 255, 255, 0.98) !important;
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    z-index: 999998 !important;
}

.loading-content {
    position: relative !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    height: 100% !important;
    padding: 2rem !important;
    z-index: 999999 !important;
}

/* Professional Spinner Animation */
.professional-spinner-container {
    position: relative;
    margin-bottom: 3rem;
    filter: drop-shadow(0 8px 32px rgba(102, 126, 234, 0.25));
}

.professional-spinner {
    position: relative;
    width: 140px;
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.spinner-ring {
    position: absolute;
    border-radius: 50%;
    border: 2px solid transparent;
    opacity: 0.8;
}

.spinner-ring:nth-child(1) {
    width: 140px;
    height: 140px;
    border-top: 3px solid #667eea;
    border-right: 3px solid rgba(102, 126, 234, 0.3);
    animation: spinClockwise 3s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.spinner-ring:nth-child(2) {
    width: 110px;
    height: 110px;
    border-bottom: 3px solid #764ba2;
    border-left: 3px solid rgba(118, 75, 162, 0.4);
    animation: spinCounterClockwise 2.2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.spinner-ring:nth-child(3) {
    width: 80px;
    height: 80px;
    border-top: 2px solid #4facfe;
    border-right: 2px solid rgba(79, 172, 254, 0.5);
    animation: spinClockwise 1.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.spinner-center {
    position: absolute;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    box-shadow: 
        0 4px 20px rgba(102, 126, 234, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    z-index: 100000;
    animation: centerPulse 2.5s ease-in-out infinite;
}

.spinner-icon {
    color: white;
    font-size: 20px;
    animation: iconFloat 3s ease-in-out infinite;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Loading Text Container */
.loading-text-container {
    text-align: center;
    max-width: 500px;
    animation: textFadeIn 0.8s ease-out 0.5s both;
}

.loading-title {
    margin: 0 0 1.5rem 0;
    font-size: 1.8rem;
    font-weight: 600;
    color: #2d3748;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0.025em;
    line-height: 1.2;
}

.loading-description {
    margin: 0 0 3rem 0;
    font-size: 1.1rem;
    color: #4a5568;
    font-weight: 400;
    line-height: 1.6;
    opacity: 0.85;
}

/* Enhanced Loading Steps Indicator */
.loading-steps {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 3rem;
    margin-top: 2rem;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 20px;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.4;
    transform: scale(0.95);
}

.step.active {
    opacity: 1;
    transform: scale(1);
}

.step.completed {
    opacity: 0.8;
    transform: scale(1.05);
}

.step-indicator {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e0 100%);
    position: relative;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.step.active .step-indicator {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    animation: stepPulse 2s ease-in-out infinite;
    box-shadow: 
        0 4px 16px rgba(102, 126, 234, 0.4),
        0 0 0 0 rgba(102, 126, 234, 0.4);
}

.step.completed .step-indicator {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3);
}

.step.completed .step-indicator::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 10px;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.step span {
    font-size: 0.85rem;
    font-weight: 500;
    color: #4a5568;
    text-align: center;
    min-width: 80px;
    transition: color 0.3s ease;
}

.step.active span {
    color: #2d3748;
    font-weight: 600;
}

.step.completed span {
    color: #059669;
    font-weight: 600;
}

/* Enhanced Animations */
@keyframes overlayFadeIn {
    from { 
        opacity: 0; 
        transform: scale(0.98); 
    }
    to { 
        opacity: 1; 
        transform: scale(1); 
    }
}

@keyframes spinClockwise {
    from { 
        transform: rotate(0deg); 
        opacity: 0.6;
    }
    50% {
        opacity: 1;
    }
    to { 
        transform: rotate(360deg);
        opacity: 0.6;
    }
}

@keyframes spinCounterClockwise {
    from { 
        transform: rotate(360deg);
        opacity: 0.8;
    }
    50% {
        opacity: 1;
    }
    to { 
        transform: rotate(0deg);
        opacity: 0.8;
    }
}

@keyframes centerPulse {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 
            0 4px 20px rgba(102, 126, 234, 0.4),
            inset 0 1px 0 rgba(255, 255, 255, 0.2);
    }
    50% { 
        transform: scale(1.05);
        box-shadow: 
            0 8px 32px rgba(102, 126, 234, 0.6),
            inset 0 1px 0 rgba(255, 255, 255, 0.3);
    }
}

@keyframes iconFloat {
    0%, 100% { 
        transform: translateY(0);
    }
    50% { 
        transform: translateY(-2px);
    }
}

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

@keyframes stepPulse {
    0%, 100% { 
        transform: scale(1); 
        box-shadow: 
            0 4px 16px rgba(102, 126, 234, 0.4),
            0 0 0 0 rgba(102, 126, 234, 0.4);
    }
    50% { 
        transform: scale(1.1); 
        box-shadow: 
            0 6px 20px rgba(102, 126, 234, 0.5),
            0 0 0 8px rgba(102, 126, 234, 0.1);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .loading-content {
        padding: 1.5rem;
    }
    
    .professional-spinner {
        width: 100px;
        height: 100px;
    }
    
    .spinner-ring:nth-child(1) {
        width: 100px;
        height: 100px;
    }
    
    .spinner-ring:nth-child(2) {
        width: 80px;
        height: 80px;
    }
    
    .spinner-ring:nth-child(3) {
        width: 60px;
        height: 60px;
    }
    
    .spinner-center {
        width: 40px;
        height: 40px;
    }
    
    .spinner-icon {
        font-size: 16px;
    }
    
    .loading-title {
        font-size: 1.4rem;
    }
    
    .loading-description {
        font-size: 0.95rem;
    }
    
    .loading-steps {
        gap: 1.5rem;
        padding: 1.5rem;
        flex-wrap: wrap;
    }
    
    .step span {
        font-size: 0.8rem;
        min-width: 70px;
    }
}

@media (max-width: 480px) {
    .professional-spinner {
        width: 80px;
        height: 80px;
        margin-bottom: 2rem;
    }
    
    .spinner-ring:nth-child(1) {
        width: 80px;
        height: 80px;
    }
    
    .spinner-ring:nth-child(2) {
        width: 65px;
        height: 65px;
    }
    
    .spinner-ring:nth-child(3) {
        width: 50px;
        height: 50px;
    }
    
    .spinner-center {
        width: 35px;
        height: 35px;
    }
    
    .spinner-icon {
        font-size: 14px;
    }
    
    .loading-title {
        font-size: 1.2rem;
        margin-bottom: 1rem;
    }
    
    .loading-description {
        font-size: 0.9rem;
        margin-bottom: 2rem;
    }
    
    .loading-steps {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    
    .step {
        flex-direction: row;
        gap: 1rem;
        justify-content: flex-start;
        width: 100%;
        max-width: 200px;
    }
    
    .step span {
        text-align: left;
        min-width: auto;
    }
}

/* Legacy Loading Support (for backwards compatibility) */
.loading {
    display: none;
    text-align: center;
    padding: 3rem 2rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    margin: 2rem 0;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(102, 126, 234, 0.1);
}

.loading.show {
    display: block;
    animation: loadingFadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes loadingFadeIn {
    from { 
        opacity: 0; 
        transform: translateY(-30px) scale(0.95); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0) scale(1); 
    }
}

.loading-spinner {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 60px;
    margin-bottom: 1.5rem;
}

.loading-spinner::before,
.loading-spinner::after {
    content: '';
    position: absolute;
    border-radius: 50%;
}

.loading-spinner::before {
    width: 60px;
    height: 60px;
    border: 3px solid rgba(102, 126, 234, 0.1);
    border-top: 3px solid #667eea;
    border-right: 3px solid #667eea;
    animation: loadingSpin 1.2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.loading-spinner::after {
    width: 40px;
    height: 40px;
    top: 10px;
    left: 10px;
    border: 2px solid rgba(118, 75, 162, 0.1);
    border-bottom: 2px solid #764ba2;
    border-left: 2px solid #764ba2;
    animation: loadingSpin 1.8s cubic-bezier(0.4, 0, 0.2, 1) infinite reverse;
}

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

.loading-text {
    color: #2d3748;
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: 0.025em;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.loading-subtitle {
    color: #4a5568;
    font-size: 0.95rem;
    margin: 0;
    opacity: 0.8;
    font-weight: 500;
    line-height: 1.4;
}

.loading-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(102, 126, 234, 0.3) 25%, 
        #667eea 50%, 
        rgba(118, 75, 162, 0.8) 75%, 
        transparent 100%);
    background-size: 200% 100%;
    animation: loadingProgress 2.5s ease-in-out infinite;
    border-radius: 0 0 12px 12px;
}

@keyframes loadingProgress {
    0%, 100% { background-position: -200% 0; }
    50% { background-position: 200% 0; }
}

@keyframes loadingProgress {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Responsive loading design */
@media (max-width: 768px) {
    .loading {
        padding: 2rem 1rem;
        margin: 1rem 0;
    }
    
    .loading-spinner {
        width: 50px;
        height: 50px;
        margin-bottom: 1rem;
    }
    
    .loading-spinner::before {
        width: 50px;
        height: 50px;
    }
    
    .loading-spinner::after {
        width: 34px;
        height: 34px;
        top: 8px;
        left: 8px;
    }
    
    .loading-text {
        font-size: 1.1rem;
    }
    
    .loading-subtitle {
        font-size: 0.85rem;
        padding: 0 1rem;
    }
}

.results-section {
    margin-top: 0;
    display: none;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    isolation: isolate;
    position: relative;
    z-index: 1;
}

.results-section.show {
    display: block !important;
    opacity: 1 !important;
    transform: translateY(0) !important;
    visibility: visible !important;
    animation: slideInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes slideInUp {
    0% { 
        opacity: 0; 
        transform: translateY(30px) scale(0.95); 
    }
    100% { 
        opacity: 1; 
        transform: translateY(0) scale(1); 
    }
}

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

/* Enhanced Results Cards */
.results-card {
    background: linear-gradient(145deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(226, 232, 240, 0.8);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 1.5rem;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    position: relative;
}

.results-card:hover {
    box-shadow: 0 12px 40px rgba(102, 126, 234, 0.15);
    border-color: rgba(102, 126, 234, 0.3);
    transform: translateY(-2px);
}

.results-card:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
}

.results-card-header {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(226, 232, 240, 0.6);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.results-card-header h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
    color: #2d3748;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.results-card-header h3 i {
    color: #667eea;
    font-size: 1.1rem;
}

.results-card-body {
    padding: 1.75rem 1.5rem;
    background: rgba(255, 255, 255, 0.8);
}

/* Word Status Breakdown */
.status-bar {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.status-bar:last-child {
    margin-bottom: 0;
}

.status-label {
    min-width: 150px;
    font-weight: 600;
    margin-right: 1rem;
}

.status-progress {
    flex: 1;
    height: 20px;
    background: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
    margin-right: 1rem;
    position: relative;
}

.status-progress-bar {
    height: 100%;
    border-radius: 10px;
    transition: width 0.6s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-progress-bar.approved {
    background: linear-gradient(90deg, #28a745, #20c997);
}

.status-progress-bar.unapproved {
    background: linear-gradient(90deg, #dc3545, #e74c3c);
}

.status-progress-bar.unclassified {
    background: linear-gradient(90deg, #6c757d, #495057);
}

.status-progress-bar.non-us {
    background: linear-gradient(90deg, #ffc107, #fd7e14);
}

.status-count {
    min-width: 80px;
    text-align: right;
    font-weight: 600;
    color: #333;
}

/* Legend */
.legend {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.legend-item {
    padding: 0.375rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    color: white;
}

.legend-item.approved {
    background: #28a745;
}

.legend-item.unapproved {
    background: #dc3545;
}

.legend-item.non-us {
    background: #ffc107;
    color: #333;
}

.legend-item.unclassified {
    background: #6c757d;
}

/* Word Categories Grid */
.word-categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.word-category-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
    border: 1px solid #e9ecef;
    overflow: hidden;
    transition: all 0.3s ease;
}

.word-category-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.word-category-header {
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e9ecef;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.word-category-header:hover {
    opacity: 0.9;
}

.word-category-card.approved-words .word-category-header {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border-bottom-color: #c3e6cb;
}

.word-category-card.unapproved-words .word-category-header {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    border-bottom-color: #f5c6cb;
}

.word-category-card.unclassified-words .word-category-header {
    background: linear-gradient(135deg, #e2e3e5 0%, #d6d8db 100%);
    border-bottom-color: #d6d8db;
}

.word-category-card.non-us-words .word-category-header {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border-bottom-color: #ffeaa7;
}

.word-category-header h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #333;
}

.word-count {
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.875rem;
    font-weight: 600;
    color: white;
}

.approved-words .word-count {
    background: #28a745;
}

.unapproved-words .word-count {
    background: #dc3545;
}

.unclassified-words .word-count {
    background: #6c757d;
}

.non-us-words .word-count {
    background: #ffc107;
    color: #333;
}

.word-category-body {
    padding: 1rem;
    max-height: 300px;
    overflow-y: auto;
}

/* Word Tags */
.word-tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    margin: 0.25rem;
    border-radius: 15px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.word-tag:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.word-tag.approved {
    background: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}

.word-tag.unapproved {
    background: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

.word-tag.unclassified {
    background: #e2e3e5;
    color: #383d41;
    border-color: #d6d8db;
}

.word-tag.non-us {
    background: #fff3cd;
    color: #856404;
    border-color: #ffeaa7;
}

/* Statistics Grid */
.statistics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.stat-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
    cursor: pointer;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #333;
}

.stat-label {
    font-size: 0.875rem;
    color: #6c757d;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Sentence Analysis */
#sentenceAnalysis {
    /* Ensure proper container behavior */
    display: block;
    width: 100%;
    /* Prevent any column layouts */
    column-count: initial;
    column-width: initial;
    /* Prevent page breaks */
    break-inside: auto;
    page-break-inside: auto;
}

.sentence-item {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #667eea;
    /* Prevent page/column breaks within sentence items */
    break-inside: avoid;
    page-break-inside: avoid;
    /* Ensure proper block display */
    display: block;
    position: relative;
    /* Ensure minimum height to prevent collapsing */
    min-height: 60px;
    /* Ensure proper box model */
    box-sizing: border-box;
}

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

.sentence-number {
    font-weight: 600;
    color: #667eea;
    font-size: 0.875rem;
}

.sentence-info {
    font-size: 0.75rem;
    color: #6c757d;
}

.passive-voice-indicator {
    color: #f39c12;
    font-weight: 600;
    background-color: rgba(243, 156, 18, 0.1);
    padding: 0.125rem 0.25rem;
    border-radius: 3px;
    font-size: 0.7rem;
}

.sentence-classification {
    color: #6f42c1;
    font-weight: 600;
    background-color: rgba(111, 66, 193, 0.1);
    padding: 0.125rem 0.25rem;
    border-radius: 3px;
    font-size: 0.7rem;
}

.word-count-violation {
    color: #dc3545;
    font-weight: 600;
}

.word-count-violation-indicator {
    color: #dc3545;
    font-weight: 600;
    background-color: rgba(220, 53, 69, 0.1);
    padding: 0.125rem 0.25rem;
    border-radius: 3px;
    font-size: 0.7rem;
}

.cluster-nouns-indicator {
    color: #17a2b8;
    font-weight: 600;
    background-color: rgba(23, 162, 184, 0.1);
    padding: 0.125rem 0.25rem;
    border-radius: 3px;
    font-size: 0.7rem;
}

.cluster-nouns-indicator.clickable-indicator:hover {
    background-color: rgba(23, 162, 184, 0.2);
}

.main-idea-violation-indicator {
    color: #e83e8c;
    font-weight: 600;
    background-color: rgba(232, 62, 140, 0.1);
    padding: 0.125rem 0.25rem;
    border-radius: 3px;
    font-size: 0.7rem;
}

.clickable-indicator {
    cursor: pointer;
    transition: all 0.2s ease;
}

.clickable-indicator:hover {
    background-color: rgba(232, 62, 140, 0.2);
    transform: scale(1.05);
}

.main-idea-violation-indicator.clickable-indicator:hover {
    background-color: rgba(232, 62, 140, 0.2);
}

.complex-tenses-violation-indicator {
    color: #fd7e14;
    font-weight: 600;
    background-color: rgba(253, 126, 20, 0.1);
    padding: 0.125rem 0.25rem;
    border-radius: 3px;
    font-size: 0.7rem;
}

.complex-tenses-violation-indicator.clickable-indicator:hover {
    background-color: rgba(253, 126, 20, 0.2);
}

.cluster-nouns-section {
    background-color: #f8f9fa;
    border: 1px solid rgba(23, 162, 184, 0.2);
    border-radius: 6px;
    padding: 1rem;
    margin: 0.75rem 0;
    font-size: 0.9rem;
}

.cluster-nouns-header {
    color: #17a2b8;
    font-weight: 600;
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
}

.cluster-nouns-header i {
    margin-right: 0.5rem;
}

.cluster-nouns-list {
    margin-bottom: 0.75rem;
}

.cluster-noun-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 0.5rem;
    background-color: white;
    padding: 0.5rem;
    border-radius: 4px;
    border-left: 3px solid #17a2b8;
}

.cluster-number {
    color: #17a2b8;
    font-weight: 600;
    margin-right: 0.5rem;
    min-width: 20px;
}

.cluster-text {
    color: #495057;
    font-style: italic;
    flex: 1;
    word-break: break-word;
}

.cluster-nouns-explanation {
    color: #6c757d;
    font-size: 0.8rem;
    padding: 0.5rem;
    background-color: rgba(23, 162, 184, 0.05);
    border-radius: 4px;
    border-left: 3px solid rgba(23, 162, 184, 0.3);
}

.cluster-nouns-explanation i {
    margin-right: 0.5rem;
    color: #17a2b8;
}

.main-idea-section {
    background-color: #f8f9fa;
    border: 1px solid rgba(232, 62, 140, 0.2);
    border-radius: 6px;
    padding: 1rem;
    margin: 0.75rem 0;
    font-size: 0.9rem;
}

.main-idea-header {
    color: #e83e8c;
    font-weight: 600;
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
}

.main-idea-header i {
    margin-right: 0.5rem;
}

.main-idea-details {
    margin-bottom: 0.75rem;
}

.main-idea-description {
    color: #495057;
    margin-bottom: 0.5rem;
    font-style: italic;
}

.conjunctions-found,
.semicolons-found {
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    background-color: white;
    border-radius: 4px;
    border-left: 3px solid #e83e8c;
    font-size: 0.85rem;
}

.conjunctions-found strong,
.semicolons-found strong {
    color: #e83e8c;
}

.main-idea-explanation {
    color: #6c757d;
    font-size: 0.8rem;
    padding: 0.5rem;
    background-color: rgba(232, 62, 140, 0.05);
    border-radius: 4px;
    border-left: 3px solid rgba(232, 62, 140, 0.3);
}

.complex-tenses-section {
    background-color: #f8f9fa;
    border: 1px solid rgba(253, 126, 20, 0.2);
    border-radius: 6px;
    padding: 1rem;
    margin: 0.75rem 0;
    font-size: 0.9rem;
}

.complex-tenses-header {
    color: #fd7e14;
    font-weight: 600;
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
}

.complex-tenses-header i {
    margin-right: 0.5rem;
}

.complex-tenses-details {
    margin-bottom: 0.75rem;
}

.complex-tenses-description {
    color: #495057;
    margin-bottom: 0.5rem;
    font-style: italic;
}

.complex-tenses-found {
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    background-color: white;
    border-radius: 4px;
    border-left: 3px solid #fd7e14;
    font-size: 0.85rem;
}

.complex-tenses-found strong {
    color: #fd7e14;
}

.complex-tense-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 0.5rem;
    background-color: white;
    padding: 0.5rem;
    border-radius: 4px;
    border-left: 3px solid #fd7e14;
}

.complex-tense-text {
    font-weight: 600;
    color: #fd7e14;
    margin-right: 0.5rem;
}

.complex-tense-type {
    color: #6c757d;
    font-size: 0.8rem;
    font-style: italic;
}

.complex-tenses-explanation {
    color: #6c757d;
    font-size: 0.8rem;
    padding: 0.5rem;
    background-color: rgba(253, 126, 20, 0.05);
    border-radius: 4px;
    border-left: 3px solid rgba(253, 126, 20, 0.3);
}

.complex-tenses-explanation i {
    margin-right: 0.5rem;
    color: #fd7e14;
}

.main-idea-explanation i {
    margin-right: 0.5rem;
    color: #e83e8c;
}

.sentence-text {
    line-height: 1.6;
    margin-bottom: 0.75rem;
}

.word-highlight {
    padding: 0.125rem 0.25rem;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.word-highlight:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.word-highlight.approved {
    background: #d4edda;
    color: #155724;
}

.word-highlight.unapproved {
    background: #f8d7da;
    color: #721c24;
}

.word-highlight.unclassified {
    background: #e2e3e5;
    color: #383d41;
}

.word-highlight.non-us {
    background: #fff3cd;
    color: #856404;
}

/* Badge */
.badge {
    padding: 0.375rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    color: white;
    background: #667eea;
}

.section-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
    border: 1px solid #e9ecef;
    margin-bottom: 1.5rem;
    overflow: hidden;
    transition: all 0.3s ease;
}

.section-card:hover {
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.1);
    border-color: #667eea;
}

.collapsible-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: none;
    border-radius: 0;
    padding: 1rem;
    transition: all 0.3s ease;
    position: relative;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    cursor: pointer;
    width: 100%;
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.collapsible-header:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.collapsible-content {
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.collapsible-content.collapsed {
    display: none;
}

.collapsible-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

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

.summary-card {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
    border-left: 4px solid #667eea;
}

.summary-card h3 {
    font-size: 2rem;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 0.5rem;
}

.summary-card p {
    color: #666;
    margin: 0;
    font-size: 0.9rem;
}

.sentence-item {
    padding: 1rem;
    border-bottom: 1px solid #e9ecef;
    transition: background-color 0.2s ease;
}

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

.sentence-item:hover {
    background-color: #f8f9fa;
}

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

.sentence-number {
    font-weight: 600;
    color: #667eea;
}

.sentence-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
    color: #666;
}

.sentence-content {
    line-height: 1.6;
    margin-bottom: 0.5rem;
}

.word-clickable {
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 2px 4px;
    border-radius: 3px;
    margin: 0 1px;
}

.word-clickable:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.word-approved {
    background-color: #d4edda;
    color: #155724;
}

.word-unapproved {
    background-color: #f8d7da;
    color: #721c24;
}

.word-unclassified {
    background-color: #fff3cd;
    color: #856404;
}

.word-nonus {
    background-color: #d1ecf1;
    color: #0c5460;
}

.sentence-issues {
    margin-top: 0.5rem;
    font-size: 0.875rem;
}

.issue-tag {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-right: 0.5rem;
}

.issue-passive {
    background-color: #fff3cd;
    color: #856404;
}

.issue-errors {
    background-color: #f8d7da;
    color: #721c24;
}

/* Legacy Modal Styles - Updated for Consistency */
.modal, .modal-overlay {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.3);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: #ffffff !important;
    margin: 5% auto;
    padding: 0;
    border: none;
    border-radius: 15px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    animation: modalSlide 0.3s ease-out;
    position: relative;
}

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

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

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.modal-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.modal-close:hover {
    background-color: rgba(255,255,255,0.2);
}

.modal-body {
    padding: 1.5rem;
    max-height: 60vh;
    overflow-y: auto;
    color: #2c3e50 !important;
    background-color: #ffffff !important;
    line-height: 1.6;
}

/* Ensure all modal content has proper light background */
.modal-body,
.modal-body *,
#mainIdeaModal .modal-body,
#mainIdeaModal .modal-body *,
#complexTensesModal .modal-body,
#complexTensesModal .modal-body *,
#nounClustersModal .modal-body,
#nounClustersModal .modal-body * {
    color: #2c3e50 !important;
    background-color: transparent !important;
}

/* Specific styling for STE rule violation content */
.modal-body .word-info-section {
    background-color: #f8f9fa !important;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
}

.modal-body .word-info-section h4 {
    color: #2c3e50 !important;
    font-weight: 600;
    margin-bottom: 1rem;
}

.modal-body .word-info-section p,
.modal-body .word-info-section div,
.modal-body .word-info-section span {
    color: #5a6c7d !important;
}

/* Fix for specific violation indicators in modals */
.modal-body .complex-tense-text,
.modal-body .complex-tense-type,
.modal-body .cluster-text,
.modal-body .cluster-number {
    background-color: #f8f9fa !important;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    margin: 0.2rem;
    display: inline-block;
}

/* Word Modal Status Headers - Match Sentence Analysis Colors */
.word-status-header {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    text-align: center;
    font-weight: 600;
    border: 1px solid;
}

.status-approved {
    background-color: #d4edda !important;
    color: #155724 !important;
    border-color: #c3e6cb;
}

.status-unapproved {
    background-color: #f8d7da !important;
    color: #721c24 !important;
    border-color: #f5c6cb;
}

.status-unclassified {
    background-color: #e2e3e5 !important;
    color: #383d41 !important;
    border-color: #d6d8db;
}

.status-nonus {
    background-color: #fff3cd !important;
    color: #856404 !important;
    border-color: #ffeaa7;
}

.word-info-section {
    margin-bottom: 1.5rem;
}

.word-info-section h4 {
    color: #333;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.alternatives-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

/* Legacy alternative item styles - updated for consistency */
.alternative-item {
    background: #ffffff !important;
    padding: 0.5rem 0.75rem; /* Reduced from 0.75rem 1rem */
    border-radius: 8px; /* Reduced from 10px */
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem; /* Reduced from 1rem */
    border: 2px solid #e1e8ed !important;
    display: flex;
    align-items: center;
}

.alternative-item:hover {
    background: #f0f8ff !important;
    color: #667eea;
    border-color: #667eea !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.15);
}

.copy-alternative {
    background: #667eea;
    color: white;
    border: none;
    padding: 0.3rem 0.8rem;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.copy-alternative:hover {
    background: #5a6fd8;
    transform: scale(1.05);
}

.info-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.8rem;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #e9ecef;
}

.info-item label {
    font-weight: 600;
    color: #495057 !important;
}

.info-item span {
    color: #333 !important;
    font-weight: normal;
}

.word-value {
    font-family: monospace;
    background: #f8f9fa;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.approved-meaning {
    font-style: italic;
    background: #e7f3ff;
    padding: 0.4rem; /* Reduced from 0.5rem */
    border-radius: 4px;
    border-left: 3px solid #0077cc;
    color: #1a1a1a;
    line-height: 1.3; /* Reduced from 1.4 */
    font-size: 0.9rem; /* Added smaller font size */
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e9ecef;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

#modalWordTitle {
    color: #fff !important;
    margin: 0;
}

/* Rule 1.2 Modal Specific Styles */
.sentence-text {
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid #e83e8c;
    font-style: italic;
    margin-top: 0.5rem;
}

.issue-details {
    background-color: #fff3cd;
    padding: 0.75rem;
    border-radius: 6px;
    border: 1px solid #ffeaa7;
    margin-top: 0.5rem;
}

.conjunctions-list {
    background-color: #f8d7da;
    padding: 0.75rem;
    border-radius: 6px;
    border: 1px solid #f5c6cb;
    margin-top: 0.5rem;
    font-weight: 600;
    color: #721c24;
}

.semicolons-info {
    background-color: #f8d7da;
    padding: 0.75rem;
    border-radius: 6px;
    border: 1px solid #f5c6cb;
    margin-top: 0.5rem;
    font-weight: 600;
    color: #721c24;
}

.rule-explanation {
    background-color: #d4edda;
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid #28a745;
    margin-top: 0.5rem;
}

.rule-explanation i {
    margin-right: 0.5rem;
    color: #28a745;
}

/* Rule 1.5 Complex Tenses Modal Specific Styles */
.complex-tenses-list {
    background-color: #fff3cd;
    padding: 0.75rem;
    border-radius: 6px;
    border: 1px solid #ffeaa7;
    margin-top: 0.5rem;
}

.complex-tense-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f0f0f0;
}

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

.complex-tense-text {
    font-weight: 600;
    color: #856404;
    background-color: rgba(255, 193, 7, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.complex-tense-type {
    font-size: 0.875rem;
    color: #6c757d;
    font-style: italic;
}

/* Rule 17 Noun Clusters Modal Specific Styles */
.noun-clusters-list {
    background-color: #d1ecf1;
    padding: 0.75rem;
    border-radius: 6px;
    border: 1px solid #bee5eb;
    margin-top: 0.5rem;
}

.noun-cluster-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(23, 162, 184, 0.1);
}

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

.cluster-number {
    font-weight: 600;
    color: #17a2b8;
    margin-right: 0.75rem;
    min-width: 1.5rem;
}

.cluster-text {
    font-weight: 600;
    color: #0c5460;
    background-color: rgba(23, 162, 184, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
}

.modal-header h3 {
    color: #fff !important;
}

.tip-section {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid #667eea;
    margin-top: 1rem;
}

.tip-category {
    font-size: 0.8rem;
    color: #667eea;
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.tip-title {
    font-weight: 600;
    color: #333;
    margin-bottom: 0.3rem;
}

.tip-description {
    font-size: 0.9rem;
    color: #666;
    line-height: 1.4;
}

/* Feature cards for the bottom */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 3rem;
}

.feature-card {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 12px;
    border-left: 4px solid #667eea;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.feature-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}

.feature-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.feature-icon i {
    color: white;
    font-size: 1.5rem;
}

.feature-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
}

.feature-description {
    color: #666;
    line-height: 1.5;
    font-size: 0.95rem;
}

/* Enhanced Feature Cards Styling */
.features-section {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 4rem 0;
    margin-top: 2rem;
}

.features-header {
    text-align: center;
    margin-bottom: 3rem;
}

.features-header h2 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.features-header p {
    font-size: 1.2rem;
    color: #666;
    max-width: 600px;
    margin: 0 auto;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
}

.feature-card {
    background: rgba(255, 255, 255, 0.9);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    padding: 2rem;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.15);
}

.feature-card:hover::before {
    opacity: 1;
}

/* Feature Card Variants */
.feature-primary {
    border-left: 4px solid #667eea;
}

.feature-secondary {
    border-left: 4px solid #764ba2;
}

.feature-accent {
    border-left: 4px solid #f093fb;
}

.feature-warning {
    border-left: 4px solid #f6d365;
}

.feature-info {
    border-left: 4px solid #4facfe;
}

.feature-success {
    border-left: 4px solid #43e97b;
}

.feature-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
}

.feature-icon::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, transparent 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.feature-card:hover .feature-icon::before {
    opacity: 1;
}

.feature-icon i {
    color: white;
    font-size: 1.75rem;
    z-index: 1;
    position: relative;
}

.feature-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 1rem;
    line-height: 1.3;
}

.feature-description {
    color: #666;
    line-height: 1.6;
    font-size: 1rem;
    margin-bottom: 1.5rem;
}

.feature-highlights {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: auto;
}

.highlight-tag {
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
    color: #667eea;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid rgba(102, 126, 234, 0.2);
    transition: all 0.3s ease;
}

.feature-card:hover .highlight-tag {
    background: linear-gradient(135deg, #667eea25 0%, #764ba225 100%);
    border-color: rgba(102, 126, 234, 0.4);
}

/* Responsive adjustments for feature cards */
@media (max-width: 768px) {
    .features-section {
        padding: 3rem 0;
    }
    
    .features-header h2 {
        font-size: 2rem;
    }
    
    .features-header p {
        font-size: 1rem;
    }
    
    .feature-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 0 1rem;
    }
    
    .feature-card {
        padding: 1.5rem;
    }
    
    .feature-icon {
        width: 48px;
        height: 48px;
    }
    
    .feature-icon i {
        font-size: 1.5rem;
    }
    
    .feature-title {
        font-size: 1.2rem;
    }
    
    .feature-description {
        font-size: 0.95rem;
    }
}

/* Character and word counters */
.input-counters {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: #666;
}

.counter-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .ste-check-container {
        padding: 1rem;
    }
    
    .hero-section {
        padding: 3rem 1rem;
    }
    
    .hero-section h1 {
        font-size: 2.2rem;
    }
    
    .hero-subtitle {
        font-size: 1.2rem;
        margin-bottom: 1rem;
    }
    
    .hero-description {
        font-size: 1rem;
        margin-bottom: 2rem;
    }
    
    .hero-features {
        gap: 1rem;
        margin-top: 1.5rem;
    }
    
    .feature-badge {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }
    
    .feature-badge i {
        font-size: 1rem;
    }
    
    .check-form {
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .hero-section {
        padding: 2.5rem 1rem;
    }
    
    .hero-section h1 {
        font-size: 1.8rem;
        margin-bottom: 0.8rem;
    }
    
    .hero-subtitle {
        font-size: 1.1rem;
    }
    
    .hero-description {
        font-size: 0.95rem;
        margin-bottom: 1.5rem;
    }
    
    .hero-features {
        flex-direction: column;
        align-items: center;
        gap: 0.8rem;
    }
    
    .feature-badge {
        min-width: 200px;
        justify-content: center;
    }
    .check-form {
        padding: 1.5rem;
    }
    
    .summary-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
    
    .sentence-stats {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
}

@media (max-width: 480px) {
    .hero-section h1 {
        font-size: 1.8rem;
    }
    
    .form-control.textarea {
        min-height: 300px;
    }
    
    .summary-grid {
        grid-template-columns: 1fr;
    }
    
    /* Additional mobile button text enforcement for very small screens */
    .btn-professional span,
    .button-group .btn-professional span,
    .btn-analyze-professional .btn-title {
        display: inline-block !important;
        visibility: visible !important;
        opacity: 1 !important;
        font-size: 0.8rem !important;
        color: inherit !important;
        text-indent: 0 !important;
        overflow: visible !important;
        text-overflow: clip !important;
        width: auto !important;
        height: auto !important;
        line-height: 1.2 !important;
        white-space: nowrap !important;
    }
}

/* Modal Styles - Clean Light Background */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.modal-overlay.show {
    opacity: 1 !important;
    visibility: visible !important;
}

.modal-content {
    background: #ffffff !important;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(255, 255, 255, 0.05);
    transform: scale(0.9);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Specific styling for STE rule violation modals */
#mainIdeaModal,
#complexTensesModal,
#nounClustersModal,
#wordModal {
    background: rgba(255, 255, 255, 0.1) !important;
}

#mainIdeaModal .modal-content,
#complexTensesModal .modal-content,
#nounClustersModal .modal-content,
#wordModal .modal-content {
    background: #ffffff !important;
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.1);
}

.modal-overlay.show .modal-content {
    transform: scale(1);
}

.modal-header {
    padding: 0.75rem 1rem; /* Reduced from 1rem 1.5rem */
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px 12px 0 0;
    flex-shrink: 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.1rem; /* Reduced from 1.25rem */
    font-weight: 600;
}

.modal-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    font-size: 1.25rem; /* Reduced from 1.5rem */
    color: white;
    cursor: pointer;
    width: 28px; /* Reduced from 32px */
    height: 28px; /* Reduced from 32px */
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.modal-body {
    padding: 1rem; /* Reduced from 1.5rem */
    background: #ffffff;
    color: #2c3e50;
    overflow-y: auto;
    flex-grow: 1;
}

.modal-body h4 {
    color: #2c3e50;
    font-weight: 600;
    margin-bottom: 0.75rem; /* Reduced from 1rem */
    font-size: 1rem; /* Reduced from 1.1rem */
}

.modal-body p {
    color: #5a6c7d;
    line-height: 1.5; /* Reduced from 1.6 */
    margin-bottom: 0.75rem; /* Reduced from 1rem */
}

.modal-body .word-info-section {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px; /* Reduced from 8px */
    padding: 0.75rem; /* Reduced from 1rem */
    margin: 0.75rem 0; /* Reduced from 1rem 0 */
}

.modal-footer {
    padding: 0.75rem 1rem; /* Reduced from 1rem 1.5rem */
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    display: flex;
    justify-content: flex-end;
    border-radius: 0 0 12px 12px;
    flex-shrink: 0;
}

.modal-footer .btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

.modal-footer .btn:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 0.75rem 1rem; /* Reduced from 1rem 1.5rem */
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.word-info-section {
    margin-bottom: 0.75rem; /* Reduced from 1rem */
}

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

.word-info-section h4 {
    margin: 0 0 0.5rem 0; /* Reduced from 0.75rem */
    color: #2c3e50;
    font-size: 0.9rem; /* Reduced from 1rem */
    font-weight: 600;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 0.3rem; /* Reduced from 0.4rem */
}

.info-grid {
    display: grid;
    gap: 0.75rem;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.35rem 0; /* Reduced from 0.5rem 0 */
    border-bottom: 1px solid #f8f9fa;
}

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

.info-item label {
    font-weight: 600;
    color: #495057;
    margin-right: 0.75rem; /* Reduced from 1rem */
    font-size: 0.9rem; /* Added smaller font size */
}

.word-value {
    font-family: 'Courier New', monospace;
    background: #f8f9fa;
    padding: 0.2rem 0.4rem; /* Reduced from 0.25rem 0.5rem */
    border-radius: 4px;
    font-weight: bold;
    color: #2c3e50;
    font-size: 0.9rem; /* Added smaller font size */
}

.status-badge {
    padding: 0.2rem 0.6rem; /* Reduced from 0.25rem 0.75rem */
    border-radius: 20px;
    font-size: 0.8rem; /* Reduced from 0.85rem */
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.approved {
    background: #d4edda;
    color: #155724;
}

.status-badge.unapproved {
    background: #f8d7da;
    color: #721c24;
}

.status-badge.unclassified {
    background: #e2e3e5;
    color: #383d41;
}

.status-badge.non-us {
    background: #fff3cd;
    color: #856404;
}

.alternatives-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Override any conflicting alternative word styles */
.modal-body .alternative-word,
#wordModal .alternative-word {
    background: transparent !important;
    color: #2c3e50 !important;
    padding: 0 !important;
    border-radius: 0 !important;
    font-size: 1rem !important;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    border: none !important;
    font-weight: 600 !important;
}

.modal-body .alternative-word:hover,
#wordModal .alternative-word:hover {
    color: #667eea !important;
    transform: none;
    box-shadow: none !important;
    border-color: transparent !important;
    text-decoration: none;
}

.alternative-word:active {
    transform: translateY(0);
}

/* Copy instruction styling */
.copy-instruction {
    color: #6c757d;
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
    font-style: italic;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.copy-instruction i {
    color: #667eea;
}

.us-equivalent {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    padding: 1rem;
    border-radius: 8px;
    font-weight: 600;
    color: #856404;
    transition: all 0.2s ease;
}

.us-equivalent.clickable-copy {
    cursor: pointer;
}

.us-equivalent.clickable-copy:hover {
    background: #ffe69c;
    transform: translateY(-1px);
    border-color: #ffd93d;
}

.context-info {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    color: #495057;
    font-style: italic;
}

/* Professional Replacement Modal Styles */
.replacement-section {
    background: linear-gradient(135deg, #f8f9ff 0%, #ffffff 100%);
    border: 2px solid #e3f2fd;
    border-radius: 12px;
    padding: 0 !important;
    margin-bottom: 1rem;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
}

.replacement-header {
    background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 10px 10px 0 0;
    margin-bottom: 0;
}

.replacement-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.replacement-title i {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.9);
}

.replacement-title h4 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: white;
}

.replacement-subtitle {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.85);
    font-weight: 400;
    margin-top: 0.5rem;
}

.original-word {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.25rem 0.6rem;
    border-radius: 15px;
    font-weight: 600;
    color: #fff3e0;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.replacement-content {
    padding: 1.5rem;
}

.replacement-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.95rem;
    font-weight: 500;
    color: #495057;
}

.replacement-label i {
    font-size: 1rem;
}

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

.replace-option {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    color: #495057;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid #e9ecef;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.replace-option::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(33, 150, 243, 0.1), transparent);
    transition: left 0.5s ease;
}

.replace-option:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(33, 150, 243, 0.15);
    border-color: #2196f3;
    background: linear-gradient(135deg, #e3f2fd 0%, #ffffff 100%);
    color: #1976d2;
}

.replace-option:hover::before {
    left: 100%;
}

.replace-option:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.2);
}

.replacement-footer {
    padding: 1rem 1.5rem;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    border-radius: 0 0 10px 10px;
    display: flex;
    justify-content: flex-end;
}

.btn-cancel {
    padding: 0.6rem 1.5rem;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s ease;
}

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

/* Text color utilities for professional styling */
.text-primary {
    color: #2196f3 !important;
}

.text-warning {
    color: #ff9800 !important;
}

.text-success {
    color: #28a745 !important;
}

.text-primary {
    color: #2196f3 !important;
}

/* No replacement message styling */
.no-replacement-message {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    border-radius: 12px;
    text-align: left;
    border: 2px solid;
}

/* Success message (approved words) */
.no-replacement-message:has(.text-success) {
    background: linear-gradient(135deg, #f8fff9 0%, #e8f5e8 100%);
    border-color: #d4edda;
}

.no-replacement-message:has(.text-success) .message-content h5,
.no-replacement-message:has(.text-success) .message-content p {
    color: #155724;
}

/* Warning message (unclassified words) */
.no-replacement-message:has(.text-warning) {
    background: linear-gradient(135deg, #fff8e1 0%, #ffecb3 100%);
    border-color: #ffc107;
}

.no-replacement-message:has(.text-warning) .message-content h5,
.no-replacement-message:has(.text-warning) .message-content p {
    color: #856404;
}

/* Info message (other cases) */
.no-replacement-message:has(.text-primary) {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border-color: #2196f3;
}

.no-replacement-message:has(.text-primary) .message-content h5,
.no-replacement-message:has(.text-primary) .message-content p {
    color: #0d47a1;
}

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

.message-content h5 {
    margin: 0 0 0.5rem 0;
    color: #155724;
    font-weight: 600;
    font-size: 1.1rem;
}

.message-content p {
    margin: 0 0 0.75rem 0;
    color: #155724;
    font-size: 0.9rem;
    line-height: 1.4;
}

.message-details {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: #6c757d;
    font-style: italic;
}

.message-details i {
    font-size: 0.8rem;
}

/* Enhanced word information section styling */
.word-info-section {
    transition: all 0.3s ease;
}

.word-info-section:not(.replacement-section) {
    border-radius: 8px;
    margin-bottom: 1rem;
}

/* Legacy Replace Options Section - for backwards compatibility */
.replace-instruction {
    color: #495057;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    font-weight: 500;
}

.replace-instruction span {
    font-weight: 600;
    color: #dc3545;
}

.replace-options-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

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

/* Hidden elements utility */
.hidden {
    display: none !important;
}

/* STE Rule Violation Warning Styles */
.context-info[data-rule-violation="true"] {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border: 2px solid #f39c12;
    color: #856404;
    font-weight: 600;
    font-style: normal;
    box-shadow: 0 4px 12px rgba(243, 156, 18, 0.2);
}

.modal-footer {
    padding: 0.75rem 1.5rem;
    border-top: 1px solid #e9ecef;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    background: #f8f9fa;
    border-radius: 0 0 12px 12px;
    flex-shrink: 0;
}

.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

/* Trial Limitation Modal Specific Styles */
#trialLimitationModal .modal-header {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
}

.limit-details {
    font-family: 'Courier New', monospace;
    background: #fff3cd;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-weight: bold;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.upgrade-benefits {
    margin: 1rem 0;
}

.benefit-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    padding: 0.4rem;
    background: #f8f9fa;
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

.benefit-item:hover {
    background: #e9ecef;
}

.benefit-item i {
    font-size: 1.1rem;
}

.text-success {
    color: #28a745 !important;
}

.upgrade-action {
    margin-top: 1rem;
    padding: 0.75rem;
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border-radius: 8px;
    border: 1px solid #90caf9;
}

.upgrade-text {
    margin: 0;
    color: #1565c0;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.upgrade-text i {
    color: #2196f3;
}

.btn-success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
}

.btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

#trialLimitationModal .modal-footer {
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
}

#trialLimitationModal .modal-footer .btn {
    width: 100%;
    justify-content: center;
    padding: 0.5rem;
}

/* Ensure modal fits on smaller screens */
#trialLimitationModal .modal-content {
    max-height: 85vh;
    width: 95%;
}

@media (max-height: 700px) {
    #trialLimitationModal .modal-content {
        max-height: 90vh;
    }
}

@media (max-height: 600px) {
    #trialLimitationModal .modal-content {
        max-height: 95vh;
    }
    
    #trialLimitationModal .modal-header {
        padding: 0.75rem 1.5rem;
    }
    
    #trialLimitationModal .modal-body {
        padding: 0.75rem 1.5rem;
    }
    
    #trialLimitationModal .word-info-section {
        margin-bottom: 0.75rem;
    }
    
    #trialLimitationModal .modal-footer {
        padding: 0.5rem 1.5rem;
    }
}

@media (min-width: 576px) {
    #trialLimitationModal .modal-footer {
        flex-direction: row;
        justify-content: center;
        gap: 1rem;
    }
    
    #trialLimitationModal .modal-footer .btn {
        width: auto;
        flex: 0 0 auto;
        min-width: 160px;
    }
}

/* Toast animations for replacement success */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.replacement-success-toast {
    animation: slideInRight 0.3s ease-out;
}

.replacement-success-toast i {
    margin-right: 8px;
}

/* Additional replace option enhancements */
.replace-category {
    margin-bottom: 1rem;
}

.replace-category h5 {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

/* Enhanced Alternative Word Suggestions - High Contrast & Readable */
.alternative-item {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    padding: 0.75rem 1rem;
    border: 2px solid #e1e8ed;
    border-radius: 10px;
    margin-bottom: 0.75rem;
    background: #ffffff !important;
    transition: all 0.3s ease;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.alternative-item:hover {
    background: #f0f8ff !important;
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.15);
}

.alternative-word {
    font-weight: 600 !important;
    color: #2c3e50 !important;
    cursor: pointer;
    font-size: 1rem !important;
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: all 0.2s ease;
    width: 100%;
}

.alternative-word i {
    color: #667eea !important;
    margin-right: 0.5rem !important;
    opacity: 0.8 !important;
    font-size: 0.9rem !important;
}

.alternative-word:hover {
    color: #667eea !important;
    text-decoration: none;
}

.alternative-word.us-equivalent {
    color: #d63384 !important;
    font-weight: 700 !important;
}

.alternative-word.us-equivalent:hover {
    color: #b02555 !important;
}

.alternative-word.us-equivalent i {
    color: #d63384 !important;
}

/* Alternatives Section Header */
.word-info-section h4 {
    color: #2c3e50 !important;
    font-weight: 700 !important;
    margin-bottom: 1rem;
    font-size: 1.1rem !important;
}

/* Copy instruction styling - make it more visible */
.copy-instruction {
    color: #5a6c7d !important;
    font-size: 0.9rem !important;
    margin-bottom: 0.75rem;
    font-style: italic;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #f8f9fa;
    padding: 0.75rem;
    border-radius: 8px;
    border-left: 3px solid #667eea;
}

.copy-instruction i {
    color: #667eea !important;
    font-size: 1rem !important;
}

/* Improved alternatives list container */
.alternatives-list {
    gap: 0.75rem;
    display: flex;
    flex-direction: column;
}

/* File Name Modal Specific Styles */
#fileNameModal {
    z-index: 9999;
}

#fileNameModal .modal-content {
    max-width: 550px;
    z-index: 10000;
}

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

#fileNameModal .form-group:last-child {
    margin-bottom: 0;
}

.folder-selection-group {
    margin-top: 1.5rem !important;
}

.folder-selection-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.btn-folder-select {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    width: fit-content;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.btn-folder-select:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-folder-select:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.selected-folder {
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: #495057;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.selected-folder.has-folder {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.05);
    color: #495057;
}

.selected-folder i {
    color: #667eea;
    font-size: 1rem;
}

#folderPathText {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: 'Segoe UI', system-ui, sans-serif;
}

#folderHelpText {
    transition: opacity 0.3s ease;
}

.folder-selection-container.has-selection #folderHelpText {
    opacity: 0.7;
}

#fileNameModal .form-group {
    margin-bottom: 0;
}

#fileNameModal .form-control {
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    padding: 0.8rem 1rem;
    font-size: 1rem;
    transition: all 0.3s ease;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    width: 100%;
    box-sizing: border-box;
}

#fileNameModal .form-control:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    background: rgba(255, 255, 255, 1);
    transform: translateY(-1px);
}

#fileNameModal .form-text {
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #6c757d;
}

#fileNameModal .modal-body {
    padding: 1.5rem;
}

#fileNameModal .word-info-section h4 {
    margin-bottom: 1rem;
    color: #2c3e50;
    font-weight: 600;
}

#fileNameModal .form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #495057;
}

/* File Name Modal Animation */
#fileNameModal.show .form-control {
    animation: inputFadeIn 0.4s ease 0.2s both;
}

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

/* STE Rules Legend Styles - Professional & Focused */
.ste-rules-legend {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.03) 100%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    margin: 2rem auto;
    max-width: 1200px;
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    transition: all 0.3s ease;
}

.legend-header {
    position: relative;
}

.legend-toggle {
    width: 100%;
    background: transparent;
    border: none;
    padding: 1.5rem 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
}

.legend-toggle:hover {
    background: rgba(255, 255, 255, 0.04);
}

.legend-toggle #legendIcon {
    font-size: 1.5rem;
    color: #667eea;
    flex-shrink: 0;
}

.legend-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #2c3e50;
    flex-grow: 1;
}

.legend-subtitle {
    font-size: 0.875rem;
    color: #6c757d;
    margin-left: auto;
}

.legend-chevron {
    font-size: 1rem;
    color: #6c757d;
    transition: transform 0.3s ease;
    margin-left: 0.5rem;
    flex-shrink: 0;
}

.legend-toggle:not(.collapsed) .legend-chevron {
    transform: rotate(180deg);
}

.legend-content {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: all 0.4s ease;
}

.legend-content:not(.collapsed) {
    max-height: 3000px;
    opacity: 1;
}

.legend-intro {
    padding: 2rem 2rem 1.5rem 2rem;
    background: rgba(102, 126, 234, 0.04);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.legend-intro p {
    margin: 0;
    color: #2c3e50;
    font-size: 1rem;
    line-height: 1.6;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.legend-intro i {
    color: #667eea;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.rules-sections {
    padding: 2rem;
}

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

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

.rules-section h4 {
    color: #2c3e50;
    font-weight: 700;
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid rgba(102, 126, 234, 0.15);
}

.rules-section h4 i {
    color: #667eea;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.rules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
}

.rule-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.rule-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.rule-card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(102, 126, 234, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.rule-card:hover::before {
    opacity: 1;
}

.rule-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.rule-number {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    text-align: center;
    min-width: 80px;
    flex-shrink: 0;
}

.rule-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
    flex-grow: 1;
}

.rule-description {
    color: #5a6c7d;
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 1rem;
}

.rule-indicator {
    display: flex;
    justify-content: flex-end;
}

.indicator-badge {
    padding: 0.4rem 1rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    cursor: help;
}

.indicator-badge.word-count {
    background: rgba(255, 193, 7, 0.15);
    color: #856404;
    border-color: rgba(255, 193, 7, 0.3);
}

.indicator-badge.main-idea {
    background: rgba(102, 126, 234, 0.15);
    color: #4c63d2;
    border-color: rgba(102, 126, 234, 0.3);
}

.indicator-badge.complex-tenses {
    background: rgba(255, 107, 107, 0.15);
    color: #c92a2a;
    border-color: rgba(255, 107, 107, 0.3);
}

.indicator-badge.passive-voice {
    background: rgba(255, 159, 64, 0.15);
    color: #d63384;
    border-color: rgba(255, 159, 64, 0.3);
}

.indicator-badge.noun-clusters {
    background: rgba(32, 201, 151, 0.15);
    color: #20c997;
    border-color: rgba(32, 201, 151, 0.3);
}

.indicator-badge:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.word-status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
}

.word-status-card {
    background: rgba(255, 255, 255, 0.02);
    border: 2px solid;
    border-radius: 10px;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.3s ease;
}

.word-status-card.approved {
    border-color: rgba(40, 167, 69, 0.3);
    background: rgba(40, 167, 69, 0.05);
}

.word-status-card.unapproved {
    border-color: rgba(220, 53, 69, 0.3);
    background: rgba(220, 53, 69, 0.05);
}

.word-status-card.non-us {
    border-color: rgba(0, 123, 255, 0.3);
    background: rgba(0, 123, 255, 0.05);
}

.word-status-card.unclassified {
    border-color: rgba(255, 193, 7, 0.3);
    background: rgba(255, 193, 7, 0.05);
}

.word-status-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

.status-icon {
    font-size: 1.5rem;
    font-weight: bold;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.word-status-card.approved .status-icon {
    background: rgba(40, 167, 69, 0.15);
    color: #28a745;
}

.word-status-card.unapproved .status-icon {
    background: rgba(220, 53, 69, 0.15);
    color: #dc3545;
}

.word-status-card.non-us .status-icon {
    background: rgba(0, 123, 255, 0.15);
    color: #007bff;
}

.word-status-card.unclassified .status-icon {
    background: rgba(255, 193, 7, 0.15);
    color: #ffc107;
}

.status-content {
    flex-grow: 1;
}

.status-content strong {
    display: block;
    color: #2c3e50;
    font-weight: 600;
    margin-bottom: 0.25rem;
    font-size: 1rem;
}

.status-content p {
    color: #6c757d;
    font-size: 0.875rem;
    line-height: 1.4;
    margin: 0;
}

.legend-footer {
    padding: 1.5rem 2rem 2rem 2rem;
    background: rgba(102, 126, 234, 0.02);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.legend-tip {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(102, 126, 234, 0.15);
    border-radius: 10px;
    font-size: 0.95rem;
    color: #2c3e50;
    line-height: 1.5;
}

.legend-tip i {
    color: #ffc107;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.legend-tip strong {
    color: #667eea;
    font-weight: 600;
}

/* Mobile Responsive Adjustments */
@media (max-width: 768px) {
    .ste-rules-legend {
        margin: 1rem;
        border-radius: 12px;
    }
    
    .legend-toggle {
        padding: 1rem 1.5rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .legend-title {
        font-size: 1.1rem;
    }
    
    .legend-subtitle {
        margin-left: 0;
        align-self: flex-start;
    }
    
    .legend-chevron {
        position: absolute;
        top: 1rem;
        right: 1.5rem;
        margin-left: 0;
    }
    
    .rules-sections {
        padding: 1.5rem;
    }
    
    .rules-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
    
    .word-status-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .legend-intro,
    .legend-footer {
        padding: 1.5rem;
    }
    
    .rule-card {
        padding: 1.25rem;
    }
    
    .rule-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .rule-indicator {
        justify-content: flex-start;
        margin-top: 0.75rem;
    }
}

@media (max-width: 480px) {
    .ste-rules-legend {
        margin: 0.5rem;
    }
    
    .legend-toggle {
        padding: 0.75rem 1rem;
    }
    
    .rules-sections {
        padding: 1rem;
    }
    
    .rule-card {
        padding: 1rem;
    }
    
    .word-status-card {
        padding: 1rem;
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
    }
    
    .status-content {
        text-align: center;
    }
}

/* CRITICAL: Mobile Button Text Visibility Override */
/* HIDE button text on mobile devices - show icons only */
@media screen and (max-width: 768px) {
    /* Hide all button text spans on mobile */
    .btn-professional span,
    .button-group .btn-professional span,
    .file-operations-toolbar .btn-professional span,
    .primary-section .btn-professional span,
    .secondary-section .btn-professional span {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        font-size: 0 !important;
        width: 0 !important;
        height: 0 !important;
        overflow: hidden !important;
        text-indent: -9999px !important;
    }
    
    /* ALSO hide the main analyze button text - icon only */
    .btn-analyze-professional .btn-title,
    .btn-analyze-professional .btn-text {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        font-size: 0 !important;
        width: 0 !important;
        height: 0 !important;
        overflow: hidden !important;
        text-indent: -9999px !important;
    }
    
    /* Ensure analyze button icon container stays visible */
    .btn-analyze-professional .btn-content,
    .btn-analyze-professional .btn-icon {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        visibility: visible !important;
        opacity: 1 !important;
        width: auto !important;
        height: auto !important;
        overflow: visible !important;
    }
    
    /* Ensure buttons are icon-only with proper sizing */
    .btn-professional {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        min-width: 44px !important;
        min-height: 44px !important;
        width: 44px !important;
        height: 44px !important;
        padding: 0.7rem !important;
        text-align: center !important;
    }
    
    /* Make analyze button SAME SIZE as other buttons */
    .btn-analyze-professional {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        min-width: 44px !important;
        min-height: 44px !important;
        width: 44px !important;
        height: 44px !important;
        padding: 0.7rem !important;
        border-radius: 8px !important;
    }
    
    /* Make sure icons are properly sized and centered */
    .btn-professional i {
        flex-shrink: 0 !important;
        width: auto !important;
        font-size: 1.1rem !important;
        text-align: center !important;
        margin: 0 !important;
    }
    
    /* Same icon size for analyze button */
    .btn-analyze-professional i,
    .btn-analyze-professional .btn-icon i {
        font-size: 1.1rem !important;
        margin: 0 !important;
        width: auto !important;
        display: inline-block !important;
        visibility: visible !important;
        opacity: 1 !important;
        color: white !important;
    }
}

/* Additional enforcement for very small mobile devices */
@media screen and (max-width: 480px) {
    /* Hide button text spans on very small screens */
    .btn-professional span {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        font-size: 0 !important;
        width: 0 !important;
        height: 0 !important;
        overflow: hidden !important;
        text-indent: -9999px !important;
    }
    
    /* ALSO hide analyze button text on small screens */
    .btn-analyze-professional .btn-title,
    .btn-analyze-professional .btn-text {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        font-size: 0 !important;
        width: 0 !important;
        height: 0 !important;
        overflow: hidden !important;
        text-indent: -9999px !important;
    }
    
    /* Ensure analyze button icon container stays visible on small screens */
    .btn-analyze-professional .btn-content,
    .btn-analyze-professional .btn-icon {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        visibility: visible !important;
        opacity: 1 !important;
        width: auto !important;
        height: auto !important;
        overflow: visible !important;
    }
    
    /* Ensure buttons are compact and icon-centered */
    .btn-professional {
        min-height: 44px !important;
        min-width: 44px !important;
        width: 44px !important;
        height: 44px !important;
        padding: 0.6rem !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
    }
    
    /* Analyze button SAME SIZE on small screens */
    .btn-analyze-professional {
        min-height: 44px !important;
        min-width: 44px !important;
        width: 44px !important;
        height: 44px !important;
        padding: 0.6rem !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: 8px !important;
    }
    
    /* Same icon sizes on small screens for all buttons */
    .btn-professional i {
        font-size: 1.2rem !important;
        margin: 0 !important;
        width: auto !important;
    }
    
    /* Same icon size for analyze button on small screens */
    .btn-analyze-professional i,
    .btn-analyze-professional .btn-icon i {
        font-size: 1.2rem !important;
        margin: 0 !important;
        width: auto !important;
        display: inline-block !important;
        visibility: visible !important;
        opacity: 1 !important;
        color: white !important;
    }
}