/* Jaynes Baby Bank - Complete Enhanced Search System Styles with Proper Snippet Display */
/* Poppins loaded via index.php link tag — do not @import here (avoids duplicate font fetch). */

:root {
    /* Modern Light Theme - Enhanced Colors */
    --bg-primary: #f0f4f8;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f9fafb;
    --text-primary: #1a202c;
    --text-secondary: #4a5568;
    --text-muted: #718096;
    --border-color: #e2e8f0;
    --border-hover: #3182ce;
    --accent-primary: #2c6dd5;
    --accent-secondary: #ff4b5a;
    --accent-gradient: linear-gradient(135deg, #2c6dd5 0%, #ff4b5a 100%);
    --video-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --post-gradient: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    --success-bg: #f0fff4;
    --success-text: #16a34a;
    --success-border: #22c55e;
    --facebook-green: #16a34a;
    --facebook-green-hover: #15803d;
    --facebook-green-light: #dcfce7;
    --facebook-blue: #3b82f6;
    --facebook-blue-hover: #2563eb;
    --facebook-blue-light: #dbeafe;
    --info-bg: #eff6ff;
    --info-text: #3b82f6;
    --info-border: #bfdbfe;
    --warning-bg: #fef3c7;
    --warning-text: #b45309;
    --warning-border: #f59e0b;
    --context-bg: #f8fafc;
    --match-bg: #fef3c7;
    --match-border: #f59e0b;
    --shadow: rgba(0, 0, 0, 0.1);
    --shadow-hover: rgba(0, 0, 0, 0.15);
    --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.05);
    --shadow-card-hover: 0 8px 30px rgba(0, 0, 0, 0.1);
    --overlay: rgba(0, 0, 0, 0.6);
}

* {
    box-sizing: border-box;
}

body,
html {
    height: 100%;
    font-family: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI",
        Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 16px;
    line-height: 1.6;
    font-weight: 400;
    margin: 0;
    padding: 0;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* FIXED: Main S010 Container with proper gradient background */
.s010 {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 10px;
    background: linear-gradient(135deg, #2c6dd5 0%, #ff4b5a 100%);
}

.s010 h1 {
    color: #ffffff;
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 30px;
    text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.25);
}

/* FIXED: Form styling with white background */
.s010 form {
    width: 100%;
    max-width: 1000px;
    background: transparent;
    border-radius: 20px;
    overflow: hidden;
}

.s010 .inner-form {
    background: var(--bg-secondary);
    border-radius: 20px;
    box-shadow: var(--shadow-card-hover);
    padding: 40px;
    border: 1px solid var(--border-color);
    width: 100%;
}

/* FIXED: Input field styling */
.s010 .input-field {
    position: relative;
    margin-bottom: 30px;
}

.s010 .input-field input[type="text"] {
    width: 100%;
    padding: 20px 96px 20px 20px;
    font-size: 18px;
    border: none;
    border-radius: 10px;
    background: #f1f1f1;
    color: #333;
    font-family: inherit;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 0 0 3px transparent, inset 0 2px 4px rgba(0, 0, 0, 0.06);
    transform: translateY(-1px);
}

.s010 .input-field input[type="text"]:focus {
    outline: none;
    background: #f1f1f1;
    box-shadow: 0 0 0 3px rgba(44, 109, 213, 0.3),
        inset 0 2px 4px rgba(0, 0, 0, 0.06);
    transform: translateY(-1px);
}

.s010 .input-field .search-clear-btn {
    position: absolute;
    right: 52px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #888;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease, background 0.2s ease;
}

.s010 .input-field .search-clear-btn:hover {
    color: var(--accent-primary, #2c6dd5);
    background: rgba(44, 109, 213, 0.08);
}

.s010 .input-field .search-clear-btn:focus-visible {
    outline: 2px solid var(--accent-primary, #2c6dd5);
    outline-offset: 2px;
}

.s010 .input-field svg {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    fill: #888;
    transition: fill 0.3s ease;
    pointer-events: none;
}

.s010 .input-field:focus-within svg {
    fill: var(--accent-primary);
}

.search-summary .date-filter-hint {
    margin-top: 12px;
    padding: 12px 14px;
    font-size: 0.95rem;
    color: var(--text-muted, #64748b);
    background: rgba(44, 109, 213, 0.06);
    border-radius: 10px;
    border: 1px solid var(--border-color, #e2e8f0);
}

.jbb-clear-date-filter {
    margin-top: 10px;
    padding: 8px 14px;
    font-size: 0.9rem;
    cursor: pointer;
    border-radius: 8px;
    border: 1px solid var(--accent-primary, #2c6dd5);
    background: var(--bg-secondary, #fff);
    color: var(--accent-primary, #2c6dd5);
    font-weight: 600;
}

.jbb-clear-date-filter:hover {
    background: rgba(44, 109, 213, 0.08);
}

/* NEW: Always visible search controls */
.search-controls {
    background: transparent;
    border-top: 2px solid #e2e8f0;
    margin-top: 20px;
    padding-top: 20px;
}

.desc {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-align: center;
}

.controls-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 15px;
    align-items: end;
    margin-bottom: 20px;
}

.controls-grid .search-button-container {
    grid-column: 1 / -1;
}

.input-select {
    display: flex;
    flex-direction: column;
}

.input-select select {
    width: 100%;
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 500;
    font-family: inherit;
    appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg fill="%23718096" xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path d="M7 10l5 5 5-5z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.input-select select:focus {
    outline: none;
    background-color: var(--bg-secondary);
    box-shadow: 0 0 0 3px rgba(44, 109, 213, 0.3);
}

.search-button-container {
    display: flex;
    align-items: end;
    width: 100%;
}

.btn-search-main {
    background: var(--accent-gradient);
    color: white;
    padding: 14px 24px;
    border: none;
    font-size: 16px;
    font-weight: 700;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(44, 109, 213, 0.3);
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    justify-content: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-search-main:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(44, 109, 213, 0.4);
}

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

.btn-search-main svg {
    width: 20px;
    height: 20px;
}

/* NEW: Secondary actions */
.secondary-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.btn-reset {
    background: transparent;
    color: var(--text-muted);
    padding: 10px 20px;
    border: 2px solid var(--border-color);
    font-size: 14px;
    font-weight: 600;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.btn-reset:hover {
    color: var(--text-primary);
    border-color: var(--text-primary);
    background: var(--bg-tertiary);
}

/* Results container styling */
.s010 .results-container {
    border-radius: 20px;
    margin-top: 20px;
    max-width: 1000px;
    width: 100%;
}

/* ENHANCED: Card-Based Result Items */
.results-container .result-item {
    background: var(--bg-secondary);
    border-radius: 16px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-card);
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(0);
    position: relative;
    opacity: 1;
    will-change: transform, box-shadow, border-color;
}

.results-container .result-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
}

/* ENHANCED: File Headers with Card Design */
.file-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    color: var(--text-primary);
    transition: all 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.file-header::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    transition: left 0.6s ease;
}

.result-item:hover .file-header::before {
    left: 100%;
}

/* ENHANCED: Card-specific headers from improved UI */
.file-header.facebook-video {
    background: var(--video-gradient);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.file-header.facebook-post {
    background: var(--post-gradient);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Uses the same specificity as the card wrapper to win cleanly over any base .file-header rule */
.result-item.tiktok-video .file-header {
    background: linear-gradient(135deg, #de8c9d 0%, #397684 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.file-type-label {
    font-weight: 700;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ENHANCED: Card header badges */
.file-type-badge {
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.28);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.file-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ENHANCED: Card action buttons */
.action-link {
    padding: 8px 16px;
    border-radius: 20px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border: 2px solid var(--accent-primary);
    color: var(--accent-primary);
    background: transparent;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    position: relative;
    overflow: hidden;
}

/* ENHANCED: Card header action buttons - FIXED for desktop click issue */
.header-action-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto; /* Fix for desktop clicking */
    z-index: 1; /* Ensure button is clickable */
}

.header-action-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.action-link::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--accent-primary);
    transition: left 0.3s ease;
    z-index: -1;
}

.action-link:hover::before {
    left: 0;
}

.action-link:hover {
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(44, 109, 213, 0.3);
}

/* Facebook Post specific styling */
.result-file.facebook-post .action-link,
.result-item.facebook-post .action-link {
    border-color: var(--facebook-green) !important;
    color: var(--facebook-green) !important;
}

.result-file.facebook-post .action-link:hover,
.result-item.facebook-post .action-link:hover {
    background: var(--facebook-green) !important;
    color: white !important;
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3) !important;
}

/* ENHANCED: Multiple Snippet Display - Core Structure */
.snippet-text {
    margin-bottom: 12px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    position: relative;
    transition: all 0.3s ease;
}

.snippet-text:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.snippet-text p {
    margin: 0 !important;
    line-height: 1.6 !important;
    font-size: 15px !important;
    color: var(--text-primary) !important;
    padding: 0 !important;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Server “Context” option: multiple lines (hit ± neighbours) — same weight/colour as before (single-line snippets) */
.snippet-text--context .snippet-ctx-line {
    margin: 0 0 0.45em 0;
    line-height: 1.6;
    font-size: 15px;
    color: var(--text-primary) !important;
    font-weight: 400;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.snippet-text--context .snippet-ctx-line:last-child {
    margin-bottom: 0;
}

.snippet-text--context .snippet-ctx-line p {
    color: var(--text-primary) !important;
    font-weight: 400 !important;
}

/* ENHANCED: Video Matches Styling */
.video-matches {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.video-matches .snippet-text {
    background: rgba(102, 126, 234, 0.05);
    padding: 12px 15px;
    border-radius: 8px;
    border: 1px solid rgba(102, 126, 234, 0.15);
    margin-bottom: 8px;
    transition: all 0.3s ease;
    border-bottom: 1px solid rgba(102, 126, 234, 0.15);
}

.video-matches .snippet-text:hover {
    background: rgba(102, 126, 234, 0.08);
    transform: translateX(3px);
}

/* ENHANCED: Post Matches Styling */
.post-matches {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.post-matches .snippet-text {
    background: rgba(40, 167, 69, 0.05);
    padding: 12px 15px;
    border-radius: 8px;
    border: 1px solid rgba(40, 167, 69, 0.15);
    margin-bottom: 8px;
    transition: all 0.3s ease;
    border-bottom: 1px solid rgba(40, 167, 69, 0.15);
}

.post-matches .snippet-text:hover {
    background: rgba(40, 167, 69, 0.08);
    transform: translateX(3px);
}

/* ENHANCED: Perfect Highlighting for Keywords in Snippets */
.snippet-text mark {
    background-color: var(--warning-bg) !important;
    color: var(--warning-text) !important;
    padding: 2px 4px !important;
    border-radius: 3px !important;
    font-weight: 600 !important;
    box-shadow: 0 1px 3px rgba(245, 158, 11, 0.3) !important;
    display: inline !important;
    line-height: 1.2 !important;
    border: 1px solid rgba(245, 158, 11, 0.3) !important;
    font-family: inherit !important;
    word-break: normal !important;
    white-space: nowrap !important;
}

.snippet-text mark:hover {
    background-color: #fbbf24 !important;
    color: #92400e !important;
    transform: scale(1.05);
    transition: all 0.2s ease;
}

/* Match count styling */
.match-count {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    display: inline-block;
}

/* More matches indicator */
.more-matches-indicator {
    text-align: center;
    padding: 8px 12px;
    background: rgba(108, 117, 125, 0.1);
    border-radius: 6px;
    margin-top: 8px;
    border: 1px dashed var(--border-color);
}

.more-matches-indicator small {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.8rem;
}

/* Improved match preview container */
.match-preview {
    padding: 20px;
    transition: all 0.3s ease;
}

/* Animation for snippet appearance */
@keyframes snippetFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.snippet-text {
    animation: snippetFadeIn 0.4s ease-out;
}

/* ENHANCED: Match Content with Card Design */
.match {
    padding: 20px;
    transition: all 0.3s ease;
    font-size: 15px;
    line-height: 1.6;
    position: relative;
}

/* NEW: Card-based match preview */
.match-preview {
    padding: 20px;
}


.match-snippet {
    background: #f8f9ff;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
}

/* Facebook Post Content Style */
.post-content {
    background: #f0fff4;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    line-height: 1.6;
}

.post-content p {
    margin: 0;
    text-align: justify;
}

.snippet-text {
    font-size: 15px;
    line-height: 1.5;
}

/* Enhanced Highlighting */
mark {
    background: var(--warning-bg);
    color: var(--warning-text);
    padding: 1px 2px;
    border-radius: 3px;
    font-weight: 600;
    transition: transform 0.3s ease;
    border: 1px solid var(--warning-border);
    font-family: inherit;
    display: inline;
    line-height: 1.2;
    word-break: break-word;
}

mark:hover {
    transform: scale(1.02);
}

/* Loading and No Results */
.loading,
.no-results {
    text-align: center;
    padding: 50px 30px;
    color: var(--text-muted);
    background: var(--bg-secondary);
    border-radius: 16px;
    box-shadow: var(--shadow-card);
    border: 2px solid var(--border-color);
}

.loading {
    position: relative;
    overflow: hidden;
}

.loading::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        var(--accent-primary) 20,
        transparent
    );
    animation: shimmer 2s infinite;
}

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

.loading-spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-color);
    border-radius: 50%;
    border-top-color: var(--accent-primary);
    animation: spin 1s ease-in-out infinite;
    margin-right: 12px;
}

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

.loading-text {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1.1rem;
}

.loading-details {
    font-size: 0.95rem;
    font-weight: 400;
    color: var(--text-secondary);
    margin-top: 10px;
}

.no-results h3 {
    margin: 0 0 15px 0;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1.2rem;
}

/* Search Tips */
.search-tips {
    background: var(--bg-tertiary);
    padding: 20px;
    border-radius: 12px;
    margin-top: 20px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.search-tips:hover {
    transform: translateX(2px);
    box-shadow: 0 4px 12px var(--shadow);
}

.search-tips h4 {
    margin: 0 0 15px 0;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
}

.search-tips ul {
    margin: 0;
    padding-left: 20px;
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--text-secondary);
}

.search-tips li {
    margin-bottom: 8px;
}

.search-tips code {
    background: var(--border-color);
    color: var(--text-primary);
    padding: 3px 6px;
    border-radius: 4px;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.85rem;
}

/* Context Section Styling */
.context-section {
    margin-top: 15px;
    padding: 10px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    border: 2px solid var(--border-color);
}
.context-section h4 {
    margin: 0 0 12px 0;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 600;
}

.context-lines {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.context-line {
    margin: 0;
    padding: 8px;
    border-radius: 4px;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.5;
    word-break: break-word;
    overflow-wrap: break-word;
    transition: transform 0.3s ease, border-color 0.3s ease;
    border: 1px solid transparent;
}

.context-line:hover {
    transform: translateX(4px);
}

.context-line.match-line {
    background: var(--match-bg);
    color: var(--text-primary);
    font-weight: 500;
}

.context-line.context {
    background: var(--context-bg);
    color: var(--text-muted);
}

/* Mobile transcript modal specific styles */
.transcript-content {
    width: 98%;
    height: 95%;
    border-radius: 8px;
}

.transcript-header {
    padding: 16px 20px;
}

.transcript-header h3 {
    font-size: 16px !important;
    margin: 0 !important;
    font-weight: 600 !important;
    line-height: 1.2 !important;
}

.transcript-header .transcript-date {
    font-size: 10px !important;
    opacity: 0.8 !important;
    margin-top: 3px !important;
    font-weight: 300 !important;
    line-height: 1.1 !important;
    color: rgba(255, 255, 255, 0.9) !important;
    display: block !important;
}

.transcript-copy-btn {
    width: 28px;
    height: 28px;
    font-size: 12px;
}

.transcript-body {
    padding: 15px;
    line-height: 1.6;
}

.transcript-body p {
    font-size: 14px !important;
    line-height: 1.6 !important;
    margin: 0 0 0.8em 0 !important;
}

.transcript-body mark {
    display: inline;
    vertical-align: baseline;
    padding: 0 2px !important;
    line-height: inherit;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

/* Mobile Transcript Modal - Enhanced from improved_search_ui.html demo */
.transcript-modal {
    display: none !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.38) !important;
    z-index: 1000 !important;
    backdrop-filter: none !important;
}

.transcript-modal.active {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.transcript-modal.fullscreen-mode {
    padding: 0 !important;
}

.transcript-modal.fullscreen-mode .transcript-content {
    width: 100% !important;
    height: 100% !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

.transcript-modal.fullscreen-mode .transcript-header {
    padding-top: max(16px, env(safe-area-inset-top)) !important;
}

.transcript-modal.fullscreen-mode .transcript-body {
    padding-bottom: max(20px, env(safe-area-inset-bottom)) !important;
}

.transcript-content {
    background: white;
    width: 90%;
    height: 90%;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
}

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

.transcript-header.post-mode {
    background: var(--post-gradient);
}

.transcript-header.video-mode {
    background: var(--video-gradient);
}

.transcript-header.tiktok-mode {
    background: linear-gradient(135deg, #de8c9d 0%, #397684 100%);
}

.transcript-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.transcript-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    flex-wrap: nowrap;
}

.transcript-date {
    font-size: 11px !important;
    opacity: 0.8;
    margin-top: 4px;
    font-weight: normal !important;
    line-height: 1.2;
    color: white !important;
    display: flex !important;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.transcript-date .transcript-date-value {
    display: inline-block;
    white-space: nowrap;
}

@media (max-width: 640px) {
    .transcript-date {
        gap: 4px;
        line-height: 1.25;
    }
}

@media (max-width: 520px) {
    .transcript-header {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 8px;
        align-items: start;
    }

    .transcript-header-main {
        min-width: 0;
        text-align: center;
    }

    .transcript-header h3 {
        font-size: 15px;
    }

    .transcript-date {
        font-size: 10px !important;
    }

    .transcript-header-actions {
        grid-column: 1;
        gap: 6px;
        justify-content: center;
        width: 100%;
        overflow-x: auto;
        padding-bottom: 2px;
        scrollbar-width: thin;
    }

    .transcript-copy-btn {
        width: 36px;
        height: 36px;
        min-width: 36px;
        padding: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 8px;
    }

    .transcript-modal.fullscreen-mode .transcript-content {
        width: 100% !important;
        height: 100% !important;
    }

    .transcript-match-nav {
        right: 8px;
        bottom: 12px;
    }

    .transcript-match-nav__btn {
        width: 28px;
        height: 28px;
        font-size: 13px;
    }

}

.transcript-copy-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 0;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    touch-action: manipulation;
}

.transcript-copy-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.transcript-copy-btn:disabled,
.transcript-copy-btn[disabled] {
    opacity: 0.35;
    cursor: not-allowed;
}

.transcript-copy-btn:disabled:hover,
.transcript-copy-btn[disabled]:hover {
    background: rgba(255, 255, 255, 0.2);
}

.transcript-nav-btn {
    font-size: 13px;
    font-weight: 700;
}

.transcript-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    line-height: 1.8;
    -webkit-overflow-scrolling: touch;
}

.transcript-body p {
    margin: 0 0 1em 0;
    line-height: 1.8;
    color: #333;
    font-size: 15px;
}

.transcript-body p:last-child {
    margin-bottom: 0;
}

.transcript-match-nav {
    position: absolute;
    right: 10px;
    bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 6;
}

.transcript-match-nav__btn {
    width: 30px;
    height: 30px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.55);
    background: rgba(241, 245, 249, 0.88);
    color: #64748b;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.transcript-match-nav__btn:hover {
    background: rgba(226, 232, 240, 0.95);
    color: #334155;
    border-color: rgba(100, 116, 139, 0.65);
}

.transcript-match-nav__btn:disabled,
.transcript-match-nav__btn[disabled] {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Floating “search selection” card on transcript modal (light — no dark bar) */
.transcript-selection-bar {
    position: fixed;
    z-index: 10050;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px 14px;
    background: #fff;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(15, 23, 42, 0.12);
    max-width: min(92vw, 380px);
}

.transcript-selection-bar[hidden] {
    display: none !important;
}

.transcript-selection-bar__quoted {
    font-size: 14px;
    line-height: 1.5;
    font-weight: 500;
    color: #334155;
    word-break: break-word;
    max-height: 5.5em;
    overflow: hidden;
}

.transcript-selection-bar__btn {
    flex: 0 0 auto;
    margin: 0;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
}

.transcript-selection-bar__btn:hover {
    filter: brightness(1.06);
}

.transcript-selection-bar__btn:focus-visible {
    outline: 2px solid #a5b4fc;
    outline-offset: 2px;
}

/* Enhanced Modal with Card Design */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: var(--overlay);
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(2px);
}

.modal.active {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    opacity: 1 !important;
}

.modal.show {
    opacity: 1;
}

.modal.active .modal-content {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.modal-content {
    background-color: var(--bg-secondary);
    margin: 0 auto;
    padding: 0;
    border-radius: 16px;
    width: 90%;
    max-width: 1000px;
    height: 80%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 2px solid var(--border-color);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
    box-shadow: var(--shadow-card-hover);
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--border-color);
    padding: 20px 25px;
    background: var(--bg-tertiary);
    flex-shrink: 0;
}

.modal-buttons {
    display: flex;
    gap: 20px;
    align-items: center;
}

.close,
.share {
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
    padding: 8px;
    margin: -8px;
    border-radius: 50%;
    transition: all 0.3s ease;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 2px solid var(--border-color);
}

.close:hover,
.close:focus,
.share:hover,
.share:focus {
    color: var(--text-primary);
    background: var(--border-color);
    border-color: var(--text-primary);
}

.close:hover,
.close:focus {
    transform: rotate(90deg);
}

.share:hover,
.share:focus {
    transform: rotate(-15deg);
}

/* Hide share button on desktop */
@media (min-width: 769px) {
    .share {
        display: none;
    }
}

.modal-header h2 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.2rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    padding-right: 15px;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    -webkit-overflow-scrolling: touch;
    background: var(--bg-secondary);
    min-height: 0;
}

.file-content {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    padding: 20px;
    border-radius: 8px;
    border: 2px solid var(--border-color);
    margin: 0;
}

.file-info {
    margin-bottom: 10px;
    padding: 15px;
    background: var(--border-color);
    color: var(--text-primary);
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
}

.source-link {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.source-link:hover {
    color: var(--accent-secondary);
    text-decoration: underline;
}

/* Sherlock Easter Egg */
.sherlock-image {
    position: fixed;
    bottom: -300px;
    right: 20px;
    width: 200px;
    height: 200px;
    transition: all 5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    display: block;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    filter: drop-shadow(0 8px 16px var(--shadow));
}

.sherlock-image.animate-up {
    bottom: 0;
    transform: translateY(0) rotate(0deg);
    opacity: 1;
    visibility: visible;
    animation: sherlock-bounce 1s ease-out;
}

.sherlock-image.animate-down {
    bottom: -300px;
    transform: translateY(0) rotate(5deg);
    opacity: 0;
    visibility: hidden;
}

@keyframes sherlock-bounce {
    0% {
        transform: translateY(50px) scale(0.8);
    }
    50% {
        transform: translateY(-10px) scale(1.1);
    }
    100% {
        transform: translateY(0) scale(1);
    }
}

/* Search Summary Styling */
.search-summary {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-color);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.search-summary::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(44, 109, 213, 0.1),
        transparent
    );
    animation: shimmer 3s ease-in-out;
}

.search-summary p {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.4;
}

.search-summary strong {
    color: var(--accent-primary);
    font-weight: 700;
}

.search-summary.no-matches {
    background: var(--warning-bg);
    border-color: var(--warning-border);
    color: var(--warning-text);
}

.search-summary.no-matches p {
    color: var(--warning-text);
}

.search-summary.no-matches strong {
    color: var(--warning-text);
    font-weight: 700;
}

.match hr {
    border-top: 1px solid var(--border-color);
    opacity: 0.5;
}

/* Footer Styling */
.site-footer {
    background: var(--bg-secondary);
    border-top: 2px solid var(--border-color);
    padding: 30px 20px;
    margin-top: 0;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
    width: 100%;
    position: relative;
    z-index: 10;
}

.footer-content {
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.footer-stats {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1rem;
}

.footer-stats strong {
    color: var(--accent-primary);
    font-weight: 700;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.footer-link {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.footer-link:hover {
    color: var(--accent-secondary);
    text-decoration: underline;
}

/* MOBILE RESPONSIVE STYLES */
@media (max-width: 768px) {
    .s010 {
        padding: 15px 10px;
    }

    .s010 h1 {
        font-size: 1.5rem;
        margin-bottom: 20px;
    }

    .s010 .inner-form {
        padding: 25px 20px;
        border-radius: 16px;
    }

    .s010 .input-field input[type="text"] {
        padding: 18px 96px 18px 18px;
        font-size: 16px;
    }

    /* Mobile controls grid - stack vertically */
    .controls-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .search-button-container {
        order: 4;
    }

    .btn-search-main {
        width: 100%;
        padding: 16px 20px;
        font-size: 18px;
        font-weight: 700;
        min-width: auto;
    }

    .secondary-actions {
        margin-top: 15px;
    }

    /* MOBILE: File header layout - badge left, button right */
    .file-header {
        flex-direction: row !important;
        align-items: center !important;
        text-align: left !important;
        justify-content: space-between !important;
        gap: 10px !important;
        padding: 15px 18px !important;
    }

    .file-type-label {
        display: block;
        font-weight: 700;
        margin-bottom: 0 !important;
    }

    .file-actions {
        justify-content: flex-end !important;
        gap: 8px;
        white-space: nowrap;
        flex-shrink: 0;
    }

    /* MOBILE: Header action buttons styling */
    .header-action-btn {
        padding: 8px 16px !important;
        font-size: 0.85rem !important;
        white-space: nowrap !important;
        min-width: auto !important;
        flex-shrink: 0;
    }

    .result-file.facebook-post .action-link,
    .result-item.facebook-post .action-link {
        background: var(--facebook-green) !important;
        border-color: var(--facebook-green) !important;
        color: white !important;
    }

    .result-file.facebook-post .action-link:hover,
    .result-item.facebook-post .action-link:hover {
        background: var(--facebook-green-hover) !important;
        border-color: var(--facebook-green-hover) !important;
        color: white !important;
    }

    .match {
        padding: 15px;
    }

    .match-preview {
        padding: 15px;
    }

    .match-snippet,
    .post-content {
        padding: 12px;
        font-size: 14px;
        margin-bottom: 10px;
    }

    .context-line {
        font-size: 13px;
        padding: 6px;
        line-height: 1.4;
        word-break: break-word;
        overflow-wrap: break-word;
    }

    /* MOBILE: Enhanced snippet styling */
    .snippet-text {
        margin-bottom: 8px;
        padding: 6px 0;
    }

    .snippet-text p {
        font-size: 14px !important;
        line-height: 1.5 !important;
    }

    .video-matches .snippet-text,
    .post-matches .snippet-text {
        padding: 10px 12px;
        margin-bottom: 6px;
    }

    .match-count {
        font-size: 0.75rem;
        padding: 3px 6px;
        margin-bottom: 8px;
    }

    .snippet-text mark {
        padding: 1px 3px !important;
        font-size: inherit !important;
    }

    .modal {
        padding: 10px;
    }

    .modal-content {
        width: 100%;
        height: 90%;
        margin: 5% auto 0;
        border-radius: 12px;
    }

    .modal-header {
        padding: 15px 20px;
    }

    .modal-header h2 {
        font-size: 1.1rem;
    }

    .close {
        font-size: 24px;
        width: 36px;
        height: 36px;
    }

    .modal-body {
        padding: 20px;
    }

    .file-content {
        font-size: 13px;
        padding: 15px;
    }

    .sherlock-image {
        width: 150px;
        height: 150px;
        right: 10px;
    }

    .result-item {
        margin-bottom: 16px;
        border-radius: 12px;
    }

    .result-item:hover {
        transform: translateY(-3px) scale(1.01);
    }

    .search-tips {
        padding: 15px;
        margin-top: 15px;
    }

    .search-tips li {
        margin-bottom: 10px;
    }
}

/* Mobile highlighting fixes */
@media (max-width: 768px) {
    mark {
        padding: 1px 1px;
        border-radius: 2px;
        font-weight: 500;
        border: none;
        line-height: 1.1;
        font-size: inherit;
    }

    .context-line mark {
        padding: 0px 1px;
        background: var(--warning-bg);
        border-radius: 2px;
    }

    .match mark {
        display: inline;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
}

@media (max-width: 480px) {
    .s010 {
        padding: 10px 8px;
    }

    .s010 .inner-form {
        padding: 20px 15px;
        border-radius: 12px;
    }

    .s010 h1 {
        font-size: 1.3rem;
    }

    .file-actions {
        flex-direction: row !important;
        gap: 6px !important;
        justify-content: center !important;
        flex-wrap: nowrap !important;
    }

    .action-link,
    .header-action-btn {
        padding: 8px 12px;
        font-size: 0.8rem;
        white-space: nowrap !important;
        min-width: auto !important;
    }

    .close {
        font-size: 20px;
        width: 32px;
        height: 32px;
    }

    .s010 .results-container {
        border-radius: 12px;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .controls-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 8px;
    }
    /* Tighter select padding so 6 columns fit comfortably at ~800–1024px */
    .controls-grid .input-select select {
        padding: 10px 28px 10px 10px;
        font-size: 14px;
    }

    .modal-content {
        width: 95%;
        height: 85%;
        margin: 2.5% auto;
    }
}

@media (min-width: 1025px) {
    .s010 {
        padding: 40px 20px;
    }

    .s010 h1 {
        font-size: 2.2rem;
    }

    .s010 .inner-form {
        padding: 50px;
    }

    .modal {
        padding: 2%;
    }

    .modal-content {
        width: 90%;
        max-width: 1000px;
        height: 80%;
        margin: 5% auto;
    }

    .result-item:hover .action-link {
        transform: translateY(-1px);
    }

    .btn-search-main:hover {
        box-shadow: 0 8px 25px rgba(44, 109, 213, 0.4);
    }
}

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

    .sherlock-image {
        transition: opacity 0.3s ease;
    }

    .result-item,
    .action-link,
    .file-header,
    .match {
        transition: opacity 0.2s ease;
    }

    .result-item:hover {
        transform: none;
    }

    .action-link:hover {
        transform: none;
    }

    .file-header::before,
    .action-link::before {
        display: none;
    }
}

@media (prefers-contrast: high) {
    :root {
        --shadow: rgba(0, 0, 0, 0.5);
        --shadow-hover: rgba(0, 0, 0, 0.7);
        --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.3);
        --shadow-card-hover: 0 8px 30px rgba(0, 0, 0, 0.4);
    }

    .action-link,
    .source-link {
        text-decoration: underline;
    }

    .btn-search-main {
        border: 2px solid currentColor;
    }
}

@media print {
    .s010 form,
    .sherlock-image {
        display: none;
    }

    .s010 {
        background: white;
        padding: 20px;
    }

    .result-item {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #000;
    }

    .action-link {
        display: none;
    }

    /* Print styles for snippets */
    .snippet-text {
        border: 1px solid #ccc;
        margin-bottom: 8px;
        padding: 8px;
        break-inside: avoid;
        background: #f9f9f9 !important;
    }

    .snippet-text mark {
        background: #ffeb3b !important;
        color: #000 !important;
        box-shadow: none !important;
    }

    .video-matches .snippet-text,
    .post-matches .snippet-text {
        background: #f9f9f9 !important;
        border: 1px solid #ddd !important;
    }
}

/* Enhanced Multiple Matches Styling */
.match-count {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 500;
}

.video-matches {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.match-snippet {
    position: relative;
    border-radius: 8px;
    padding: 5px 12px;
    transition: all 0.2s ease;
}

.match-snippet:hover {
}

.match-snippet[data-match="0"] {
    border-left-color: var(--accent-primary);
}

.match-snippet[data-match="1"] {
    border-left-color: var(--warning-bg);
}

.match-snippet[data-match="2"] {
    border-left-color: #28a745;
}

.match-snippet[data-match="3"] {
    border-left-color: #17a2b8;
}

.line-number {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.snippet-text {
    line-height: 1.5;
    font-size: 0.9rem;
}

.more-matches-indicator {
    text-align: center;
    padding: 8px;
    background: rgba(var(--text-muted-rgb), 0.1);
    border-radius: 6px;
    margin-top: 8px;
}

.more-matches-indicator small {
    color: var(--text-muted);
    font-style: italic;
}

/* Responsive adjustments for multiple matches */
@media (max-width: 768px) {
    .video-matches {
        gap: 8px;
    }

    .match-snippet {
        padding: 6px 10px;
        margin: 0 -4px;
    }

    .snippet-text {
        font-size: 0.85rem;
    }

    .line-number {
        font-size: 0.7rem;
    }
}

/* Enhanced mark styling within multiple matches */
.match-snippet mark {
    background-color: var(--warning-bg);
    color: var(--warning-text);
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Hover effects for better interactivity */
.match-snippet:hover mark {
}

/* CSS Variables for theming (add to your existing variables) */
:root {
    --accent-primary-rgb: 44, 109, 213;
    --text-muted-rgb: 108, 117, 125;
}

/* Focus styles for accessibility */
.header-action-btn:focus,
.action-link:focus,
.btn-search-main:focus {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

.snippet-text:focus-within {
    outline: 1px solid var(--accent-primary);
    outline-offset: 2px;
}

/* Enhanced snippet container focus management */
.snippet-text {
    position: relative;
    scroll-margin-top: 100px; /* For smooth scrolling to snippets */
}

.snippet-text::before {
    content: "";
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: transparent;
    border-radius: inherit;
    pointer-events: none;
    transition: background 0.3s ease;
}

.snippet-text:hover::before {
}

/* Performance optimizations */
.result-item {
    contain: layout style;
    will-change: transform;
}

.snippet-text {
    contain: layout style paint;
}

.file-header {
    contain: layout style;
}

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

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

/* Enhanced Context Window Expansion Styles */

/* Context Window Container */
.context-window {
    background: var(--bg-tertiary);
    border-radius: 8px;
    margin-bottom: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: all 0.3s ease;
}

.context-window:hover {
    border-color: var(--border-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Context Lines Styling */
.context-lines {
    padding: 0;
}

.context-line {
    padding: 8px 15px;
    margin: 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        sans-serif;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
    transition: all 0.2s ease;
    position: relative;
}

.context-line:last-child {
    border-bottom: none;
}

.context-line:hover {
    background: rgba(0, 0, 0, 0.02);
    transform: translateX(2px);
}

/* Match line highlighting */
.context-line.match-line {
    background: var(--match-bg);
    border-left: 4px solid var(--warning-border);
    font-weight: 500;
    position: relative;
}

.context-line.match-line::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--accent-primary);
}

.context-line.context {
    background: var(--context-bg);
    color: var(--text-secondary);
}

/* Context Expansion Controls */
.context-expand-controls {
    padding: 8px 15px;
    background: rgba(0, 0, 0, 0.02);
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.expand-context-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: inherit;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.expand-context-btn:hover {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(44, 109, 213, 0.2);
}

.expand-context-btn.expanded {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

.expand-context-btn.expanded:hover {
    background: var(--accent-secondary);
    border-color: var(--accent-secondary);
}

.expand-context-btn i {
    font-size: 10px;
    transition: transform 0.3s ease;
}

.expand-context-btn.expanded i {
    transform: rotate(180deg);
}

/* Show More Contexts Controls */
.show-more-contexts-container {
    text-align: center;
    padding: 15px;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 8px;
    margin-top: 10px;
    border: 2px dashed var(--border-color);
}

.show-more-contexts-btn {
    background: linear-gradient(
        135deg,
        var(--accent-primary) 0%,
        var(--accent-secondary) 100%
    );
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(44, 109, 213, 0.3);
}

.show-more-contexts-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(44, 109, 213, 0.4);
}

.show-more-contexts-btn:active {
    transform: translateY(0);
}

.show-more-contexts-btn i {
    font-size: 12px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-3px);
    }
    60% {
        transform: translateY(-2px);
    }
}

/* Match Count Info */
.match-count-info {
    font-size: 11px;
    opacity: 0.9;
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
}

.match-count-info i {
    font-size: 10px;
}

/* Enhanced Match Preview for Expandable Context */
.match-preview.expandable-preview {
    padding: 15px;
}

/* Legacy format compatibility */
.match-snippet.legacy-format {
    background: var(--bg-tertiary);
    padding: 12px 15px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

/* No context state */
.no-context {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-style: italic;
    background: var(--bg-tertiary);
    border-radius: 8px;
    border: 2px dashed var(--border-color);
}

/* Enhanced highlighting within context */
.context-line mark {
    background-color: var(--warning-bg) !important;
    color: var(--warning-text) !important;
    padding: 2px 4px !important;
    border-radius: 3px !important;
    font-weight: 600 !important;
    box-shadow: 0 1px 3px rgba(245, 158, 11, 0.3) !important;
    border: 1px solid rgba(245, 158, 11, 0.3) !important;
}

.context-line.match-line mark {
    background-color: #fbbf24 !important;
    color: #92400e !important;
    box-shadow: 0 2px 4px rgba(251, 191, 36, 0.4) !important;
}

/* Fade transition for context switching */
.context-lines {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.context-lines[style*="display: none"] {
    opacity: 0;
    transform: translateY(-10px);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .context-line {
        padding: 6px 12px;
        font-size: 13px;
        line-height: 1.4;
    }

    .context-expand-controls {
        padding: 6px 12px;
    }

    .expand-context-btn {
        padding: 5px 10px;
        font-size: 11px;
        gap: 4px;
    }

    .show-more-contexts-btn {
        padding: 8px 16px;
        font-size: 12px;
        gap: 6px;
    }

    .match-count-info {
        font-size: 10px;
    }

    .match-preview.expandable-preview {
        padding: 12px;
    }

    .context-window {
        margin-bottom: 10px;
    }
}

@media (max-width: 480px) {
    .context-line {
        padding: 5px 10px;
        font-size: 12px;
    }

    .expand-context-btn {
        font-size: 10px;
        padding: 4px 8px;
    }

    .show-more-contexts-btn {
        padding: 6px 12px;
        font-size: 11px;
    }
}

/* Animation for new context windows */
@keyframes contextWindowFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.context-window {
    animation: contextWindowFadeIn 0.4s ease-out;
}

/* Enhanced focus styles for accessibility */
.expand-context-btn:focus,
.show-more-contexts-btn:focus {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

.context-line:focus {
    outline: 1px solid var(--accent-primary);
    outline-offset: 1px;
}

/* Print styles */
@media print {
    .context-expand-controls,
    .show-more-contexts-container {
        display: none;
    }

    .expanded-context {
        display: block !important;
    }

    .initial-context {
        display: none !important;
    }

    .context-window {
        break-inside: avoid;
        margin-bottom: 10px;
        border: 1px solid #ccc;
    }

    .context-line {
        padding: 4px 8px;
        border-bottom: 1px solid #eee;
    }

    .context-line mark {
        background: #ffeb3b !important;
        color: #000 !important;
        box-shadow: none !important;
    }
}

/* Simple "Show More Matches" button - matches your existing design */
.show-more-matches-container {
    text-align: center;
    padding: 12px;
    margin-top: 10px;
}

.show-more-matches-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: inherit;
}

.show-more-matches-btn:hover {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
    transform: translateY(-1px);
}

.show-more-matches-btn i {
    font-size: 11px;
}

/* Style for additional matches when they appear */
.additional-match {
    margin-top: 8px;
}

/* Keep the existing match-count-info styling simple */
.match-count-info {
    font-size: 11px;
    opacity: 0.9;
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
}

.match-count-info i {
    font-size: 10px;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .show-more-matches-btn {
        padding: 6px 12px;
        font-size: 12px;
        gap: 4px;
    }

    .match-count-info {
        font-size: 10px;
    }
}
/* Special styling for deleted video date messages */
.transcript-date.deleted-video {
    font-size: 11px !important;
    line-height: 1.3 !important;
    color: rgba(255, 255, 255, 0.8) !important;
    font-style: italic;
    max-width: 200px;
    text-align: left;
}

/* Mobile adjustments for deleted video messages */
@media (max-width: 768px) {
    .transcript-date.deleted-video {
        font-size: 10px !important;
        line-height: 1.2 !important;
    }
}
