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

body {
    font-family: 'Oswald', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #fff;
    color: #000;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    text-align: center;
    margin-bottom: 20px;
    position: relative;
}

h1 {
    font-size: 3rem;
    font-weight: 400;
    color: #000;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

h2 {
    font-size: 1.2rem;
    font-weight: 300;
    color: #666;
    max-width: 600px;
    margin: 0 auto;
}

.header-actions {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.search-language-row {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: center;
}

.search-container {
    position: relative;
}

.search-bar {
    position: relative;
    display: flex;
    align-items: center;
    background: white;
    border: 1px solid #000;
    border-radius: 2px;
    padding: 0;
    min-width: 300px;
    transition: all 0.2s ease;
    height: 44px;
}

.search-bar:focus-within {
    box-shadow: inset 0 0 0 1px #000;
}

.search-icon {
    position: absolute;
    left: 12px;
    color: #000;
    z-index: 1;
    width: 14px;
    height: 14px;
}

.search-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 12px 40px 12px 36px;
    font-size: 0.9rem;
    background: transparent;
    font-family: 'Oswald', sans-serif;
    font-weight: 300;
    color: #000;
}

.search-input::placeholder {
    color: #666;
    font-weight: 300;
}

.clear-search {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    padding: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    transition: color 0.2s ease;
    width: 20px;
    height: 20px;
}

.clear-search:hover {
    color: #000;
}

.clear-search svg {
    width: 12px;
    height: 12px;
}

.add-phrase-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #000;
    color: white;
    text-decoration: none;
    padding: 12px 20px;
    border-radius: 2px;
    font-weight: 400;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    height: 44px;
    font-family: 'Oswald', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.add-phrase-btn:hover {
    background: #333;
    color: white;
}

.add-phrase-btn svg {
    width: 14px;
    height: 14px;
}

.language-filter {
    position: relative;
}

.language-dropdown {
    background: white;
    border: 1px solid #000;
    border-radius: 2px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-family: 'Oswald', sans-serif;
    font-weight: 300;
    color: #000;
    cursor: pointer;
    height: 44px;
    min-width: 60px;
    transition: all 0.2s ease;
    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='currentColor' 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 12px center;
    background-size: 16px;
    padding-right: 40px;
}

.language-dropdown:focus {
    outline: none;
    box-shadow: inset 0 0 0 1px #000;
}

.language-dropdown:hover {
    background-color: #f8f9fa;
}

.view-selector {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

.view-buttons {
    position: relative;
    display: flex;
    background: white;
    border-radius: 2px;
}

.view-btn {
    background: white;
    border: 1px solid #000;
    padding: 12px 24px;
    font-family: 'Oswald', sans-serif;
    font-size: 0.9rem;
    font-weight: 300;
    color: #000;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    z-index: 2;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 288px;
    border-radius: 2px;
}

.view-btn:first-child {
    border-right: none;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.view-btn:last-child {
    border-left: none;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.view-btn:hover {
    background-color: #f8f9fa;
}

.view-btn.active {
    color: #000;
    background-color: white;
}

.view-selector-indicator {
    position: absolute;
    top: -1px;
    left: -1px;
    height: calc(100% + 2px);
    width: calc(288px + 1px);
    border: 2px solid #000;
    border-radius: 2px;
    background: transparent;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 3;
    pointer-events: none;
}

.view-buttons[data-active="recent"] .view-selector-indicator {
    transform: translateX(calc(100% - 1px));
}

@media (max-width: 768px) {
    .view-selector {
        margin: 20px 0;
        padding: 0 15px;
    }
    
    .view-buttons {
        width: 100%;
    }
    
    .view-btn {
        flex: 1;
        min-width: 0;
        padding: 10px 16px;
        font-size: 0.8rem;
    }
    
    .view-selector-indicator {
        width: calc(50% + 1px);
    }
    
    .view-buttons[data-active="recent"] .view-selector-indicator {
        transform: translateX(calc(100% - 1px));
    }
}

main {
    flex: 1;
    min-height: 600px; /* Ensure main area has minimum height to prevent footer jumping */
}

.phrases-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    padding: 20px 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.phrases-grid.transitioning-out {
    opacity: 0;
    transform: translateY(-10px);
    min-height: 400px; /* Maintain minimum height during transition */
}

.phrase-card {
    background: white;
    border-radius: 2px;
    padding: 20px;
    box-shadow: none;
    border: 1px solid #000;
    transition: all 0.3s ease;
    cursor: pointer;
    opacity: 1;
    transform: translateY(0);
    font-weight: 300;
}

.phrase-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border-color: #000;
}

.phrase-card:active {
    transform: translateY(-3px);
}

.phrase-text {
    font-size: 1.1rem;
    font-weight: 300;
    color: #000;
    margin-bottom: 20px;
    min-height: 50px;
    display: flex;
    align-items: center;
}

.phrase-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.phrase-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    background-color: #000;
    color: white;
    padding: 4px 10px;
    border-radius: 2px;
    font-size: 0.75rem;
    font-weight: 300;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.voting-section {
    display: flex;
    align-items: center;
    gap: 10px;
}

.vote-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 35px;
    height: 35px;
}

.vote-btn:hover {
    background-color: #f8f9fa;
    transform: scale(1.1);
}

.upvote-btn:hover {
    color: #28a745;
    background-color: #d4edda;
}

.downvote-btn:hover {
    color: #dc3545;
    background-color: #f8d7da;
}

.vote-count {
    font-weight: 400;
    font-size: 1rem;
    color: #000;
    min-width: 30px;
    text-align: center;
}

footer {
    margin-top: 60px;
    padding: 30px 0;
    border-top: 1px solid #000;
    background-color: white;
    border-radius: 2px;
    margin-bottom: 20px;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    color: #666;
    flex-wrap: wrap;
    gap: 20px;
}

.footer-left {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.footer-right {
    display: flex;
    align-items: flex-start;
}

.stats-container {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.stat-number {
    font-size: 1.8rem;
    font-weight: 400;
    color: #000;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-label {
    font-size: 0.9rem;
    font-weight: 300;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.footer-content p {
    margin-bottom: 5px;
}

.footer-content strong {
    color: #000;
}

.contact-link {
    color: #000;
    text-decoration: none;
    transition: all 0.2s ease;
}

.contact-link:hover {
    text-decoration: underline;
}

.footer-links {
    display: flex;
    justify-content: flex-start;
    gap: 20px;
    margin-top: 10px;
}

.footer-link {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #666;
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 2px;
    transition: all 0.3s ease;
    font-weight: 300;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-size: 0.9rem;
}

.footer-link:hover {
    background-color: #f0f0f0;
    color: #000;
    transform: translateY(-1px);
}

.footer-link svg {
    transition: transform 0.3s ease;
}

.footer-link:hover svg {
    transform: scale(1.1);
}

/* Mobile responsiveness for footer */
@media (max-width: 768px) {
    .footer-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 30px;
    }
    
    .footer-left {
        align-items: center;
    }
    
    .footer-links {
        justify-content: center;
    }
    
    .stats-container {
        gap: 20px;
        justify-content: center;
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    h1 {
        font-size: 2.5rem;
    }
    
    h2 {
        font-size: 1.1rem;
    }
    
    .phrases-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .phrase-card {
        padding: 15px;
    }
    
    .header-actions {
        flex-direction: column;
        gap: 15px;
        align-items: center;
    }
    
    .search-language-row {
        display: flex;
        gap: 10px;
        width: 100%;
        align-items: center;
        justify-content: center;
        max-width: 100%;
    }
    
    .search-bar {
        min-width: 250px;
        flex: 1;
        max-width: 400px;
    }
    
    .language-dropdown {
        min-width: 50px;
        flex-shrink: 0;
    }
}

@media (max-width: 480px) {
    .search-language-row {
        gap: 8px;
        width: 100%;
    }
    
    .search-bar {
        min-width: 180px;
        flex: 1;
    }
    
    .language-dropdown {
        min-width: 50px;
        flex-shrink: 0;
    }
}

.loading {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 1.1rem;
    font-weight: 300;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.error {
    text-align: center;
    padding: 40px;
    color: #000;
    font-size: 1.1rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Infinite Scroll Loading Indicators */
.loading-more {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 20px;
    border-radius: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 1000;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.loading-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.load-more-error {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #dc3545;
    color: white;
    padding: 12px 20px;
    border-radius: 25px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 1000;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: slideInUp 0.3s ease-out;
}

.retry-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: white;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.retry-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.6);
}

@keyframes slideInUp {
    from {
        transform: translateX(-50%) translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

/* Smooth scrolling for better UX */
html {
    scroll-behavior: smooth;
}

/* Enhanced phrase cards for infinite scroll */
.phrase-card.fade-in {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.4s ease-out forwards;
}

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

