/* --- Translator Widget Container & Button Styles --- */

/* Main container for all translation-related controls. */
#translator-container {
    width: 100%;
    max-width: 56rem; /* Sets a maximum width for larger screens. */
    margin-left: auto; /* Centers the container horizontally. */
    margin-right: auto;
    padding-left: 1.5rem; /* Adds horizontal padding. */
    padding-right: 1.5rem;
    margin-bottom: 2rem; /* Adds space below the container. */
}

/* Groups the trigger button and the Google Translate widget itself. */
.translate-pair {
    display: flex; /* Uses flexbox for layout. */
    flex-direction: column; /* Stacks the button and widget vertically. */
    align-items: center; /* Centers them horizontally. */
    justify-content: center;
    gap: 1rem; /* Adds space between the button and the widget. */
}

/* Styles for the button that toggles the visibility of the translation widget. */
.translate-button {
    display: inline-flex; /* Allows for flexible alignment of internal content. */
    align-items: center;
    justify-content: center;
    gap: 0.75rem; /* Space between text and emojis inside the button. */
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.9);
    background: rgba(30, 30, 30, 0.3); /* Semi-transparent dark background. */
    backdrop-filter: blur(10px); /* Frosted glass effect. */
    -webkit-backdrop-filter: blur(10px); /* For Safari compatibility. */
    border: 1px solid rgba(255, 215, 0, 0.2); /* Subtle gold border. */
    border-radius: 0.5rem;
    transition: all 0.3s ease-in-out; /* Smooth transition for hover effects. */
    text-align: center;
}

/* Hover state for the translate button. */
.translate-button:hover {
    background: rgba(50, 50, 50, 0.5); /* Darkens the background slightly. */
    border-color: rgba(255, 215, 0, 0.5); /* Makes the border more prominent. */
    color: #fff; /* Makes text fully white. */
}

/* Disabled state for the translate button. */
.translate-button:disabled {
    cursor: not-allowed; /* Changes cursor to indicate the button is not interactive. */
    opacity: 0.6; /* Makes the button look faded. */
}

/* --- Google Translate Widget Override Styles --- */

/* Styles for the main container injected by Google Translate. */
#google_translate_element {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: rgba(10, 10, 10, 0.3);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-radius: 0.5rem;
}

/* This is a very specific selector to override the styles of the language dropdown menu from Google. */
/* The "!important" flag is necessary here to force our styles over Google's default inline styles. */
#google_translate_element select.goog-te-combo {
    background-color: rgba(0, 0, 0, 0.5) !important; /* Custom semi-transparent background. */
    border: 1px solid rgba(255, 215, 0, 0.3) !important; /* Custom gold border. */
    color: #FFFFFF !important; /* White text. */
    padding: 0.5rem 0.75rem !important;
    border-radius: 0.375rem !important;
    font-family: 'Inter', sans-serif !important; /* Ensures font consistency. */
    font-size: 0.875rem !important;
    transition: all 0.2s ease-in-out !important;
    -webkit-appearance: none; /* Removes default system appearance for the dropdown (like the default arrow). */
    -moz-appearance: none;
    appearance: none;
    /* Custom dropdown arrow using an inlined SVG, styled to be gold. */
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23FFD700' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e") !important;
    background-position: right 0.5rem center !important;
    background-repeat: no-repeat !important;
    background-size: 1.5em 1.5em !important;
    padding-right: 2.5rem !important; /* Adds padding on the right to prevent text from overlapping the custom arrow. */
}

/* Focus state for the dropdown menu, adds a glowing effect. */
#google_translate_element select.goog-te-combo:focus {
    outline: none !important; /* Removes the default focus outline. */
    border-color: rgba(255, 215, 0, 0.8) !important; /* Makes the border brighter. */
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.3) !important; /* Adds a gold glow. */
}

/* Overrides the default Google Translate icon with a custom one. */
.goog-te-gadget-icon {
    background-image: url('../../images/glogo.png') !important; /* Path to the custom icon. */
    background-position: center !important;
    background-repeat: no-repeat !important;
    background-size: contain !important;
    display: inline-block !important;
    width: 28px !important;
    height: 28px !important;
    vertical-align: middle !important;
}

/* A helper class, likely used by JavaScript to hide the widget by default. */
.google-translate-hidden {
    display: none !important;
}