:root {
    /* Tombstone-specific color palette */
    --tombstone-primary: #5d4037;
    --tombstone-primary-light: #8d6e63;
    --tombstone-primary-dark: #997670;
    --tombstone-secondary: #795548;
    --tombstone-accent: #a1887f;
    --tombstone-stone: #9e9e9e;
    --tombstone-gold: #ffd54f;
    
    --primary-color: var(--tombstone-primary);
    --primary-light: var(--tombstone-primary-light);
    --primary-dark: var(--tombstone-primary-dark);
    --accent-color: #ff6b6b;
    --success-color: #4caf50;
    --warning-color: #ff9f1c;
    --danger-color: #e63946;
    --text-color: #333;
    --text-light: #666;
    --background-color: #f8f9fa;
    --card-color: #ffffff;
    --border-color: #e0e0e0;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --border-radius-sm: 8px;
    --border-radius: 12px;
    --border-radius-lg: 16px;
    --transition: all 0.3s ease;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
    :root {
        --tombstone-primary: #8d6e63;
        --tombstone-primary-light: #a1887f;
        --tombstone-primary-dark: #b88c7e;
        --primary-color: var(--tombstone-primary);
        --primary-light: var(--tombstone-primary-light);
        --primary-dark: var(--tombstone-primary-dark);
        --accent-color: #ff7b7b;
        --success-color: #5cba61;
        --warning-color: #ffae3d;
        --danger-color: #f54e5b;
        --text-color: #e5e5e5;
        --text-light: #adadad;
        --background-color: #121212;
        --card-color: #1e1e1e;
        --border-color: #333333;
        --shadow-color: rgba(0, 0, 0, 0.5);
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    padding: 0;
    margin: 0;
    min-height: 100vh;
}

/* RTL support */
[dir="rtl"] {
    font-family: 'David Libre', 'Times New Roman', serif;
}

.app-container {
    max-width: 768px;
    margin: 0 auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

header {
    display: flex;
    justify-content: flex-end;
    padding: 0.5rem 0;
    margin-bottom: 1rem;
}

[dir="rtl"] header {
    justify-content: flex-start;
}

.header-controls {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
}

.language-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}

.language-selector label {
    color: var(--primary-color);
    font-size: 1.25rem;
}

select {
    background-color: var(--card-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 1em;
    padding-right: 2rem;
    flex: 1;
    min-width: 0;
}

[dir="rtl"] select {
    background-position: left 0.5rem center;
    padding-right: 0.75rem;
    padding-left: 2rem;
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.app-title {
    text-align: center;
    margin-bottom: 1rem;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.logo i {
    font-size: 1.75rem;
    color: var(--primary-color);
}

.logo span {
    font-family: 'David Libre', 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 2rem;
    background: linear-gradient(to right, var(--tombstone-primary), var(--tombstone-accent));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.app-title h1 {
    font-family: 'David Libre', 'Space Grotesk', sans-serif;
    font-weight: 600;
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

[dir="rtl"] .app-title h1 {
    font-family: 'David Libre', serif;
}

.app-title p {
    color: var(--text-light);
    font-size: 1rem;
}

/* Tombstone-specific information sections */
.tombstone-tips {
    background-color: var(--card-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-bottom: 1rem;
    border-left: 4px solid var(--success-color);
    box-shadow: 0 2px 8px var(--shadow-color);
}

[dir="rtl"] .tombstone-tips {
    border-left: none;
    border-right: 4px solid var(--success-color);
}

.tips-header h3 {
    color: var(--success-color);
    font-size: 1rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tips-content ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tips-content li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.tips-content li i {
    color: var(--success-color);
    width: 1rem;
    text-align: center;
}

.common-abbreviations {
    background-color: var(--card-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-bottom: 1rem;
    border-left: 4px solid var(--primary-color);
    box-shadow: 0 2px 8px var(--shadow-color);
}

[dir="rtl"] .common-abbreviations {
    border-left: none;
    border-right: 4px solid var(--primary-color);
}

.abbrev-header h3 {
    color: var(--primary-color);
    font-size: 1rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.abbrev-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.5rem;
}

.abbrev-item {
    font-size: 0.85rem;
    padding: 0.25rem;
    background-color: rgba(93, 64, 55, 0.1);
    border-radius: 4px;
}

.abbrev-item strong {
    color: var(--primary-dark);
    font-family: 'David Libre', serif;
}

[dir="rtl"] .abbrev-item {
    text-align: right;
    direction: rtl;
}

/* Enhancement notice styling */
.enhancement-notice {
    background: linear-gradient(135deg, #4caf50, #2196f3);
    color: white;
    padding: 0.75rem;
    border-radius: var(--border-radius-sm);
    margin-top: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

.enhancement-notice i {
    color: #ffeb3b;
    font-size: 1.1rem;
    animation: sparkle 2s ease-in-out infinite alternate;
}

@keyframes sparkle {
    0% { transform: scale(1) rotate(0deg); }
    100% { transform: scale(1.1) rotate(5deg); }
}

/* Accuracy notice styling */
.accuracy-notice {
    background: linear-gradient(135deg, #2196f3, #4caf50);
    color: white;
    padding: 0.75rem;
    border-radius: var(--border-radius-sm);
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.3);
}

.accuracy-notice i {
    color: #fff;
    font-size: 1.1rem;
}

.upload-container {
    background-color: var(--card-color);
    border: 2px dashed var(--primary-light);
    border-radius: var(--border-radius);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    gap: 1rem;
    box-shadow: 0 4px 12px var(--shadow-color);
    background-color: rgba(93, 64, 55, 0.05);
}

.upload-container:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px var(--shadow-color);
    background-color: rgba(93, 64, 55, 0.1);
}

.upload-container.highlight {
    border-color: var(--primary-color);
    background-color: rgba(93, 64, 55, 0.15);
}

.upload-icon {
    font-size: 2.5rem;
    color: var(--primary-color);
    display: flex;
    gap: 0.5rem;
}

.upload-text {
    font-size: 1.25rem;
    font-weight: 500;
}

.upload-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
    width: 100%;
    justify-content: center;
}

.upload-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.25rem;
    gap: 0.75rem;
    background-color: var(--card-color);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition);
    flex: 1;
    min-width: 100px;
    max-width: 140px;
}

.upload-option:hover {
    transform: translateY(-2px);
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px var(--shadow-color);
}

.upload-option:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.upload-option i {
    font-size: 1.75rem;
    color: var(--primary-color);
}

.upload-option:first-child i {
    color: var(--accent-color);
}

.upload-option:nth-child(3) i {
    color: #673ab7; /* Purple for clipboard */
}

.upload-option span {
    font-weight: 500;
    color: var(--text-color);
    text-align: center;
}

.preview-container {
    background-color: var(--card-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 4px 12px var(--shadow-color);
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.preview-header h3 {
    font-weight: 500;
}

.btn-reset {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-reset:hover {
    color: var(--danger-color);
    background-color: rgba(230, 57, 70, 0.1);
}

.image-preview-wrapper {
    padding: 1rem;
    display: flex;
    justify-content: center;
}

#imagePreview {
    max-width: 100%;
    max-height: 300px;
    border-radius: var(--border-radius-sm);
}

.btn-analyze {
    width: 100%;
    padding: 1rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    font-size: 1.125rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.btn-analyze:hover {
    background-color: var(--primary-dark);
}

.btn-analyze:disabled {
    background-color: var(--text-light);
    cursor: not-allowed;
}

.results-container {
    background-color: var(--card-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 4px 12px var(--shadow-color);
}

.results-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.results-header h2 {
    font-size: 1.25rem;
    font-weight: 500;
}

.results-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-share, .btn-copy, .btn-print, .btn-save {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 1.125rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-share:hover, .btn-copy:hover, .btn-save:hover {
    background-color: rgba(93, 64, 55, 0.1);
}

.btn-print {
    color: #673ab7; /* Purple for print */
}

.btn-print:hover {
    background-color: rgba(103, 58, 183, 0.1);
}

.btn-new {
    background-color: var(--success-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.btn-new:hover {
    background-color: #3d9240;
}

.results-content {
    padding: 1.5rem;
}

/* Tombstone-specific result sections */
.results-section {
    background-color: var(--card-color);
    border-radius: var(--border-radius-sm);
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-left: 4px solid var(--primary-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: var(--transition);
}

[dir="rtl"] .results-section {
    border-left: none;
    border-right: 4px solid var(--primary-color);
}

.results-section:hover {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.results-section:last-child {
    margin-bottom: 0;
}

/* Specific section colors */
.document-image-section {
    border-left-color: #4caf50 !important;
}

.hebrew-text-section {
    border-left-color: var(--tombstone-primary) !important;
}

.decoded-abbreviations-section {
    border-left-color: var(--tombstone-secondary) !important;
}

.dates-section {
    border-left-color: #2196f3 !important;
}

.names-section {
    border-left-color: #ff9800 !important;
}

.religious-elements-section {
    border-left-color: #9c27b0 !important;
}

.genealogical-info-section {
    border-left-color: #009688 !important;
}

.summary-section {
    border-left-color: #795548 !important;
}

.uncertainties-section {
    border-left-color: #9e9e9e !important;
}

/* RTL support for sections */
[dir="rtl"] .document-image-section {
    border-right-color: #4caf50 !important;
    border-left: none !important;
}

[dir="rtl"] .hebrew-text-section {
    border-right-color: var(--tombstone-primary) !important;
    border-left: none !important;
}

[dir="rtl"] .decoded-abbreviations-section {
    border-right-color: var(--tombstone-secondary) !important;
    border-left: none !important;
}

[dir="rtl"] .dates-section {
    border-right-color: #2196f3 !important;
    border-left: none !important;
}

[dir="rtl"] .names-section {
    border-right-color: #ff9800 !important;
    border-left: none !important;
}

[dir="rtl"] .religious-elements-section {
    border-right-color: #9c27b0 !important;
    border-left: none !important;
}

[dir="rtl"] .genealogical-info-section {
    border-right-color: #009688 !important;
    border-left: none !important;
}

[dir="rtl"] .summary-section {
    border-right-color: #795548 !important;
    border-left: none !important;
}

[dir="rtl"] .uncertainties-section {
    border-right-color: #9e9e9e !important;
    border-left: none !important;
}

.results-section h3 {
    font-family: 'David Libre', 'Space Grotesk', sans-serif;
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

[dir="rtl"] .results-section h3 {
    text-align: right;
    font-family: 'David Libre', serif;
}

.results-section h3 i {
    color: var(--primary-color);
}

/* Hebrew content styling */
.hebrew-content {
    direction: rtl;
    text-align: right;
}

.hebrew-transcription {
    background-color: #f5f5f5;
    padding: 1rem;
    border-right: 4px solid var(--tombstone-primary);
    margin: 1rem 0;
    white-space: pre-line;
    font-family: 'David Libre', 'Times New Roman', serif;
    font-size: 1.1rem;
    line-height: 1.8;
    direction: rtl;
    text-align: right;
    border-radius: var(--border-radius-sm);
}

[dir="ltr"] .hebrew-transcription {
    border-right: none;
    border-left: 4px solid var(--tombstone-primary);
}

/* Grid layouts for organized information */
.dates-grid, .names-grid, .genealogy-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.date-category, .name-category, .genealogy-item {
    background-color: rgba(93, 64, 55, 0.1);
    padding: 0.75rem;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
}

.date-category h4, .name-category h4, .genealogy-item h4 {
    color: var(--primary-dark);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.25rem;
}

.name-value {
    font-weight: bold;
    font-size: 1rem;
    color: var(--text-color);
}

.hebrew-date {
    font-family: 'David Libre', 'Times New Roman', serif;
    font-size: 1rem;
    font-weight: bold;
    direction: rtl;
    text-align: right;
}

/* Document image in results */
.document-image-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 1rem 0;
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: var(--border-radius-sm);
    padding: 1rem;
}

.document-image-thumbnail {
    max-width: 200px;
    max-height: 150px;
    width: auto;
    height: auto;
    border-radius: var(--border-radius-sm);
    box-shadow: 0 2px 8px var(--shadow-color);
    margin-bottom: 0.5rem;
    object-fit: contain;
}

.image-actions {
    margin-top: 0.5rem;
}

.btn-view-full {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-sm);
    font-size: 0.875rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.btn-view-full:hover {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
}

/* Lists */
.results-section ul {
    list-style-type: none;
    padding-left: 0;
    margin-bottom: 0.5rem;
}

[dir="rtl"] .results-section ul {
    padding-right: 0;
}

.results-section ul li {
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

[dir="rtl"] .results-section ul li {
    padding-left: 0;
    padding-right: 1.5rem;
}

.results-section ul li:before {
    content: '•';
    position: absolute;
    left: 0.5rem;
    color: var(--primary-color);
}

[dir="rtl"] .results-section ul li:before {
    left: auto;
    right: 0.5rem;
}

.results-section p {
    margin-bottom: 0.75rem;
    line-height: 1.6;
}

.results-section strong {
    color: var(--primary-dark);
    font-weight: 600;
}

/* History functionality */
.history-toggle {
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 auto;
    font-size: 0.875rem;
}

.history-toggle:hover {
    color: var(--primary-color);
}

.history-container {
    background-color: var(--card-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 4px 12px var(--shadow-color);
    margin-bottom: 1.5rem;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.history-header h2 {
    font-size: 1.25rem;
    font-weight: 500;
}

.btn-close {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-close:hover {
    color: var(--danger-color);
}

.history-list {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 60vh;
    overflow-y: auto;
}

.history-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
}

.history-item:hover {
    border-color: var(--primary-light);
    background-color: rgba(93, 64, 55, 0.05);
}

.history-item-image {
    width: 80px;
    height: 80px;
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    flex-shrink: 0;
}

.history-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.history-item-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.history-item-content h4 {
    font-size: 1rem;
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.history-date {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.history-preview {
    font-size: 0.875rem;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

[dir="rtl"] .history-preview {
    text-align: right;
    direction: rtl;
}

.history-item-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.btn-view, .btn-delete {
    background: none;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    padding: 0.5rem;
    border-radius: 50%;
    transition: var(--transition);
    cursor: pointer;
}

.btn-view {
    color: var(--primary-color);
}

.btn-view:hover {
    background-color: rgba(93, 64, 55, 0.1);
}

.btn-delete {
    color: var(--danger-color);
}

.btn-delete:hover {
    background-color: rgba(229, 57, 53, 0.1);
}

.no-history {
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
}

/* Loading animation */
.loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

.loader-text {
    color: white;
    font-size: 1.25rem;
}

[dir="rtl"] .loader-text {
    font-family: 'David Libre', serif;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

footer {
    text-align: center;
    padding: 1rem 0;
    color: var(--text-light);
    font-size: 0.875rem;
    margin-top: 2rem;
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Dark mode improvements */
@media (prefers-color-scheme: dark) {
    .upload-container {
        background-color: rgba(141, 110, 99, 0.15);
    }
    
    .upload-container:hover {
        background-color: rgba(141, 110, 99, 0.25);
    }
    
    .tombstone-tips, .common-abbreviations {
        background-color: #2c2c2c;
    }
    
    .date-category, .name-category, .genealogy-item {
        background-color: rgba(141, 110, 99, 0.2);
        border-color: #444;
    }
    
    .hebrew-transcription {
        background-color: #2c2c2c;
        border-color: var(--primary-light);
        color: #f0f0f0;
    }
    
    .document-image-wrapper {
        background-color: rgba(255, 255, 255, 0.05);
    }
    
    .upload-option {
        background-color: #2c2c2c;
        border-color: #444;
    }
    
    .upload-option:hover {
        border-color: var(--primary-color);
        background-color: #3c3c3c;
    }
    
    .upload-option span {
        color: #f8f9fa !important;
    }
    
    .upload-option:nth-child(3) i {
        color: #9575cd; /* Lighter purple for dark mode */
    }
}

/* Mobile optimizations */
@media (max-width: 576px) {
    .app-title h1 {
        font-size: 2rem;
    }
    
    .upload-icon {
        font-size: 2rem;
    }
    
    .upload-text {
        font-size: 1.125rem;
    }
    
    .results-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .results-actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    .upload-buttons {
        flex-direction: row;
        justify-content: space-around;
    }
    
    .upload-option {
        min-width: 90px;
        max-width: 100px;
        padding: 1rem 0.5rem;
    }
    
    .upload-option span {
        font-size: 0.875rem;
    }
    
    .upload-option i {
        font-size: 1.5rem;
    }
    
    .dates-grid, .names-grid, .genealogy-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .history-item {
        flex-direction: column;
    }
    
    .history-item-image {
        width: 100%;
        height: 120px;
    }
    
    .history-item-actions {
        flex-direction: row;
        justify-content: flex-end;
        margin-top: 0.5rem;
    }
    
    .results-section {
        padding: 0.75rem;
        margin-bottom: 1rem;
    }
    
    .results-section h3 {
        font-size: 1rem;
        padding-bottom: 0.5rem;
        margin-bottom: 0.5rem;
    }
    
    .app-container {
        padding: 0.75rem;
    }
    
    .results-section p, 
    .results-section li {
        font-size: 0.9rem;
        line-height: 1.4;
    }
    
    .document-image-thumbnail {
        max-width: 150px;
        max-height: 120px;
    }
    
    .document-image-wrapper {
        padding: 0.75rem;
    }
    
    .btn-view-full {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
    
    .abbrev-grid {
        grid-template-columns: 1fr;
    }
    
    .tips-content li {
        font-size: 0.85rem;
    }
    
    .hebrew-transcription {
        font-size: 1rem;
        padding: 0.75rem;
    }
}

/* Very small screens - stack upload buttons vertically */
@media (max-width: 400px) {
    .upload-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .upload-option {
        width: 100%;
        max-width: 200px;
        flex-direction: row;
        justify-content: flex-start;
        padding: 1rem;
    }
    
    .upload-option i {
        margin-right: 0.75rem;
    }
    
    [dir="rtl"] .upload-option i {
        margin-right: 0;
        margin-left: 0.75rem;
    }
}