/* --- General Styles for the Vocabulary Tool --- */
body {
    font-family: 'Arial', sans-serif;
    background-color: #f4f7f6;
    color: #333;
    margin: 0;
    padding: 20px;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: #fff;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

h2 {
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
    margin-top: 10px;
    color: #2c3e50;
    text-align: center;
}

/* Tab Styles */
.tab-buttons-container {
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 20px;
    border-bottom: 2px solid #ddd;
}

.tab-button {
    background-color: #f1f1f1;
    border: none;
    outline: none;
    cursor: pointer;
    padding: 10px 15px;
    transition: 0.3s;
    font-size: 1.1em;
    border-radius: 8px 8px 0 0;
    margin-left: 5px;
}

.tab-button:hover {
    background-color: #ddd;
}

.tab-button.active {
    background-color: #3498db;
    color: white;
}

.tab-content {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-top: none;
    background-color: #fff;
    border-radius: 0 0 8px 8px;
}

/* Global Controls */
.controls-global {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding: 10px;
    background-color: #ecf0f1;
    border-radius: 8px;
}

.controls-global p {
    margin: 0;
    font-weight: bold;
}

.controls-global input {
    width: 60px;
    text-align: center;
    padding: 5px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

#generateBtn {
    padding: 10px 20px;
    background-color: #2ecc71;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s;
}

#generateBtn:hover {
    background-color: #27ae60;
}

/* Toggle Group */
.toggle-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
    justify-content: center;
}

.toggle-button {
    padding: 8px 15px;
    background-color: #e67e22;
    color: white;
    border-radius: 20px;
    cursor: pointer;
    transition: background-color 0.3s;
    font-size: 0.9em;
    user-select: none;
}

.toggle-button:hover {
    background-color: #d35400;
}

.toggle-button.active {
    background-color: #c0392b;
}

/* List & Item Styles */
.output-container {
    margin-top: 15px;
}

.output-container h3 {
    text-align: center;
    color: #2980b9;
    font-size: 1.2em;
    margin-bottom: 10px;
}

ul {
    list-style: none;
    padding: 0;
}

/* Merged list item styles for default (non-mobile) */
li {
    background-color: #f9f9f9;
    border: 1px solid #eee;
    margin-bottom: 10px;
    padding: 15px;
    border-radius: 8px;
    display: flex; /* Kept from general styles */
    justify-content: space-between; /* Kept from general styles */
    align-items: center; /* Kept from general styles */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    flex-wrap: wrap; /* Kept from general styles */
}

/* Merged item-data-container styles for default (non-mobile) */
.item-data-container {
    flex-grow: 1;
    text-align: right; /* From original list styles */
    display: flex; /* Kept from general styles */
    flex-wrap: wrap; /* Kept from general styles */
    align-items: center; /* Kept from general styles */
    gap: 10px; /* Kept from general styles */
    flex: 1; /* Kept from general styles, overriding flex-grow: 1 */
}

/* Merged data-part styles for default (non-mobile) */
.data-part {
    margin-left: 15px; /* From original list styles */
    display: inline-block; /* From original list styles */
    font-size: 1em; /* From original list styles */
    /* Added/updated from general styles */
    display: flex;
    align-items: center;
    gap: 5px;
    margin-right: 0; /* Ensures consistent margin approach */
    width: auto; /* Ensures non-mobile width is flexible */
    justify-content: initial; /* Ensures non-mobile justification is normal */
}

/* TTS Button (Listen Button) */
.listen-btn {
    /* Merged all listen-btn styles */
    background: none;
    border: 1px solid #ccc;
    border-radius: 50%;
    padding: 5px;
    margin-right: 10px;
    cursor: pointer;
    font-size: 1.2em;
    line-height: 1;
    vertical-align: middle;
    width: auto !important; /* Kept the !important rule */
    min-width: 60px; /* Kept the min-width */
    height: 30px; /* Kept a specific height for the circle */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
    padding: 8px 12px; /* Kept the specific padding */
    margin: 0 5px; /* Updated margin from the final fix block */
    flex-shrink: 0; /* Kept from mobile fix block/final fix block */
}

.listen-btn:hover {
    background-color: #eee;
}

.listen-btn-en {
    color: #2ecc71;
    border-color: #2ecc71;
}

.listen-btn-ar {
    color: #3498db;
    border-color: #3498db;
}

/* Generated Field Category-Specific Styles */
.data-part-alklma_alriysya_arby.data-part-cat-afaal_mrkba,
.data-part-alklma_alriysya_arby.data-part-cat-mstlhat_shaiaa {
    color: #3498db;
    font-weight: bold;
    font-size: 1.1em;
}

.data-part-english_translation.data-part-cat-afaal_mrkba,
.data-part-english_translation.data-part-cat-mstlhat_shaiaa,
.data-part-jmla_mthal_arby.data-part-cat-afaal_mrkba,
.data-part-jmla_mthal_arby.data-part-cat-mstlhat_shaiaa {
    color: #7f8c8d;
    font-style: italic;
    font-weight: normal;
}

/* --- Mobile Responsive Styles --- */

/* Mobile Responsive Styles for Vocabulary Tool (max-width: 768px) */
@media (max-width: 768px) {
    .container {
        margin: 20px auto;
        padding: 15px;
    }

    .tab-buttons-container {
        flex-direction: column;
        gap: 5px;
    }

    .tab-button {
        max-width: 100%;
        padding: 12px 10px;
    }

    .controls-global {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .controls-global p {
        text-align: center;
    }

    #generateBtn {
        width: 100%;
    }

    .toggle-group {
        width: 100%;
        justify-content: center;
    }

    .toggle-button {
        flex: 1;
        min-width: 120px;
        text-align: center;
    }

    li {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        padding: 12px 0;
    }

    .item-data-container {
        flex-direction: column;
        gap: 8px;
        width: 100%;
    }

    .data-part {
        margin-right: 0;
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    /* Overrides for listen button on mobile (768px) */
    .listen-btn {
        width: auto;
        min-width: 60px;
        padding: 8px 12px;
        margin-left: 10px; /* Overrides the 0 5px global margin */
        flex-shrink: 0;
    }
}

/* Additional mobile fixes for very small screens (max-width: 480px) */
@media (max-width: 480px) {
    .container {
        margin: 10px auto;
        padding: 10px;
    }

    .tab-button {
        font-size: 0.9em;
        padding: 10px 5px;
    }

    .toggle-button {
        font-size: 0.8em;
        padding: 6px 10px;
    }

    li {
        font-size: 1em;
    }

    .listen-btn {
        min-width: 50px; /* Overrides 60px from 768px block */
        padding: 6px 10px; /* Overrides 8px 12px from 768px block */
        font-size: 0.8em;
    }
}