/* --- PAGE CONTAINER --- */
.dictionary-page-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 2rem 1rem;
    width: 100%;
}

/* --- BACK BUTTON --- */
/* This button is styled to match the main site's secondary text and accent colors */
.back-button {
    position: absolute;
    top: 2rem;
    left: 2rem;
    z-index: 10; /* Ensure it's above other elements */

    background: none;
    border: 1px solid rgba(255, 255, 255, 0.15); /* Matching shortener tool style */
    color: var(--clr-text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 500;
    font-size: 0.9rem;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
}

.back-button:hover {
    background-color: var(--clr-accent);
    color: var(--clr-dark);
    border-color: var(--clr-accent);
}

/* --- MAIN APP CONTAINER --- */
.dictionary-app-container {
    width: 100%;
    max-width: 700px;
    margin-top: 4rem; /* Add space below the back button */
    font-family: 'Poppins', sans-serif; /* Ensure Poppins font is used */
}

.dictionary-app-container header {
    text-align: center;
    margin-bottom: 2rem;
}

.dictionary-app-container header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -1px;
    /* Gradient animation using the main site's theme */
    background: linear-gradient(90deg, var(--clr-text-secondary), var(--clr-accent), var(--clr-text), var(--clr-accent));
    background-size: 200% auto;
    color: transparent;
    -webkit-background-clip: text;
    background-clip: text;
    animation: gradient-shift 5s linear infinite;
}

@keyframes gradient-shift {
    to {
        background-position: -200% center;
    }
}

.search-form {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

#search-input {
    flex-grow: 1;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background-color: rgba(22, 22, 22, 0.7);
    color: var(--clr-text);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
    font-family: 'Poppins', sans-serif;
}

#search-input:focus {
    border-color: var(--clr-accent);
    box-shadow: 0 0 0 3px rgba(0, 255, 255, 0.3);
}

/* Styled to match the main CTA button */
.search-button {
    border: none;
    background-color: var(--clr-accent);
    color: var(--clr-dark);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Poppins', sans-serif;
}

.search-button:hover {
    background-color: var(--clr-text);
}

.instructions {
    display: block;
    text-align: center;
    background-color: rgba(0, 255, 255, 0.05); /* Cyan-tinted background */
    border: 1px solid rgba(0, 255, 255, 0.2);
    color: var(--clr-text-secondary);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    line-height: 1.5;
}

.loading-spinner {
    display: none;
    margin: 2rem auto;
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--clr-accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.error-message {
    display: none;
    text-align: center;
    background-color: rgba(255, 107, 107, 0.1);
    border: 1px solid #ff6b6b;
    color: #ff6b6b;
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
}

/* Styled to match the contact cards */
.results-container {
    display: none;
    background: rgba(22, 22, 22, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.result-word {
    font-size: 2.25rem;
    font-weight: 700;
    text-transform: capitalize;
    color: var(--clr-text);
}

.result-phonetic {
    color: var(--clr-accent);
    font-size: 1.25rem;
}

.audio-button {
    background-color: transparent;
    border: 2px solid var(--clr-accent);
    color: var(--clr-accent);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s, color 0.3s;
}
.audio-button:hover {
    background-color: var(--clr-accent);
    color: var(--clr-dark);
}
.audio-button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.audio-button svg {
    width: 24px;
    height: 24px;
}

.meaning {
    margin-bottom: 2rem;
}
.meaning:last-child {
    margin-bottom: 0;
}

.part-of-speech {
    font-style: italic;
    font-weight: 600;
    font-size: 1.25rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--clr-text);
}
.part-of-speech::after {
    content: '';
    height: 1px;
    flex-grow: 1;
    background-color: rgba(255, 255, 255, 0.1);
}

.definitions-list {
    list-style: none;
    padding-left: 1.5rem;
}

.definitions-list li {
    margin-bottom: 1.25rem;
    line-height: 1.6;
    color: var(--clr-text); /* Use main theme text color */
}

.definitions-list li::before {
    content: '•';
    color: var(--clr-accent); /* Use main theme accent color */
    font-weight: bold;
    display: inline-block;
    width: 1em;
    margin-left: -1em;
}

.example {
    color: var(--clr-text-secondary); /* Use main theme secondary text color */
    font-style: italic;
    margin-top: 0.5rem;
    padding-left: 1rem;
    border-left: 2px solid rgba(255, 255, 255, 0.1); /* Use main theme border style */
}

/* --- RESPONSIVE ADJUSTMENTS --- */
@media (max-width: 768px) {
    .back-button {
        position: static; /* Let it flow in the document */
        display: block;
        text-align: center;
        margin-bottom: 1.5rem;
    }
    .dictionary-app-container {
        margin-top: 0;
    }
}

@media (max-width: 480px) {
    .dictionary-app-container header h1 {
        font-size: 2rem;
    }
    .search-form {
        flex-direction: column;
    }
    .results-container {
        padding: 1.5rem;
    }
    .result-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    .result-word {
        font-size: 1.75rem;
    }
}