:root {
    --primary-color: #1e293b;
    --secondary-color: #1564C7;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-color: #334155;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    
    --wr-blue: #ebf5ff; /* WordReference style blue column */
    --wr-blue-text: #1e3a8a;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Header & Navigation */
.app-header {
    background: #ffffff;
    color: var(--text-color);
    padding: 1rem 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    border-bottom: 1px solid var(--border-color);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.languages-nav {
    display: flex;
    gap: 0.5rem;
}

.lang-flag img, .flag-icon {
    width: 16px;
    height: 11px;
    border-radius: 2px;
    transition: transform 0.2s ease;
    border: 1px solid rgba(0,0,0,0.1);
    object-fit: cover;
}

.lang-flag:hover img {
    opacity: 1;
    transform: translateY(-2px);
}

/* Main Content Wrapper */
.main-content {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1.5rem;
    min-height: 70vh;
}

/* Search Bar Component */
.search-container {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
    text-align: center;
}

.search-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
}

.search-input-wrapper {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    gap: 0.5rem;
}

.search-input {
    width: 100%;
    padding: 1rem 1.25rem;
    font-size: 1.1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    font-family: inherit;
}

.search-input:focus {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-btn {
    background: var(--secondary-color);
    color: white;
    border: none;
    padding: 0 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.search-btn:hover {
    background: #2563eb;
}

/* WordReference Style Dictionary Table */
.dict-table-container {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    overflow: hidden;
    margin-bottom: 2rem;
    animation: fadeIn 0.4s ease;
}

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

.dict-table {
    width: 100%;
    border-collapse: collapse;
}

.dict-table th {
    background-color: var(--primary-color);
    color: white;
    text-align: left;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.dict-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: top;
}

/* The left Spanish column */
.dict-table .col-source {
    width: 35%;
    background-color: var(--wr-blue);
    border-right: 2px solid var(--border-color);
}

/* The right Translation column */
.dict-table .col-target {
    width: 65%;
}

.term-source {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--wr-blue-text);
    display: block;
    margin-bottom: 0.25rem;
}

.term-type {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
}

.term-target {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary-color);
    display: inline-block;
    margin-bottom: 0.5rem;
}

.term-pronunciation {
    font-family: monospace;
    color: var(--secondary-color);
    background: #f1f5f9;
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
    margin-left: 0.5rem;
    font-size: 0.9rem;
}

.term-definition {
    font-size: 0.95rem;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.term-example {
    font-size: 0.95rem;
    color: var(--text-muted);
    border-left: 3px solid var(--secondary-color);
    padding-left: 0.75rem;
    background: #f8fafc;
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
    margin-top: 0.5rem;
}

a.translation-link:hover {
    color: var(--secondary-color);
}

/* Footer */
.site-footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    border-top: 1px solid var(--border-color);
    margin-top: 4rem;
}

/* Responsive */
@media (max-width: 768px) {
    .dict-table, .dict-table tbody, .dict-table tr, .dict-table td {
        display: block;
        width: 100%;
    }
    
    .dict-table thead {
        display: none;
    }
    
    .dict-table tr {
        border-bottom: 2px solid var(--border-color);
    }
    
    .dict-table td {
        border-bottom: none;
        padding: 0.75rem 1rem;
    }
    
    .dict-table .col-source {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .search-input-wrapper {
        flex-direction: column;
    }
    
    .search-btn {
        padding: 1rem;
    }
}

/* Custom Pagination Styles */
nav[role="navigation"] {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.25rem;
    margin-top: 2rem;
}
nav[role="navigation"] > div {
    display: flex;
    gap: 0.25rem;
}
nav[role="navigation"] a, nav[role="navigation"] span.relative {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: white;
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}
nav[role="navigation"] span[aria-current="page"] > span, nav[role="navigation"] span[aria-current="page"] {
    background: var(--primary-color) !important;
    color: white !important;
    border-color: var(--primary-color) !important;
}
nav[role="navigation"] a:hover {
    background: #f8fafc;
    color: var(--primary-color);
}
nav[role="navigation"] svg {
    height: 1.25rem;
    width: 1.25rem;
}
.hidden { display: none !important; }

/* Clean Professional Homepage Styles */
.hero-section {
    position: relative;
    padding: 4rem 2rem 1rem;
    background: transparent;
    margin-bottom: 2rem;
}

.hero-split {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    text-align: left;
    gap: 3rem;
}

.hero-content {
    flex: 1;
    max-width: 580px;
}

.hero-title {
    color: #0f172a;
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    letter-spacing: -0.03em;
    line-height: 1.1;
}

.hero-subtitle {
    color: #475569;
    font-size: 1.15rem;
    margin-bottom: 2.5rem;
    font-weight: 400;
    line-height: 1.6;
}

.hero-graphic {
    flex: 1;
    position: relative;
    height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.map-bg {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: radial-gradient(#cbd5e1 2px, transparent 2px);
    background-size: 20px 20px;
    opacity: 0.6;
    mask-image: radial-gradient(ellipse at center, black 30%, transparent 70%);
    -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 70%);
}

.speech-bubble {
    position: absolute;
    padding: 0.8rem 1.5rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: 1.15rem;
    box-shadow: 0 10px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);
    animation: float 6s ease-in-out infinite;
    z-index: 2;
}

.bubble-1 {
    top: 15%; right: 40%;
    background: var(--secondary-color); color: white;
    animation-delay: 0s;
}
.bubble-1::after {
    content: ''; position: absolute; bottom: -8px; left: 20px;
    border-width: 10px 10px 0 0; border-style: solid; border-color: var(--secondary-color) transparent transparent transparent;
}

.bubble-2 {
    top: 40%; left: 10%;
    background: white; color: #0f172a;
    animation-delay: 1s;
}
.bubble-2::after {
    content: ''; position: absolute; bottom: -8px; left: 20px;
    border-width: 10px 10px 0 0; border-style: solid; border-color: white transparent transparent transparent;
}

.bubble-3 {
    top: 50%; right: 10%;
    background: #1c75e8; color: white;
    animation-delay: 2s;
}
.bubble-3::after {
    content: ''; position: absolute; bottom: -8px; left: 20px;
    border-width: 10px 10px 0 0; border-style: solid; border-color: #1c75e8 transparent transparent transparent;
}

.bubble-4 {
    bottom: 10%; right: 30%;
    background: white; color: #0f172a;
    animation-delay: 3s;
}
.bubble-4::after {
    content: ''; position: absolute; bottom: -8px; left: 20px;
    border-width: 10px 10px 0 0; border-style: solid; border-color: white transparent transparent transparent;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
}

.hero-search-container {
    width: 100%;
    max-width: 850px;
    margin: -3rem auto 3rem auto;
    position: relative;
    z-index: 30;
}

@media (max-width: 900px) {
    .hero-split {
        flex-direction: column;
        text-align: center;
        gap: 2rem;
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-subtitle {
        font-size: 1.05rem;
    }

    .hero-search-container {
        margin-top: 0;
    }
    
    .clean-search-form {
        flex-direction: column;
    }
    
    .clean-btn {
        width: 100%;
        justify-content: center;
    }
    .hero-graphic {
        width: 100%;
        height: 280px;
        margin-top: 1rem;
    }
    .clean-search-wrapper { margin: 0 auto; }
}

@media (max-width: 600px) {
    .hero-title {
        font-size: 2rem;
    }
    .hero-subtitle {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }
    .clean-search-form {
        flex-direction: column;
        border-radius: 12px;
    }
    .clean-input {
        width: 100%;
        text-align: center;
        padding: 1rem;
        border-bottom: 1px solid var(--border-color);
    }
    .clean-btn {
        width: 100%;
        padding: 1rem;
        border-radius: 0 0 12px 12px;
    }
    .speech-bubble {
        font-size: 0.85rem;
        padding: 0.4rem 0.8rem;
    }
    .bubble-1 { top: 5%; right: 5%; }
    .bubble-2 { top: 40%; left: 0%; }
    .bubble-3 { top: 55%; right: 0%; }
    .bubble-4 { bottom: 5%; right: 40%; }
    .hero-graphic { height: 220px; }
}

.clean-search-wrapper {
    width: 100%;
    max-width: 650px;
    position: relative;
    z-index: 20;
}

.clean-search-form {
    display: flex;
    background: white;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    overflow: hidden;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.clean-search-form:focus-within {
    border-color: var(--secondary-color);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.clean-input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 1.25rem 1.5rem;
    font-size: 1.1rem;
    outline: none;
    color: var(--primary-color);
}

.clean-input::placeholder {
    color: #94a3b8;
}

.clean-btn {
    background: var(--secondary-color);
    color: white;
    border: none;
    padding: 0 2rem;
    font-weight: 600;
    font-size: 1.05rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.clean-btn:hover {
    background: #0f489c;
}

.seo-card-premium {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 1px 3px 0 rgba(0,0,0,0.05), 0 1px 2px 0 rgba(0,0,0,0.03);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.seo-card-premium:hover {
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03);
    border-color: #cbd5e1;
}

.seo-card-premium h2 {
    font-size: 1.15rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 0.75rem;
}

.seo-list-item {
    padding: 0.4rem 0;
    font-size: 0.95rem;
}

.seo-list-item a {
    color: var(--text-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    transition: color 0.15s ease;
}

.seo-list-item:hover a {
    color: var(--secondary-color);
}

/* Responsive Header Fixes */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .header-content > div {
        flex-direction: column;
        gap: 1rem !important;
        width: 100%;
    }
    
    .main-nav {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 1rem !important;
    }
    
    .languages-nav {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        padding-top: 0.5rem;
        border-top: 1px solid var(--border-color);
    }
    
    .hero-section {
        padding: 2rem 1rem;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .clean-search-form {
        flex-direction: column;
        background: transparent;
        border: none;
        box-shadow: none;
    }
    
    .clean-input {
        background: white;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        margin-bottom: 0.5rem;
        box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    }
    
    .clean-btn {
        width: 100%;
        padding: 1rem;
        border-radius: 8px;
    }
}

/* Nav Links & Dropdown (Refactored from inline) */
.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}
.nav-link:hover {
    color: var(--primary-color);
}
.nav-link.active {
    color: var(--secondary-color);
}

.lang-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s;
}
.lang-dropdown-btn:hover {
    background: white;
    box-shadow: var(--shadow-sm);
}
.lang-dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 110%;
    background: white;
    min-width: 200px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    padding: 0.5rem;
    z-index: 50;
    max-height: 400px;
    overflow-y: auto;
}
.lang-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    color: var(--text-color);
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.2s;
}
.lang-menu-item:hover {
    background: #f1f5f9;
}

/* Pagination Buttons */
.page-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--secondary-color);
    background: white;
    border: 1px solid var(--secondary-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}
.page-btn:hover:not(:disabled) {
    background: #eff6ff;
}
.page-btn-disabled {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: not-allowed;
}
.page-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    color: #475569;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}
.page-num:hover {
    background: #f1f5f9;
}
.page-num.active {
    background: var(--secondary-color);
    color: white;
    font-weight: 600;
}

/* Translation & Related Terms */
.translation-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    text-decoration: none;
    color: #0f172a;
    transition: all 0.2s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.translation-card:hover {
    background: white;
    border-color: #94a3b8;
    transform: translateY(-2px);
}
.related-tag {
    background: #fef2f2;
    color: #ef4444;
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
    text-decoration: none;
    border: 1px solid #fecaca;
    transition: all 0.2s;
}
.related-tag:hover {
    border-color: #fca5a5;
    background: #fee2e2;
}
