* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 800px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
    position: relative;
}

header h1 {
    font-size: 3rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
    margin-bottom: 15px;
}

.info-button {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.5);
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s;
    backdrop-filter: blur(10px);
}

.info-button:hover,
.info-button:focus {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.8);
    outline: none;
    transform: translateY(-2px);
}

.search-header {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    align-items: center;
}

.direction-toggle {
    flex: 1;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.direction-toggle:hover,
.direction-toggle:focus {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
    outline: none;
}

.toggle-text {
    flex: 1;
    text-align: center;
}

.toggle-icon {
    font-size: 1.2rem;
    opacity: 0.8;
    transition: transform 0.3s;
}

.direction-toggle:hover .toggle-icon {
    transform: rotate(180deg);
}

.random-btn {
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid #667eea;
    color: #667eea;
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.3rem;
    transition: all 0.3s;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    line-height: 1;
}

.random-btn:hover,
.random-btn:focus {
    background: #667eea;
    transform: translateY(-2px) rotate(20deg);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
    outline: none;
}

.search-container {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

#searchInput {
    width: 100%;
    padding: 15px 20px;
    font-size: 1.1rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.3s;
}

#searchInput:focus {
    border-color: #667eea;
}

.search-info {
    margin-top: 10px;
    font-size: 0.9rem;
    color: #666;
}

.results {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    min-height: 300px;
    max-height: 600px;
    overflow-y: auto;
}

.result-item {
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s;
}

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

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

.source-word {
    font-size: 1.3rem;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 5px;
}

.target-words {
    font-size: 1.1rem;
    color: #764ba2;
    margin-bottom: 8px;
}

.morfologio {
    font-size: 0.9rem;
    color: #888;
    font-style: italic;
}

.sources {
    margin-top: 8px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.source-badge {
    display: inline-block;
    padding: 3px 8px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
}

.source-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    filter: brightness(1.1);
}

.badge-fr {
    background: linear-gradient(135deg, #0055A4 0%, #EF4135 100%);
    color: white;
}

.badge-en {
    background: linear-gradient(135deg, #012169 0%, #C8102E 100%);
    color: white;
}

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

.badge-eo {
    background: linear-gradient(135deg, #009B3A 0%, #00703C 100%);
    color: white;
}

.badge-wiki {
    background: linear-gradient(135deg, #999 0%, #666 100%);
    color: white;
}

.badge-default {
    background: #e0e0e0;
    color: #666;
}

.no-results {
    text-align: center;
    padding: 40px;
    color: #999;
    font-size: 1.1rem;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #aaa;
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

footer {
    text-align: center;
    margin-top: 30px;
    color: white;
    font-size: 0.9rem;
    opacity: 0.9;
}

footer a {
    color: white;
    text-decoration: underline;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #667eea;
    font-size: 1.1rem;
}

/* Scrollbar styling */
.results::-webkit-scrollbar {
    width: 8px;
}

.results::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.results::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

.results::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

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

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    color: #667eea;
    font-size: 1.5rem;
}

.close-button {
    background: none;
    border: none;
    font-size: 2rem;
    color: #999;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
    transition: color 0.2s;
}

.close-button:hover,
.close-button:focus {
    color: #667eea;
    outline: none;
}

.modal-body {
    padding: 20px;
    color: #333;
}

.modal-body h3 {
    color: #667eea;
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.modal-body h3:first-child {
    margin-top: 0;
}

.modal-body h4 {
    color: #764ba2;
    margin-top: 15px;
    margin-bottom: 8px;
    font-size: 1rem;
}

.modal-body ul {
    margin-left: 20px;
    margin-bottom: 15px;
}

.modal-body li {
    margin-bottom: 8px;
}

.modal-body p {
    margin-bottom: 15px;
    line-height: 1.6;
}

.modal-body a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

.modal-body a:hover {
    text-decoration: underline;
}

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

.info-item {
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.info-item strong {
    color: #667eea;
}

/* Part of speech styling */
.pos-badges {
    margin-top: 8px;
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.pos-badge {
    display: inline-block;
    padding: 2px 6px;
    font-size: 0.7rem;
    font-weight: 500;
    border-radius: 8px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    background: #f0f0f0;
    color: #666;
    border: 1px solid #ddd;
}

.pos-badge.pos-noun {
    background: #e3f2fd;
    color: #1976d2;
    border-color: #bbdefb;
}

.pos-badge.pos-verb {
    background: #f3e5f5;
    color: #7b1fa2;
    border-color: #ce93d8;
}

.pos-badge.pos-adj {
    background: #e8f5e8;
    color: #388e3c;
    border-color: #a5d6a7;
}

.pos-badge.pos-adv {
    background: #fff3e0;
    color: #f57c00;
    border-color: #ffcc02;
}

.pos-badge.pos-prep {
    background: #fce4ec;
    color: #c2185b;
    border-color: #f8bbd9;
}

.pos-badge.pos-conj {
    background: #f1f8e9;
    color: #689f38;
    border-color: #c5e1a5;
}

.pos-badge.pos-pron {
    background: #e0f2f1;
    color: #00695c;
    border-color: #80cbc4;
}

.pos-badge.pos-interj {
    background: #fafafa;
    color: #424242;
    border-color: #e0e0e0;
}

/* Pull to refresh styling */
.pull-to-refresh {
    position: relative;
    overflow: hidden;
}

.pull-indicator {
    position: absolute;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    z-index: 10;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.pull-indicator.visible {
    top: 10px;
}

.pull-indicator.refreshing {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: translateX(-50%) rotate(0deg);
    }

    to {
        transform: translateX(-50%) rotate(360deg);
    }
}

/* Improved touch targets for mobile */
@media (max-width: 768px) {

    .direction-toggle,
    .random-btn,
    .info-button,
    .close-button {
        min-height: 44px;
        min-width: 44px;
    }

    .source-badge {
        min-height: 28px;
        padding: 4px 10px;
        font-size: 0.8rem;
    }

    .result-item {
        padding: 20px 15px;
    }

    .source-word {
        font-size: 1.4rem;
        margin-bottom: 8px;
    }

    .target-words {
        font-size: 1.2rem;
        margin-bottom: 12px;
    }
}

/* Responsive design */
@media (max-width: 600px) {
    .search-header {
        flex-direction: row;
        gap: 8px;
    }

    .direction-toggle {
        flex: 1;
        font-size: 0.9rem;
        padding: 12px 16px;
        min-height: 48px;
    }

    .random-btn {
        padding: 12px 16px;
        font-size: 1.2rem;
        min-height: 48px;
        min-width: 48px;
    }

    .info-button {
        min-height: 44px;
        padding: 10px 18px;
    }

    header h1 {
        font-size: 2rem;
    }

    .modal-content {
        width: 95%;
        max-height: 90vh;
    }
}

/* PullToRefresh.js custom styling */
.ptr {
    box-shadow: inset 0 -3px 5px rgba(0, 0, 0, 0.12);
}

.ptr--ptr {
    box-shadow: none;
}

.ptr__pull {
    transition: none;
}

.ptr__element {
    top: 0.25em;
    height: 3em;
    border-radius: 1.5em;
    width: 3em;
    text-align: center;
    background: rgba(255, 255, 255, 0.9);
    color: #667eea;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    line-height: 3em;
    font-size: 0.85em;
}

.ptr__text {
    margin-top: 0.33em;
    color: rgba(0, 0, 0, 0.3);
}

/* Filters styling */
.filters-container {
    margin-top: 15px;
}

.filters-toggle {
    width: 100%;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    color: #495057;
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.filters-toggle:hover,
.filters-toggle:focus {
    background: #e9ecef;
    border-color: #667eea;
    outline: none;
}

.filters-toggle[aria-expanded="true"] .filters-icon {
    transform: rotate(180deg);
}

.filters-icon {
    transition: transform 0.3s;
    font-size: 0.8rem;
}

.filters-count {
    background: #667eea;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

.filters-count:empty {
    display: none;
}

.filters-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-top: none;
    border-radius: 0 0 8px 8px;
}

.filters-panel[aria-hidden="false"] {
    max-height: 300px;
    padding: 16px;
}

.filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.filters-header h3 {
    margin: 0;
    font-size: 0.9rem;
    color: #495057;
    font-weight: 600;
}

.clear-filters {
    background: none;
    border: 1px solid #dc3545;
    color: #dc3545;
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.clear-filters:hover,
.clear-filters:focus {
    background: #dc3545;
    color: white;
    outline: none;
}

.filter-group {
    margin-bottom: 12px;
}

.filter-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 8px;
}

.filter-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
}

.filter-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.filter-label {
    cursor: pointer;
    font-size: 0.85rem;
    color: #495057;
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-label:hover {
    color: #667eea;
}

.source-icon {
    font-size: 0.9rem;
}

/* Mobile filters styling */
@media (max-width: 768px) {
    .filters-toggle {
        padding: 14px 16px;
        font-size: 0.9rem;
    }

    .filter-options {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .filter-option {
        padding: 8px 0;
    }

    .filter-checkbox {
        width: 18px;
        height: 18px;
    }

    .filter-label {
        font-size: 0.9rem;
    }
}

/* Version
 display */
.version {
    color: #6c757d;
    font-size: 0.85rem;
    opacity: 0.7;
    font-family: 'Courier New', monospace;
}

.version:hover {
    opacity: 1;
}