@import url('https://fonts.googleapis.com/css2?family=UnifrakturMaguntia&display=swap');

* {
    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;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 100%;
    text-align: center;
}

h1 {
    font-family: 'UnifrakturMaguntia', 'Fette Fraktur', serif;
    font-size: 3.5rem;
    margin-bottom: 10px;
    color: #333;
    font-weight: 700;
    letter-spacing: 2px;
}

.input-section {
    margin-bottom: 30px;
}

.autocomplete-wrapper {
    position: relative;
    width: 60%;
    margin: 0 auto;
}

@media (max-width: 768px) {
    .autocomplete-wrapper {
        width: 90%;
    }
}

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

.search-button {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    padding: 10px 15px;
    background: transparent;
    color: #667eea;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-button:hover {
    background: rgba(102, 126, 234, 0.1);
    transform: translateY(-50%) scale(1.1);
}

.search-button:active {
    transform: translateY(-50%) scale(0.95);
}

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

.autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #667eea;
    border-top: none;
    border-radius: 0 0 10px 10px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    margin-top: -10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.autocomplete-list.hidden {
    display: none;
}

.autocomplete-item {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 4px;
    transition: background-color 0.2s;
}

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

.autocomplete-item:hover,
.autocomplete-item.selected {
    background-color: #f0f0f0;
}

.autocomplete-item .noun-name {
    font-size: 1rem;
    color: #333;
}

.autocomplete-item .article-badge {
    font-size: 0.85rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 5px;
}

.autocomplete-item .article-badge.der {
    background-color: #dbeafe;
    color: #2563eb;
}

.autocomplete-item .article-badge.die {
    background-color: #fee2e2;
    color: #dc2626;
}

.autocomplete-item .article-badge.das {
    background-color: #dcfce7;
    color: #16a34a;
}

.result {
    padding: 30px;
    border-radius: 15px;
    background: #f8f9fa;
    animation: fadeIn 0.4s ease-in;
    text-align: left;
}

.result.hidden {
    display: none;
}

.article-display {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 8px;
}

.article {
    margin-right: 2px;
    display: inline-block;
    min-width: 3ch;
}

.article.der {
    color: #2563eb;
}

.article.die {
    color: #dc2626;
}

.article.das {
    color: #16a34a;
}

.noun {
    color: #333;
}

.source-indicator {
    font-size: 0.75rem;
    color: #999;
    font-weight: 400;
    margin-top: 4px;
    font-style: italic;
}

.source-indicator:empty {
    display: none;
}

.plural-section {
    font-size: 1rem;
    margin-top: 4px;
    margin-bottom: 12px;
    text-align: left;
}

.plural-section .label {
    font-size: 0.85rem;
    color: #999;
    font-weight: 400;
    margin-right: 6px;
}

.plural-text {
    color: #333;
    font-weight: 500;
}

.plural-text:empty::after {
    content: '—';
    color: #ccc;
}

.separator {
    border: none;
    border-top: 1px solid #e0e0e0;
    margin: 16px 0;
}

.translation-section {
    margin-top: 12px;
    margin-bottom: 8px;
    text-align: left;
    font-size: 1rem;
}

.translation-section .label {
    font-size: 0.85rem;
    color: #999;
    font-weight: 400;
    margin-right: 6px;
}

.translation {
    font-size: 1.1rem;
    color: #333;
    font-weight: 500;
}

.translation:empty {
    display: none;
}

.message {
    font-size: 1rem;
    color: #666;
    margin-top: 10px;
}

.message.error {
    color: #dc2626;
}

.message:not(.error):not(:empty) {
    animation: pulse 1.5s ease-in-out infinite;
}

.feedback-section {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e0e0e0;
}

.feedback-section.hidden {
    display: none;
}

.feedback-label {
    font-size: 0.75rem;
    color: #999;
    margin-bottom: 6px;
    font-weight: 400;
    text-align: center;
}

.feedback-buttons {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-bottom: 6px;
}

.feedback-button {
    padding: 6px 12px;
    font-size: 1.1rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    background: #f3f4f6;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.feedback-button .button-icon {
    font-size: 1.1rem;
}

.correct-button {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.correct-button:hover:not(:disabled) {
    background: #e5e7eb;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(107, 114, 128, 0.2);
}

.wrong-button {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.wrong-button:hover:not(:disabled) {
    background: #e5e7eb;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(107, 114, 128, 0.2);
}

.feedback-button:active:not(:disabled) {
    transform: translateY(0);
}

.feedback-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.feedback-stats {
    font-size: 0.7rem;
    color: #999;
    margin-top: 4px;
    text-align: center;
}

.save-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.save-section.hidden {
    display: none;
}

.source-info {
    font-size: 0.9rem;
    color: #667eea;
    margin-bottom: 10px;
    font-weight: 500;
}

.save-button {
    padding: 10px 20px;
    font-size: 0.95rem;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
}

.save-button:hover {
    background: #5568d3;
    transform: translateY(-1px);
}

.save-button:active {
    transform: translateY(0);
}

.save-button:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
}

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

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

/* Stats Button */
.stats-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #667eea;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.stats-button:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.5);
}

.stats-button:active {
    transform: translateY(0);
}

.stats-icon {
    font-size: 1.5rem;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.3s ease;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    border-radius: 16px;
    width: 67.5%;
    max-width: 450px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
}

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

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

.close-button {
    background: none;
    border: none;
    font-size: 2rem;
    color: #999;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.close-button:hover {
    background: #f0f0f0;
    color: #333;
}

.modal-body {
    padding: 16px;
    overflow-y: auto;
    max-height: calc(80vh - 80px);
}

.stats-content {
    color: #333;
}

.stats-content .loading {
    text-align: center;
    color: #999;
    padding: 40px 0;
}

.stat-section {
    margin-bottom: 16px;
}

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

.stat-section h3 {
    font-size: 0.95rem;
    color: #667eea;
    margin-bottom: 8px;
    font-weight: 600;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    border-bottom: 1px solid #f0f0f0;
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-label {
    color: #666;
    font-size: 0.8rem;
}

.stat-value {
    color: #333;
    font-weight: 600;
    font-size: 0.8rem;
}

.stat-bar-container {
    margin-top: 2px;
    height: 4px;
    background: #f0f0f0;
    border-radius: 2px;
    overflow: hidden;
}

.stat-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}

.stat-bar.der {
    background: #2563eb;
}

.stat-bar.die {
    background: #dc2626;
}

.stat-bar.das {
    background: #16a34a;
}

.stat-bar.general {
    background: #667eea;
}

.letter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 6px;
    margin-top: 8px;
}

.letter-item {
    background: #f8f9fa;
    padding: 6px 4px;
    border-radius: 6px;
    text-align: center;
}

.letter-label {
    font-weight: 600;
    color: #667eea;
    font-size: 0.9rem;
}

.letter-count {
    font-size: 0.7rem;
    color: #666;
    margin-top: 2px;
}

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