/* ========================================
   CSS VARIABLES - DESIGN SYSTEM
   ======================================== */
:root {
    /* Primary Brand Colors */
    --primary-color: #007bff;
    --primary-dark: #0056b3;
    --primary-light: #00c6ff;
    --primary-lighter: #0096e6;

    /* Accent Colors */
    --accent-magenta: #FF00FB;    /* First phoneme */
    --accent-orange: #FF8400;     /* Second phoneme */
    --error-color: #dc3545;       /* Validation errors */

    /* Neutral Colors */
    --white: #ffffff;
    --black: #000000;
    --text-dark: #333333;
    --text-medium: #aaa;
    --text-light: rgba(235, 235, 235, 0.52);

    /* Background Colors */
    --bg-body: #f4f7fa;
    --bg-light: #f9f9f9;
    --bg-lighter: #f1f9ff;
    --bg-white: #ffffff;

    /* Border Colors */
    --border-light: #dddddd;
    --border-medium: #e0e0e0;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    --gradient-primary-hover: linear-gradient(135deg, var(--primary-dark), var(--primary-lighter));

    /* Shadows */
    --shadow-sm: 0 4px 8px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 6px 15px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 8px 20px rgba(0, 123, 255, 0.3);
    --shadow-btn: 0 10px 20px rgba(0, 123, 255, 0.3);
    --shadow-error: 0 8px 20px rgba(220, 53, 69, 0.3);

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 50px;
}

/* General Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Gentium Book Plus', serif;
    font-variant-ligatures: no-common-ligatures;

}

html {
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100%;
}

body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    width: 100%;
    display: flex;
    flex-direction: column;
    font-size: 18px;
    background-color: var(--bg-body);
    color: var(--text-dark);
    text-align: center;
}

.container {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
}

/* Accessibility - Visually Hidden Elements */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Skip Navigation Link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary-color);
    color: var(--white);
    padding: 8px;
    text-decoration: none;
    z-index: 10000;
}

.skip-link:focus {
    top: 0;
}

/* Improved Focus Indicators */
a:focus, button:focus, input:focus, select:focus, textarea:focus {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

button:focus, .btn:focus {
    outline: 3px solid var(--primary-dark);
    outline-offset: 2px;
}

/* Navbar */
.navbar {
    flex-shrink: 0;
    padding: 20px 30px;
    background: var(--gradient-primary);
    color: var(--white);
    text-align: center;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
}

.navbar-links {
    list-style: none;
    display: flex;
    gap: 20px;
}

.navbar-links li a {
    color: var(--white);
    text-decoration: none;
    font-size: 1rem;
    transition: color 0.3s ease;
}

.navbar-links li a:hover {
    color: var(--primary-light);
}

/* Container */
.container {
    display: inline-block;
    max-width: 95%;
    min-width: 50%;
    margin: 20px auto;
    background-color: var(--bg-white);
    box-shadow: var(--shadow-md);
    border-radius: var(--radius-md);
    overflow: overlay;
    animation: fadeInUp 0.8s ease-in-out;
}

/* Make container wider for contact page */
body.contact-page .container {
    max-width: 1200px !important;
    min-width: 90% !important;
    width: 90% !important;
    display: block !important;
}

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

h1 a {
    text-decoration: none;  /* Removes the underline */
    color: inherit;         /* Inherits the text color of the parent (h1) */
  }

.navbar h1 {
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: 1.2px;
    animation: slideIn 0.6s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(-50%);
    }
    to {
        transform: translateX(0);
    }
}

/* Main Content */
main {
    padding: 20px;
    text-align: center;
}

main h2 {
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 0.3em;
    line-height: 1.5;
}

main h2 span {
    color: var(--primary-color);
    white-space: nowrap;
}

main h2 a {
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
}

/* Search Form */
form {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 25px 0 25px 0;
    position: relative;
}

form * {
    min-width: 0;
    flex-grow: 1;
    flex-shrink: 1;
}

/* Dice link in search forms */
.dice-link {
    font-size: 1.5rem;
    margin-left: 10px;
    padding: 8px;
    text-decoration: none;
    transition: transform 0.3s ease, opacity 0.3s ease;
    opacity: 0.7;
    flex-grow: 0;
    flex-shrink: 0;
    min-width: auto;
}

.dice-link:hover {
    transform: scale(1.3) rotate(15deg);
    opacity: 1;
}

strong {
    color: var(--primary-color);
}

.first_phoneme {
    color: var(--accent-magenta);
}

.second_phoneme {
    color: var(--accent-orange);
}

.search-bar {
    padding: 15px 20px;
    font-size: 1rem;
    border: 2px solid var(--primary-color);
    border-radius: var(--radius-lg);
    outline: none;
    flex-grow: 1;
    max-width: 400px;
    transition: 0.3s ease;
    box-shadow: var(--shadow-sm);
    background-color: var(--bg-body);
    color: var(--text-dark);
}

.search-bar:focus {
    border-color: var(--primary-dark);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

/* Search Button */
.btn {
    padding: 15px;
    max-width: 200px;
    margin-left: 10px;
    text-decoration: none;
    background: var(--gradient-primary);
    color: var(--white);
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.4s ease, box-shadow 0.4s ease, transform 0.4s ease;
}

.btn:hover {
    background: var(--gradient-primary-hover);
    box-shadow: var(--shadow-btn);
    transform: translateY(-3px);
}

/* Results Section */
.results {
    animation: fadeIn 1.2s ease-in-out;
}

/* Spacing for no-results section */
.results p {
    margin-bottom: 25px;
}

.results .btn {
    margin-top: 10px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    animation: fadeInUp 1.2s ease;
}

table th, table td {
    padding: 15px 0px;
    border: 1px solid var(--border-light);
    font-size: 1rem;
    word-break: break-word;
    hyphens: auto;
}

table th {
    background-color: var(--primary-color);
    color: var(--white);
    font-weight: bold;
    text-align: left;
    animation: grow 0.8s ease;
    cursor: pointer;
    text-align: center;
}

table th:hover {background-color: var(--border-light);}

select {
    display: flex;
    margin: 10px;
    padding: 15px 20px;
    font-size: 1rem;
    border: 2px solid var(--primary-color);
    border-radius: var(--radius-lg);
    outline: none;
    flex-grow: 1;
    max-width: 200px;
    transition: 0.3s ease;
    box-shadow: var(--shadow-sm);
    background-color: var(--bg-body);
    color: var(--text-dark);
}

select:focus {
    border-color: var(--primary-dark);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

select:invalid {
    border-color: var(--error-color);
}

select:invalid:focus {
    border-color: var(--error-color);
    box-shadow: var(--shadow-error);
}


@keyframes grow {
    from {
        transform: scale(0.8);
    }
    to {
        transform: scale(1);
    }
}

table tbody tr:hover {
    background-color: var(--bg-lighter);
    transition: background-color 0.3s ease;
}

table tbody tr:nth-child(odd) {
    background-color: var(--bg-light);
}

/* Table word links styling */
table td a[href^="/mot/"] {
    color: var(--text-dark);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.25s ease, transform 0.25s ease;
    display: inline-block;
}

/* Footer */
footer {
    flex-shrink: 0;
    text-align: center;
    padding: 15px 0 8px 0;
    background: var(--gradient-primary);
    color: white;
    border-radius: 12px 12px 0 0 ;
    box-shadow: 0 -4px 8px rgba(0, 0, 0, 0.1);
    margin-top: auto;
}

footer p {
    font-size: 1rem;
    margin: 5px 0;
}

footer a {
    color: white;
    text-decoration: underline;
    transition: opacity 0.2s ease;
}

footer a:hover {
    opacity: 0.8;
}

.report-issue-link-footer {
    opacity: 0.7;
}

.report-issue-link-footer:hover {
    opacity: 1;
}

.sorted-asc::after {
    content: " ▲";
}
.sorted-desc::after {
    content: " ▼";
}

a {
    display: inline-block;
    text-decoration: none;
}

a:hover {
    color: var(--primary-color);
    transform: scale(1.2);
    transition: transform 0.25s ease;
}

/* IPA links - preserve parent color styling */
a.ipa-link {
    color: var(--text-medium);
    text-decoration: none;
}

a.ipa-link:hover {
    color: var(--primary-color);
    transition: transform 0.25s ease;
}

/* Results wrapper */
.results-wrapper {
    position: relative;
}

/* IPA selector dropdown for words with multiple pronunciations */
#ipa-selector {
    color: var(--text-medium);
    /* font-size: 0.9em; */
    font-family: inherit;
    background-color: transparent;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 0.2em 0.5em;
    cursor: pointer;
    margin: 0;
    flex-shrink: 0;
    max-width: 200px;
}

#ipa-selector:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
    transition: all 0.25s ease;
}

#ipa-selector:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}


/* Citation Button */
.cite-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
    border-radius: 50px;
}

.cite-btn:hover {
    background-color: var(--primary-dark);
}

/* Modal Styles */
.modal {
    display: none; /* Hidden by default */
    position: fixed;
    z-index: 1;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4); /* Black background with opacity */
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: var(--bg-white);
    margin: auto;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
    width: 80%;
    max-width: 600px;
    text-align: left;
    animation: fadeInUp 0.5s ease-in-out;
}

.modal-content h2, .modal-content h3 {
    color: var(--primary-color);
}

.modal-content p, .modal-content pre {
    font-family: 'Gentium Book Plus', serif;
    font-size: 1rem;
    color: var(--text-dark);
    background-color: #f4f7fa;
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 15px;
}

.close-btn {
    color: var(--text-medium);
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-btn:hover, .close-btn:focus {
    color: var(--black);
    text-decoration: none;
    cursor: pointer;
}

/* Graph Toggle Button */
#toggle-graph-button {
    margin: 20px auto;
    display: block;
    animation: fadeInUp 0.6s ease-in-out;
    transition: all 0.3s ease;
}

#toggle-graph-button:hover {
    transform: translateY(-2px);
}

#viz-wrapper {
    width: 100%;
    height: 600px;
    position: relative;
    border: 2px solid var(--border-light);
    border-radius: var(--radius-md);
    background: var(--bg-white);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: box-shadow 0.3s ease, border-color 0.3s ease, opacity 0.4s ease, transform 0.4s ease;
    margin: 20px 0;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease-in-out forwards;
}

#viz-wrapper[style*="display: block"] {
    display: block !important;
    opacity: 1;
    transform: translateY(0);
}

#viz-wrapper:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

#viz {
    width: 100%;
    height: 100%;
    position: relative;
    background: linear-gradient(135deg, var(--bg-body) 0%, var(--bg-white) 100%);
}

#viz canvas {
    position: relative !important;
    z-index: 1 !important;
    transition: opacity 0.3s ease;
}

/* Graph node hover effects */
.vis-network {
    cursor: default;
}

.vis-network .vis-node {
    transition: transform 0.2s ease, filter 0.2s ease;
}

.vis-network .vis-node:hover {
    filter: brightness(1.08);
}

.vis-network .vis-node.vis-selected {
    filter: brightness(1.12);
    transform: scale(1.03);
}

/* Graph edge hover effects */
.vis-network .vis-edge {
    transition: opacity 0.2s ease, filter 0.2s ease;
}

.vis-network .vis-edge:hover {
    opacity: 1 !important;
}

.vis-network .vis-edge.vis-selected {
    opacity: 1 !important;
    filter: drop-shadow(0 2px 4px rgba(124, 58, 237, 0.3));
}

/* Graph label improvements */
.vis-network .vis-label {
    font-family: 'Gentium Book Plus', serif !important;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

/* Smooth animations for graph interactions */
.vis-network .vis-manipulation {
    background: var(--bg-white);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
}

/* Graph Loading Spinner */
.graph-spinner-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(241, 249, 255, 0.98) 100%);
    backdrop-filter: blur(4px);
    z-index: 9999 !important;
    pointer-events: none;
    border-radius: var(--radius-md);
    animation: fadeIn 0.3s ease-in-out;
}

.graph-spinner {
    width: 60px;
    height: 60px;
    border: 6px solid var(--border-medium);
    border-top: 6px solid var(--primary-color);
    border-right: 6px solid var(--primary-light);
    border-radius: 50%;
    animation: spinAndPulse 0.75s linear infinite;
    position: relative;
    z-index: 10000 !important;
    pointer-events: auto;
    box-shadow: var(--shadow-md);
}

.graph-spinner-text {
    margin-top: 20px;
    font-size: 1.1rem;
    color: var(--primary-color);
    font-weight: 600;
    text-align: center;
    position: relative;
    z-index: 10000 !important;
    pointer-events: auto;
    animation: fadeInUp 0.5s ease-in-out;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

@keyframes spinAndPulse {
    0% {
        transform: rotate(0deg) scale(1);
        opacity: 1;
    }
    25% {
        transform: rotate(90deg) scale(1.05);
        opacity: 0.95;
    }
    50% {
        transform: rotate(180deg) scale(1.1);
        opacity: 0.9;
    }
    75% {
        transform: rotate(270deg) scale(1.05);
        opacity: 0.95;
    }
    100% {
        transform: rotate(360deg) scale(1);
        opacity: 1;
    }
}

/* Navbar Search Dropdown */
.navbar-search-item {
    position: relative;
    display: block;
}

.navbar-search-trigger {
    cursor: pointer;
    padding: 10px 15px;
    border-radius: 50px;
    transition: background-color 0.3s ease;
}

.navbar-search-trigger:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.navbar-search-trigger span {
    color: white;
    font-size: 1.25rem;
    font-weight: 600;
}

.navbar-search-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 10px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    padding: 30px;
    min-width: 500px;
    max-width: 600px;
    z-index: 1000;
    /* Hidden by default - no flicker */
    opacity: 0;
    visibility: hidden;
    display: none;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s, display 0.3s allow-discrete;
    text-align: left;
}

.navbar-search-item:hover .navbar-search-dropdown,
.navbar-search-dropdown.open {
    opacity: 1;
    visibility: visible;
    display: block;
    transform: translateY(0);
}

/* Prevent dropdown from closing when interacting with it */
.navbar-search-dropdown:hover {
    opacity: 1;
    visibility: visible;
    display: block;
    transform: translateY(0);
}

/* Style adjustments for search form in dropdown */
.navbar-search-dropdown h3 {
    color: var(--primary-color);
    font-size: 1.2rem;
    margin-bottom: 15px;
    margin-top: 20px;
}

.navbar-search-dropdown h3:first-child {
    margin-top: 0;
}

.navbar-search-dropdown form {
    margin: 15px 0;
}

.navbar-search-dropdown select {
    margin: 5px;
}

/* ========================================
   LANDING PAGE STYLES
   ======================================== */

.landing-content {
    padding: 40px 20px;
    max-width: 1000px;
    margin: 0 auto;
}

.landing-hero {
    /* margin-bottom: 40px; */
    animation: fadeInUp 0.8s ease-in-out;
}

.landing-title {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 15px;
    font-weight: 700;
}

.landing-subtitle {
    font-size: 1.3rem;
    color: var(--text-dark);
    margin-bottom: 0;
}

.landing-features {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
    margin-top: 50px;
    animation: fadeIn 1.5s ease-in-out;
}

.feature-card {
    background: var(--bg-lighter);
    padding: 30px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
    text-align: center;
}

.feature-card-button {
    border: none;
    width: 100%;
    cursor: pointer;
    font-family: 'Gentium Book Plus', serif;
}

.feature-card-link {
    text-decoration: none;
    display: block;
}

.feature-card-button:hover,
.feature-card-link:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    background: linear-gradient(135deg, var(--bg-lighter), var(--primary-color) 150%);
}

.feature-card-button:active,
.feature-card-link:active {
    transform: translateY(-3px);
}

.feature-card h3 {
    color: var(--primary-color);
    font-size: 1.5rem;
    margin-bottom: 15px;
}

.feature-card p {
    color: var(--text-dark);
    font-size: 1rem;
    line-height: 1.6;
    margin: 0;
}

/* Special styling for the random card */
.feature-card-link:hover h3 {
    color: var(--white);
    transition: color 0.3s ease;
}

/* Landing Page Sections */
.landing-section {
    margin: 50px auto;
    max-width: 900px;
    text-align: left;
}

.landing-section h2 {
    color: var(--primary-color);
    font-size: 1.8rem;
    margin-bottom: 20px;
    text-align: center;
}

.landing-section p {
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 15px;
}

.landing-section ul {
    list-style: none;
    padding-left: 0;
}

.landing-section ul li {
    font-size: 1.05rem;
    line-height: 1.8;
    margin-bottom: 10px;
    padding-left: 25px;
    position: relative;
}

.landing-section ul li::before {
    content: "•";
    color: var(--primary-color);
    font-weight: bold;
    position: absolute;
    left: 0;
}

/* Code styling */
code {
    background-color: var(--bg-lighter);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.95em;
    color: var(--text-dark);
}

/* Examples list */
.examples-list {
    padding: 20px 30px;
    border-radius: var(--radius-md);
    margin: 20px 0;
}

.examples-list li {
    font-size: 1.1rem;
    padding-left: 0;
    line-height: 2.2;
}

.examples-list li::before {
    content: none;
}

.examples-list a {
    color: var(--text-dark);
    text-decoration: none;
}

.examples-list a:hover {
    color: var(--primary-color);
}

.examples-list .ipa-link {
    color: var(--text-medium);
}

.examples-list .ipa-link:hover {
    color: var(--primary-color);
}

/* Use cases grid */
.use-cases {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.use-case {
    background: var(--bg-lighter);
    padding: 25px;
    border-radius: var(--radius-md);
    border-left: 4px solid var(--primary-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.use-case:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow-sm);
}

.use-case h3 {
    color: var(--primary-color);
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.use-case p {
    font-size: 1rem;
    margin-bottom: 0;
}


/* ========================================
   CONTACT FORM STYLES
   ======================================== */

/* Contact form uses existing .search-bar and .btn classes for consistency */

.contact-form-wrapper {
    max-width: 900px !important;
    width: 100% !important;
    margin: 0 auto;
    padding: 40px;
}

.contact-intro {
    font-size: 1.1rem;
    color: var(--text-dark);
    text-align: center;
    margin-bottom: 40px;
    line-height: 1.6;
}

.contact-form {
    display: flex !important;
    flex-direction: column !important;
    gap: 25px;
    justify-content: flex-start !important;
    align-items: stretch !important;
}

/* Override generic form * constraints for contact form */
.contact-form * {
    min-width: auto !important;
}

/* Override .search-bar max-width for contact form inputs */
.contact-form .search-bar {
    max-width: 100% !important;
    width: 100% !important;
    flex-grow: 0 !important;
}

/* Message wrapper with character counter */
.contact-message-wrapper {
    position: relative;
}

.contact-textarea {
    resize: vertical;
    min-height: 250px;
    width: 100%;
}

.character-counter {
    text-align: right;
    font-size: 0.9rem;
    color: var(--text-medium);
    margin-top: 8px;
    font-family: 'Gentium Book Plus', serif;
}

/* Actions: submit button and captcha */
.contact-form-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.contact-captcha {
    display: flex;
    justify-content: center;
    align-items: center;
}

.contact-captcha .cf-turnstile {
    transform: scale(0.75);
    transform-origin: center;
}

/* Status messages */
.contact-status {
    margin-top: 20px;
    padding: 15px;
    border-radius: var(--radius-md);
    font-size: 1rem;
    text-align: center;
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.contact-status[style*="display: block"] {
    display: block !important;
}

.contact-status[style*="color: green"] {
    background-color: #d4edda;
    color: #155724 !important;
    border: 2px solid #c3e6cb;
}

.contact-status[style*="color: red"] {
    background-color: #f8d7da;
    color: #721c24 !important;
    border: 2px solid #f5c6cb;
}

/* Contact button on landing page */
.contact-btn {
    display: inline-block;
    padding: 15px 30px;
    max-width: none;
    margin: 0;
    font-size: 1.1rem;
}

/* Contact form section styling */
.contact-form-section {
    animation: fadeInUp 0.8s ease-in-out;
    padding: 20px;
    max-width: 100%;
    width: 100%;
}

.contact-form-section h2 {
    color: var(--primary-color);
    text-align: center;
}

/* ========================================
   RESPONSIVE DESIGN - MOBILE OPTIMIZATION
   ======================================== */

/* Tablet and Small Desktop (max-width: 768px) */
@media (max-width: 768px) {
    /* Navbar adjustments */
    .navbar {
        padding: 20px;
        flex-direction: column;
        gap: 15px;
    }

    .navbar h1 {
        font-size: 2rem;
        letter-spacing: 1px;
    }

    .navbar-search-dropdown {
        min-width: 90vw;
        max-width: 90vw;
        /* Center the dropdown on mobile */
        left: 50%;
        right: auto;
        padding: 20px;
        /* Override transform for centering on mobile */
        transform: translateX(-50%) translateY(-10px);
    }

    .navbar-search-item:hover .navbar-search-dropdown,
    .navbar-search-dropdown.open {
        transform: translateX(-50%) translateY(0);
    }

    .navbar-search-dropdown h3 {
        font-size: 1rem;
    }

    .navbar-search-dropdown .search-bar,
    .navbar-search-dropdown select {
        max-width: 100%;
        font-size: 0.9rem;
    }

    /* Container adjustments */
    .container {
        max-width: 98%;
        min-width: 95%;
        margin: 20px auto;
        border-radius: 8px;
    }

    /* Main content */
    main {
        padding: 15px;
    }

    main h2 {
        font-size: 1.4rem;
        margin-bottom: 15px;
        word-wrap: break-word;
        flex-wrap: wrap;
        justify-content: center;
    }

    /* IPA selector dropdown on mobile */
    #ipa-selector {
        /* font-size: 0.85em; */
        max-width: 150px;
        padding: 0.15em 0.4em;
    }

    /* Forms - Stack elements vertically */
    form {
        flex-direction: column;
        gap: 10px;
        margin: 15px 0;
    }

    form * {
        max-width: 100% !important;
        width: 100%;
    }

    .dice-link {
        width: auto !important;
        max-width: 50px !important;
        align-self: center;
        font-size: 2rem;
    }

    .search-bar {
        max-width: 100% !important;
        padding: 12px 18px;
    }

    select {
        max-width: 100% !important;
        width: 100%;
        margin: 5px 0;
    }

    /* IPA selector dropdown - override general select styles on mobile */
    #ipa-selector {
        max-width: 150px !important;
        width: auto !important;
        font-size: 0.85em;
        padding: 0.15em 0.4em;
        margin: 0;
    }

    .btn {
        max-width: 100% !important;
        width: 100%;
        margin-left: 0;
        padding: 12px;
        min-height: 44px; /* Touch-friendly size */
    }

    /* Tables - Make scrollable horizontally */
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        font-size: 0.9rem;
    }

    table thead {
        display: table;
        width: 100%;
        table-layout: fixed;
    }

    table tbody {
        display: table;
        width: 100%;
        table-layout: fixed;
    }

    table th, table td {
        padding: 10px 5px;
        font-size: 0.85rem;
        min-width: 80px;
    }

    /* Graph visualization */
    #viz-wrapper {
        height: 400px;
    }

    /* Modal adjustments */
    .modal-content {
        width: 90%;
        padding: 15px;
        max-height: 80vh;
        overflow-y: auto;
    }

    .modal-content h2 {
        font-size: 1.3rem;
    }

    .modal-content h3 {
        font-size: 1.1rem;
    }

    .modal-content p, .modal-content pre {
        font-size: 0.9rem;
    }

    /* Footer */
    footer {
        padding: 15px 10px;
        border-radius: 8px 8px 0 0;
    }

    footer p {
        font-size: 0.9rem;
    }

    /* Landing Page Responsive */
    .landing-content {
        padding: 30px 15px;
    }

    .landing-title {
        font-size: 1.8rem;
    }

    .landing-subtitle {
        font-size: 1.1rem;
    }

    .landing-section {
        margin: 40px auto;
        padding: 0 10px;
    }

    .landing-section h2 {
        font-size: 1.5rem;
    }

    .landing-section p {
        font-size: 1rem;
    }

    .landing-features {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        margin-top: 30px;
    }

    .feature-card {
        padding: 20px;
    }

    .feature-card h3 {
        font-size: 1.3rem;
    }

    .use-cases {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .use-case {
        padding: 20px;
    }

    .examples-list {
        padding: 15px 20px;
    }

    .examples-list li {
        font-size: 1rem;
    }

    /* Contact form responsive - tablet */
    .contact-form-wrapper {
        padding: 30px 20px;
    }

    .contact-intro {
        font-size: 1rem;
    }

    .contact-textarea {
        min-height: 220px;
    }

    .contact-form-section h2 {
        font-size: 1.6rem;
    }

}

/* Mobile Phones (max-width: 480px) */
@media (max-width: 480px) {
    /* Base font size reduction */
    body {
        font-size: 16px;
    }

    /* Navbar */
    .navbar {
        padding: 15px;
    }

    .navbar h1 {
        font-size: 1.5rem;
        letter-spacing: 0.5px;
    }

    .navbar-search-trigger span {
        font-size: 0.9rem;
    }

    /* Container */
    .container {
        margin: 10px auto;
        border-radius: 6px;
    }

    /* Main content */
    main {
        padding: 10px;
    }

    main h2 {
        font-size: 1.2rem;
        line-height: 1.4;
    }

    /* Forms */
    .search-bar {
        padding: 10px 15px;
        font-size: 0.9rem;
        border-radius: 25px;
    }

    select {
        padding: 10px 15px;
        font-size: 0.9rem;
        border-radius: 25px;
    }

    .btn {
        padding: 10px;
        font-size: 0.9rem;
        border-radius: 25px;
    }

    /* Tables - Improved mobile view */
    table {
        font-size: 0.8rem;
    }

    table th, table td {
        padding: 8px 3px;
        font-size: 0.75rem;
    }

    /* Hide less critical columns on very small screens */
    table th:first-child,
    table td:first-child {
        display: none; /* Hide index column on mobile */
    }

    /* Graph */
    #viz-wrapper {
        height: 300px;
    }

    /* Citation button */
    .cite-btn {
        padding: 8px 15px;
        font-size: 0.85rem;
    }

    /* Modal */
    .modal-content {
        width: 95%;
        padding: 12px;
    }

    .close-btn {
        font-size: 24px;
    }

    /* Footer */
    footer {
        padding: 10px 5px;
    }

    footer p {
        font-size: 0.8rem;
        margin-bottom: 5px;
    }

    /* Better touch targets */
    a, button, select, input {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Landing Page Mobile */
    .landing-content {
        padding: 20px 10px;
    }

    .landing-title {
        font-size: 1.5rem;
    }

    .landing-subtitle {
        font-size: 1rem;
    }

    .landing-section {
        margin: 30px auto;
        padding: 0 5px;
    }

    .landing-section h2 {
        font-size: 1.3rem;
    }

    .landing-section p {
        font-size: 0.95rem;
    }

    .landing-section ul li {
        font-size: 0.95rem;
    }

    .landing-features {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .feature-card {
        padding: 15px;
    }

    .feature-card h3 {
        font-size: 1.2rem;
    }

    .feature-card p {
        font-size: 0.9rem;
    }

    .use-case {
        padding: 15px;
    }

    .use-case h3 {
        font-size: 1.1rem;
    }

    .use-case p {
        font-size: 0.9rem;
    }

    .examples-list {
        padding: 12px 15px;
    }

    .examples-list li {
        font-size: 0.95rem;
    }

    code {
        font-size: 0.9em;
    }

    /* Contact form mobile */
    .contact-form-wrapper {
        padding: 20px 15px;
    }

    .contact-intro {
        font-size: 0.95rem;
        margin-bottom: 30px;
    }

    .contact-form {
        gap: 20px;
    }

    .contact-textarea {
        min-height: 200px;
    }

    .character-counter {
        font-size: 0.85rem;
    }

    .contact-form-actions {
        gap: 15px;
    }

    .contact-form-section h2 {
        font-size: 1.4rem;
    }

    .contact-btn {
        font-size: 1rem;
        padding: 12px 25px;
    }

}

/* Very Small Mobile (max-width: 360px) */
@media (max-width: 360px) {
    .navbar h1 {
        font-size: 1.3rem;
    }

    main h2 {
        font-size: 1.1rem;
    }

    table th, table td {
        font-size: 0.7rem;
        padding: 6px 2px;
    }

    #viz-wrapper {
        height: 250px;
    }
}

/* Landscape orientation on mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .navbar h1 {
        font-size: 1.5rem;
    }

    #viz-wrapper {
        height: 350px;
    }
}

/* ========================================
   AUDIO PLAYER STYLES
   ======================================== */

.audio-player-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 20px 0;
    border-radius: var(--radius-md);
    animation: fadeInUp 0.6s ease-in-out;
}

.audio-controls-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: nowrap;
    min-width: 0;
}

.audio-play-button {
    background: var(--gradient-primary);
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    aspect-ratio: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
    padding: 0;
    flex-shrink: 0;
}

.audio-play-button:hover {
    background: var(--gradient-primary-hover);
    box-shadow: var(--shadow-md);
    transform: scale(1.05);
}

.audio-play-button:active {
    transform: scale(0.95);
}

.audio-play-button:focus {
    outline: 3px solid var(--primary-dark);
    outline-offset: 2px;
}

.audio-play-button svg {
    width: 24px;
    height: 24px;
}

.audio-nav-button {
    background: var(--bg-white);
    border: 2px solid var(--primary-color);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    aspect-ratio: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    transition: all 0.3s ease;
    padding: 0;
    flex-shrink: 0;
}

.audio-nav-button:hover {
    background: var(--primary-color);
    color: var(--white);
    box-shadow: var(--shadow-sm);
    transform: scale(1.05);
}

.audio-nav-button:active {
    transform: scale(0.95);
}

.audio-nav-button:focus {
    outline: 3px solid var(--primary-dark);
    outline-offset: 2px;
}

.audio-nav-button svg {
    width: 16px;
    height: 16px;
}

.audio-info-container {
    text-align: center;
    font-size: 0.9rem;
    padding-top: 10px;
    color: var(--text-dark);
}

.audio-info-text {
    display: inline-block;
    line-height: 1.5;
}

.audio-file-link {
    display: inline-flex;
    align-items: center;
    margin-left: 8px;
    color: var(--text-medium);
    opacity: 0.6;
    transition: all 0.3s ease;
    text-decoration: none;
    vertical-align: middle;
}

.audio-file-link:hover {
    color: var(--primary-color);
    opacity: 1;
    transform: scale(1.1);
}

.audio-file-link:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    border-radius: 2px;
}

.audio-file-link svg {
    width: 12px;
    height: 12px;
}

.audio-lingualibre-link {
    display: inline-flex;
    align-items: center;
    transition: transform 0.3s ease, opacity 0.3s ease;
    opacity: 0.7;
    margin-top: 4px;
}

.audio-lingualibre-link:hover {
    transform: scale(1.1);
    opacity: 1;
}

.audio-lingualibre-logo {
    height: 48px;
    width: auto;
    vertical-align: middle;
}

/* Responsive adjustments for audio player */
@media (max-width: 768px) {
    .audio-player-container {
        margin: 15px 0;
        padding: 10px;
    }

    .audio-controls-container {
        gap: 10px;
    }

    .audio-play-button {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
    }

    .audio-play-button svg {
        width: 20px;
        height: 20px;
    }

    .audio-nav-button {
        width: 32px;
        height: 32px;
        min-width: 32px;
        min-height: 32px;
    }

    .audio-nav-button svg {
        width: 14px;
        height: 14px;
    }

    .audio-info-container {
        font-size: 0.85rem;
        padding-top: 5px;
    }

    .audio-file-link {
        margin-left: 6px;
    }

    .audio-file-link svg {
        width: 11px;
        height: 11px;
    }

    .audio-lingualibre-logo {
        height: 22px;
    }
}

@media (max-width: 480px) {
    .audio-player-container {
        margin: 10px 0;
        padding: 8px;
    }

    .audio-controls-container {
        gap: 8px;
    }

    .audio-play-button {
        width: 40px;
        height: 40px;
        min-width: 40px;
        min-height: 40px;
    }

    .audio-play-button svg {
        width: 18px;
        height: 18px;
    }

    .audio-nav-button {
        width: 30px;
        height: 30px;
        min-width: 30px;
        min-height: 30px;
    }

    .audio-nav-button svg {
        width: 12px;
        height: 12px;
    }

    .audio-info-container {
        font-size: 0.8rem;
        padding-top: 5px;
    }

    .audio-info-text {
        display: block;
    }

    .audio-file-link {
        margin-left: 6px;
    }

    .audio-file-link svg {
        width: 10px;
        height: 10px;
    }

    .audio-lingualibre-logo {
        height: 20px;
    }
}