@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700&display=swap');

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

html, body {
    background-color: #fce38b;
    min-height: 100vh;
}

body {
    font-family: 'Poppins', sans-serif !important;
    line-height: 1.6;
    color: #333;
}

header {
    background: #99d2ed;
    padding: 1rem;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: relative;
    padding-top: 2.5rem;
}

.powered-by {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.7rem;
    color: #fff;
}

.powered-by img {
    width: 50px;
    height: auto;
}

h1 {
    font-family: 'Poppins', sans-serif !important;
    font-size: 3.5rem;
    margin-bottom: 0.5rem;
    font-weight: 700 !important;
    color: #fce38b;
    letter-spacing: -0.02em;
    line-height: 0.9;  /* Tighter line height */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.subtitle {
    color: #fff;
    margin-bottom: 0.8rem;
    font-size: 1.1rem;  /* Increased from 0.9rem */
    font-family: 'Poppins', sans-serif !important;
    font-weight: 300;
    line-height: 1.2;
}

.search-container {
    max-width: 600px;
    margin: 0.5rem auto;
    display: flex;
    gap: 0.5rem;
}

input, select {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    font-family: 'Poppins', sans-serif !important;
    font-weight: 300;
}

input::placeholder {
    font-family: 'Poppins', sans-serif !important;
    font-weight: 300;
    color: #666;
}

select {
    cursor: pointer;
}

#searchInput {
    flex: 1;
}

.terms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

.term-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    cursor: pointer;
}

.term-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

.term-image {
    width: 100%;
    height: 100px;
    object-fit: cover;
}

.term-content {
    padding: 0.8rem;
}

.term-title {
    font-family: 'Poppins', sans-serif !important;
    font-size: 1rem;
    margin-bottom: 0.3rem;
    font-weight: 600 !important;
}

.term-category {
    font-size: 0.7rem;
    color: #666;
    margin-bottom: 0.5rem;
    font-family: 'Poppins', sans-serif !important;
    font-weight: 300;
}

.term-definition {
    font-size: 0.8rem;
    color: #333;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-family: 'Poppins', sans-serif !important;
    font-weight: 300;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    display: flex;
    gap: 2rem;
}

.carousel {
    flex: 1;
    position: relative;
    min-width: 300px;
}

.carousel-images {
    width: 100%;
    height: 300px;
    position: relative;
    border-radius: 4px;
    overflow: hidden;
}

.modal-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.3s;
}

.modal-image.active {
    opacity: 1;
}

.carousel-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.8);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s;
}

.carousel-button:hover {
    background: white;
}

.carousel-button.prev {
    left: 10px;
}

.carousel-button.next {
    right: 10px;
}

.carousel-dots {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: background-color 0.3s;
}

.dot.active {
    background: white;
}

.modal-text {
    flex: 1;
}

.modal-text h2 {
    font-family: 'Poppins', sans-serif !important;
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    font-weight: 600 !important;
}

.modal-text .pronunciation {
    color: #666;
    font-style: italic;
    margin-bottom: 1rem;
    font-family: 'Poppins', sans-serif !important;
    font-weight: 300;
}

.modal-text .category {
    display: inline-block;
    background: #f0f0f0;
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
    font-size: 0.8rem;
    margin-bottom: 1rem;
    font-family: 'Poppins', sans-serif !important;
    font-weight: 400;
}

.modal-text .definition {
    font-size: 1rem;
    line-height: 1.6;
    font-family: 'Poppins', sans-serif !important;
    font-weight: 300;
}

.close-button {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    z-index: 1;
}

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

@media (max-width: 768px) {
    header {
        padding-top: 3rem;
        padding-bottom: 1rem;
    }

    h1 {
        font-size: 1.8rem;
        margin-bottom: 0.3rem;
        line-height: 0.9;  /* Even tighter line height for mobile */
        letter-spacing: 0;
    }

    .subtitle {
        font-size: 0.9rem;
        margin-bottom: 0.6rem;
        line-height: 1.2;
    }

    .search-container {
        flex-direction: column;
        padding: 0 1rem;
        margin-top: 0.3rem;
    }

    #searchInput,
    #categoryFilter {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .modal-content {
        flex-direction: column;
        padding: 1.5rem;
    }
    
    .carousel {
        width: 100%;
    }
    
    .carousel-images {
        height: 200px;
    }

    .term-image {
        height: 180px;
    }
    
    .terms-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 0.8rem;
        padding: 0.8rem;
    }
}