:root {
    --primary-color: #2563eb;
    --primary-light: #3b82f6;
    --primary-dark: #1d4ed8;
    --accent-color: #f59e0b;
    --background-color: #f8fafc;
    --card-background: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-radius: 12px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.12);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--background-color);
    color: var(--text-primary);
    line-height: 1.5;
    padding: 2rem;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

h1 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 2rem;
    color: var(--primary-dark);
    font-weight: 600;
}

.search-wrapper {
    display: flex;
    gap: 1rem;
    margin: 0 auto 3rem;
    flex-wrap: wrap;
    max-width: 560px;
    justify-content: center;
    padding: 0 1rem;
}

.input-group {
    flex: 0 1 280px;
    min-width: 200px;
    position: relative;
}

input, select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: var(--border-radius);
    font-size: 1rem;
    background-color: var(--card-background);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

select {
    cursor: pointer;
    width: 160px;
}

.predictions-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--card-background);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    margin-top: 0.5rem;
    display: none;
    z-index: 10;
    overflow: hidden;
}

.prediction-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.prediction-item:hover {
    background-color: #f1f5f9;
}

.prediction-item .german {
    font-weight: 500;
    color: var(--text-primary);
}

.prediction-item .english {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.cases-container {
    max-width: 700px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0 1rem;
}

.case-row {
    display: flex;
    gap: 1rem;
    align-items: center;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    position: relative;
}

.case-label {
    flex: 0 0 180px;
    padding: 0.875rem;
    background: var(--primary-color);
    color: white;
    border-radius: var(--border-radius);
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.case-label h3 {
    font-weight: 600;
    font-size: 1.25rem;
}

.case-question {
    font-size: 0.875rem;
    opacity: 0.9;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    display: inline-block;
}

.sentence-box, .sentence-card {
    background: var(--card-background);
    padding: 1rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    border: 2px solid #e2e8f0;
}

.sentence-card p {
    margin-bottom: 0.5rem;
}

.sentence-card p:last-child {
    margin-bottom: 0;
}

.german {
    font-size: 1.125rem;
    font-weight: 500;
    color: var(--text-primary);
}

.english {
    color: var(--text-secondary);
}

/* Case-specific colors */
.nominative .case-label { background: #2563eb; }
.accusative .case-label { background: #7c3aed; }
.dative .case-label { background: #059669; }
.genitive .case-label { background: #dc2626; }

/* Responsive design */
@media (max-width: 768px) {
    body {
        padding: 1rem 0.5rem;
    }

    h1 {
        font-size: 2rem;
    }

    .search-wrapper {
        padding: 0 0.5rem;
        gap: 0.75rem;
    }

    /* Larger touch targets for mobile */
    input, select, .info-button, .prediction-item {
        min-height: 44px;
    }

    .info-button {
        padding: 0.75rem;
        font-size: 1.5rem;
    }

    /* Better spacing for case rows on mobile */
    .case-row {
        flex-direction: column;
        gap: 0.5rem;
        margin-bottom: 1.5rem;
    }

    .case-label {
        padding: 1rem;
        width: 100%;
    }

    /* Full-width cards on mobile */
    .sentence-card {
        width: 100%;
        padding: 1rem;
    }

    /* Center-aligned text for better readability */
    .german, .english {
        text-align: center;
    }

    /* Improved popup positioning for mobile */
    .info-popup {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 90%;
        max-width: 350px;
        max-height: 80vh;
        overflow-y: auto;
        margin: 0;
        z-index: 1000;
    }

    /* Dark overlay for popups */
    .info-popup.active::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: -1;
    }

    /* Larger close button for touch */
    .close-info {
        padding: 0.75rem;
        font-size: 1.75rem;
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.predictions-dropdown[style*="display: block"] {
    animation: fadeIn 0.2s ease-out;
}

.info-button {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.info-button:hover {
    color: var(--primary-color);
}

.case-block {
    margin: 10px 0;
    padding: 20px;
    border-radius: 10px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sentence-box {
    background-color: white;
    padding: 15px 20px;
    border-radius: 8px;
    margin-left: 20px;
    flex-grow: 1;
    border: 2px solid #e0e0e0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.info-popup {
    position: absolute;
    right: -320px;
    top: 50%;
    transform: translateY(-50%);
    width: 300px;
    background: var(--card-background);
    padding: 1.25rem;
    border-radius: var(--border-radius);
    border: 2px solid #e2e8f0;
    box-shadow: var(--shadow-lg);
    z-index: 20;
    font-size: 14px;
    line-height: 1.6;
    display: none;
}

.info-popup.active {
    display: block;
    animation: fadeIn 0.2s ease-out;
}

.info-popup::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 50%;
    transform: translateY(-50%);
    border-width: 10px;
    border-style: solid;
    border-color: transparent #e0e0e0 transparent transparent;
}

.info-popup::after {
    content: '';
    position: absolute;
    left: -7px;
    top: 50%;
    transform: translateY(-50%);
    border-width: 8px;
    border-style: solid;
    border-color: transparent white transparent transparent;
}

.info-popup h4 {
    color: var(--text-primary);
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.info-popup p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.info-popup ul {
    list-style: none;
    margin: 0.75rem 0;
    padding: 0;
}

.info-popup li {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    padding-left: 1rem;
    position: relative;
}

.info-popup li:before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--primary-color);
}

.info-popup .example {
    margin-top: 1rem;
    padding: 0.75rem;
    background: #f8fafc;
    border-radius: 6px;
    font-size: 0.9rem;
}

.info-popup .current-example {
    color: var(--primary-color);
    font-weight: 500;
}

.close-info {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
}

.close-info:hover {
    color: var(--text-primary);
}

/* Update case-row to handle the info button */
.case-row {
    display: flex;
    gap: 1rem;
    align-items: center;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    position: relative;
}

/* Responsive design updates */
@media (max-width: 1200px) {
    .info-popup {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        right: auto;
        width: 90%;
        max-width: 300px;
        margin: auto;
    }

    .info-popup::before {
        display: none;
    }
}

.highlight-article {
    color: #2563eb;  /* Bright blue */
    font-weight: 600;
    background-color: #dbeafe;  /* Light blue background */
    padding: 0 0.25rem;
    border-radius: 4px;
}

.highlight-ending {
    color: #047857;  /* Deep green */
    font-weight: 600;
    background-color: #d1fae5;  /* Light green background */
    padding: 0 0.25rem;
    border-radius: 4px;
}

.highlight-base {
    color: #6d28d9;  /* Deep purple */
    font-weight: 500;
    background-color: #ede9fe;  /* Light purple background */
    padding: 0 0.25rem;
    border-radius: 4px;
}

.german-example {
    font-style: italic;
    background: #f1f5f9;  /* Slightly darker background */
    padding: 0.5rem;
    border-radius: 6px;
    margin: 0.5rem 0;
    display: block;  /* Make it a block for better spacing */
    border-left: 3px solid #94a3b8;  /* Left border for emphasis */
}

/* Enhanced touch feedback */
.prediction-item {
    position: relative;
    overflow: hidden;
}

.prediction-item:active {
    background-color: #e2e8f0;
}

/* Improved dropdown on mobile */
.predictions-dropdown {
    max-height: 200px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Active states for touch */
.info-button:active,
.close-info:active {
    opacity: 0.7;
}

/* Prevent text selection on interactive elements */
.info-button,
.close-info,
.prediction-item,
.case-label {
    user-select: none;
    -webkit-user-select: none;
}

/* Specific highlights for grammatical elements */
.genitive-article, .n-declension {
    background-color: #ffeb3b;  /* Bright yellow */
    color: #000000;  /* Black text */
    padding: 0 2px;
    border-radius: 2px;
    font-weight: normal;
}

.base-word {
    color: var(--text-primary);
}

.example-container,
.explanation-text {
    display: none;
}

.info-popup br {
    display: block;
    margin: 8px 0;
    content: "";
} 