/* Custom styles for WordsLK Dictionary */

/* Google Sans font definition */
@font-face {
    font-family: 'Google Sans';
    src: url('../fonts/GoogleSans-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: 'Google Sans';
    src: url('../fonts/GoogleSans-Medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
}

@font-face {
    font-family: 'Google Sans';
    src: url('../fonts/GoogleSans-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
}

@font-face {
    font-family: 'Google Sans';
    src: url('../fonts/GoogleSans-Italic.ttf') format('truetype');
    font-weight: 400;
    font-style: italic;
}

@font-face {
    font-family: 'Google Sans';
    src: url('../fonts/GoogleSans-MediumItalic.ttf') format('truetype');
    font-weight: 500;
    font-style: italic;
}

@font-face {
    font-family: 'Google Sans';
    src: url('../fonts/GoogleSans-BoldItalic.ttf') format('truetype');
    font-weight: 700;
    font-style: italic;
}

/* Sinhala font support */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Sinhala:wght@400;500;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

/* Add @font-face rule for Malithi Web */
@font-face {
    font-family: 'Malithi Web';
    src: url('../fonts/Malithi Web Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap; /* Improves perceived performance */
}

body {
    /* Add 'Malithi Web' to the font stack */
    font-family: 'Poppins', 'Malithi web', 'Noto Sans Sinhala', sans-serif;
    background: linear-gradient(135deg, #f0f9ff 0%, #e6f2ff 100%);
    min-height: 100vh;
}

/* Typography enhancements */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Poppins', sans-serif;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

h1 {
    font-weight: 700;
}

h2, h3 {
    font-weight: 600;
}

.nav-link {
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    transition: all 0.2s ease;
}

.text-xl.font-bold {
    letter-spacing: -0.01em;
}

/* Logo styling */
.logo-text {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    letter-spacing: -0.03em;
}

/* Sinhala text font style */
.sinhala-text {
    font-family: 'Malithi Web', 'Noto Sans Sinhala', sans-serif;
    font-size: 1.35rem;  /* Base size */
    line-height: 1.5;
}

/* Modern search bar styling */
#search-input {
    border: none;
    box-shadow: none;
    background-color: white;
    transition: all 0.3s ease;
}

#search-input:focus {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.search-container {
    backdrop-filter: blur(10px);
    background-color: rgba(255, 255, 255, 0.8);
    transition: all 0.2s ease;
}

.search-container:focus-within {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

/* Adjust spacing for better layout */
.max-w-4xl.mx-auto.mb-16 {
    margin-bottom: 4rem;
}

main > div:first-child {
    margin-top: 2.5rem;
}

/* Gradient background */
.gradient-bg {
    background: #2563eb;
}

.random-word-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.random-word-card:hover {
    border-left-color: #2563eb;
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.random-word-card > div:last-child {
    margin-top: auto;
    padding-top: 0.75rem;
}

/* Feature card styling */
.feature-card {
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

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

.icon-container {
    transition: all 0.2s ease;
}

/* Bookmark highlight */
.bookmarked {
    background-color: rgba(37, 99, 235, 0.1);
    border-left: 3px solid #2563eb;
    padding-left: 0.5rem;
}

/* Search suggestions */
#suggestions {
    max-height: 300px;
    overflow-y: auto;
    border-radius: 0.75rem;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 50;
    margin-top: 0.5rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
    border: 1px solid #d1d5db;
    background-color: white;
}

/* Fix for search container overflow issues */
.max-w-3xl.bg-white {
    overflow: visible !important;
    z-index: 40;
    position: relative;
}

.p-6.overflow-visible {
    overflow: visible !important;
    z-index: 30;
}

/* Make suggestion items more visible and prevent clipping */
.suggestion-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid #e5e7eb;
    background-color: white;
    transition: all 0.2s ease;
    color: #374151;
    font-weight: 500;
    text-align: left;
    display: block;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.suggestion-item.text-center {
    text-align: center;
}

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

.suggestion-item:hover {
    background-color: #f0f7ff;
    color: #2563eb;
}

.suggestion-item:first-child {
    border-top-left-radius: 0.75rem;
    border-top-right-radius: 0.75rem;
}

.suggestion-item:last-child {
    border-bottom-left-radius: 0.75rem;
    border-bottom-right-radius: 0.75rem;
}

.suggestion-item .sinhala-text,
.suggestion-item .tamil-text {
    color: #1f2937;
    font-weight: 500;
    font-size: 1.1rem; /* Adjusted for suggestion items */
}

/* Dictionary result styling */
.word-card {
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

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

.word-card h2, .word-card h3 {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    letter-spacing: -0.02em;
}

/* Button styling */
button, .btn, input[type="submit"] {
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    letter-spacing: 0.01em;
    transition: all 0.2s ease;
}

.part-of-speech {
    display: inline-block;
    font-size: 0.75rem;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    background-color: #dbeafe;
    color: #1e40af;
}

/* Recent searches menu dropdown */
.recent-searches-container {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 320px;
    z-index: 40;
    transform: scale(0.95);
    opacity: 0;
    transform-origin: bottom right;
    pointer-events: none;
    transition: all 0.2s ease;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.recent-searches-container.show {
    transform: scale(1);
    opacity: 1;
    pointer-events: auto;
}

/* Folder cards styling */
.folder-card {
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
}

.folder-card:hover {
    border-color: #2563eb;
    transform: translateY(-2px);
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #2563eb;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #1e40af;
}

/* Material icons sizing for consistency */
.material-icons {
    font-size: 24px;
    line-height: 1;
}

/* Popup styling */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 50;
    display: flex;
    justify-content: center;
    align-items: center;
}

.popup-content {
    background-color: white;
    border-radius: 0.75rem;
    max-width: 90%;
    width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

/* History page styling */
.history-item {
    border-radius: 0.5rem;
    transition: all 0.2s ease;
}

.history-item:hover {
    background-color: #f3f4f6;
    transform: translateY(-2px);
}

/* Profile page styling */
.profile-section {
    border-radius: 0.75rem;
    background-color: #f9fafb;
    transition: all 0.2s ease;
}

.profile-section:hover {
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.05);
}

/* Navigation styling enhancement */
nav {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%) !important;
}

.nav-link.active {
    background-color: rgba(255, 255, 255, 0.2);
}

.menu-icon {
    vertical-align: middle;
    margin-right: 0.5rem;
    font-size: 20px;
}

/* Language tabs styling */
.language-tab {
    position: relative;
    transition: all 0.3s ease;
    color: #64748b;
    font-weight: 500;
}

.language-tab.active {
    color: #2563eb;
    border-bottom: 2px solid #2563eb;
    font-weight: 600;
    background-color: transparent;
}

.language-tab:hover {
    color: #334155;
}

.language-tab .material-icons {
    opacity: 0.8;
    transition: opacity 0.2s ease;
    vertical-align: middle;
    font-size: 16px;
}

.language-tab:hover .material-icons,
.language-tab.active .material-icons {
    opacity: 1;
}

/* Search input styling */
.search-input {
    transition: all 0.3s ease;
    border: 1px solid #e2e8f0;
}

.search-input:focus {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
    border-color: #2563eb;
}

/* Responsive design improvements */
@media (max-width: 768px) {
    .grid.md\:grid-cols-3 {
        grid-template-columns: 1fr;
    }
    
    .sinhala-text {
        font-size: 1.2rem;  /* Consistent mobile size */
    }
    
    h1 {
        font-size: 2.5rem !important;
    }
    
    .recent-searches-container {
        width: 300px;
    }
    
    /* Fix oversized headings on mobile - make them much smaller */
    h1.text-2xl, h1.text-3xl, main h1, .max-w-2xl h1, .max-w-4xl h1, .max-w-5xl h1 {
        font-size: 1.2rem !important;
        line-height: 1.2 !important;
    }
    
    h2.text-2xl, h2.text-xl {
        font-size: 1.1rem !important;
        line-height: 1.2 !important;
    }
    
    /* Make the logo text smaller on mobile */
    .logo-text {
        font-size: 1.25rem !important;
    }
    
    /* Ensure the nav title is properly sized */
    nav .logo-text, 
    nav h1 {
        font-size: 1.25rem !important;
    }
    
    /* Fix "Create an Account" and other main titles */
    .text-3xl, .text-2xl {
        font-size: 1.2rem !important;
        line-height: 1.2 !important;
    }
    
    /* Remove unsupported selectors and use direct targeting instead */
    /* Auth pages, bookmark pages, history pages */
    #profile-heading,
    #bookmarks-heading,
    #history-heading,
    #create-account-heading {
        font-size: 1.2rem !important;
        line-height: 1.2 !important;
    }
    
    /* General fix for all page titles in mobile view */
    .container h1 {
        font-size: 1.2rem !important;
        line-height: 1.2 !important;
    }
    
    /* Adjust Sinhala text size for better display on mobile */
    .sinhala-text {
        font-size: 1.5rem;
    }
    
    /* Additional specific targeting for page headers in mobile view */
    .max-w-4xl h1:first-of-type,
    .max-w-5xl h1:first-of-type,
    .max-w-3xl h1:first-of-type,
    .max-w-md h1:first-of-type {
        font-size: 1.1rem !important;
        line-height: 1.2 !important;
        letter-spacing: -0.01em;
        font-weight: 600 !important;
        margin-bottom: 0.5rem;
    }
    
    /* Extra specific selectors for different pages */
    .text-center h1.text-blue-600,
    .bg-white h1.text-blue-600,
    .history-page-title,
    .bookmarks-page-title,
    .profile-page-title {
        font-size: 1.1rem !important;
        line-height: 1.2 !important;
    }
    
    /* Special override for history page title */
    h1#history-heading {
        font-size: 1rem !important;
    }
    
    /* Override the index page title only */
    .max-w-4xl.mx-auto.mb-16.mt-8 h1.text-5xl {
        font-size: 2.5rem !important;
    }
}

/* Multiple meanings styling */
.part-of-speech {
    display: inline-block;
    font-size: 0.85rem;
    padding: 0.2rem 0.5rem;
    background-color: #dbeafe;
    color: #1d4ed8;
    border-radius: 0.25rem;
    font-weight: 500;
}

.sinhala-text {
    font-family: 'Malithi Web', sans-serif;
    font-size: 1.35rem;  /* Match the main sinhala-text size */
    line-height: 1.6;
}

.word-card {
    padding: 1.25rem;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    border-left: 4px solid transparent;
}

.word-card:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.word-card.bookmarked {
    border-left-color: #1e40af;
    background-color: #f0f7ff;
}

/* Enhanced meaning card styling */
.meanings-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    margin-left: 1rem;
    margin-top: 0.5rem;
}

/* 2-column grid for desktop */
@media (min-width: 768px) {
    .meanings-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.meaning-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background-color: #dbeafe;
    color: #1e40af;
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: 600;
}

.meaning-card {
    transition: all 0.2s ease;
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.meaning-card:hover {
    transform: translateX(4px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.meaning-card .sinhala-text {
    font-size: 1.25rem;  /* Slightly smaller for meaning cards */
    margin-left: 32px;
    margin-top: 0.5rem;
}

.meaning-card .part-of-speech {
    background-color: #f0f9ff;
    color: #0369a1;
}

/* Different border colors for each meaning position */
.meaning-card:nth-child(1) { border-left-color: #2563eb; }
.meaning-card:nth-child(2) { border-left-color: #0ea5e9; }
.meaning-card:nth-child(3) { border-left-color: #8b5cf6; }
.meaning-card:nth-child(4) { border-left-color: #ec4899; }
.meaning-card:nth-child(5) { border-left-color: #f59e0b; }
.meaning-card:nth-child(6) { border-left-color: #ef4444; }
.meaning-card:nth-child(7) { border-left-color: #14b8a6; }
.meaning-card:nth-child(8) { border-left-color: #6366f1; }
.meaning-card:nth-child(9) { border-left-color: #f97316; }
.meaning-card:nth-child(10) { border-left-color: #84cc16; }

/* Responsive adjustments */
@media (max-width: 640px) {
    .meanings-grid {
        grid-template-columns: 1fr;
        margin-left: 0.5rem;
    }
    
    .meaning-card {
        padding: 0.75rem;
    }
    
    .meaning-card .sinhala-text {
        margin-left: 28px;
        /* Font size will inherit from the @media (max-width: 768px) rule (1.2rem) */
    }
}

/* Add these styles for bookmarked word headers */
.bookmarked-word {
    padding-left: 1rem;
    transition: background-color 0.3s ease;
}

.bookmarked-word h2 {
    color: #1e40af;
}