/* Dictionary Widget Styles - Namespaced for isolation from other components */

.tool-divider {
    padding: 4rem 0 3rem;
    background: linear-gradient(180deg, transparent 0%, rgba(99, 102, 241, 0.03) 50%, transparent 100%);
    border-top: 2px solid #e5e7eb;
    border-bottom: 2px solid #e5e7eb;
    margin: 2rem 0;
}

.divider-content {
    max-width: 700px;
    margin: 0 auto;
    text-align: center;
    padding: 0 1rem;
}

.divider-content h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 1rem;
    line-height: 1.3;
}

.divider-content p {
    font-size: 0.95rem;
    color: #4b5563;
    line-height: 1.6;
    margin: 0;
}

.dictionary-widget {
    background: transparent;
}

.dictionary-tool-section {
    padding: 0 0 48px;
}

.dictionary-tool-shell {
    background: #ffffff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    padding: 18px;
}

.dictionary-tool-shell .seo-intro {
    margin-bottom: 14px;
}

.dictionary-tool-shell .seo-intro h2 {
    font-size: clamp(20px, 2vw, 22px);
    font-weight: 700;
    color: #111827;
    margin: 0 0 0.4rem;
    line-height: 1.35;
}

.dictionary-tool-shell .seo-intro p {
    color: var(--color-text-secondary);
    line-height: 1.5;
    font-size: 14px;
    margin: 0;
}

/* Reset all standard element inheritance within dictionary widget */
.dictionary-widget * {
    box-sizing: border-box;
}

.dictionary-container {
    display: flex;
    flex-direction: column;
    max-width: 560px;
    margin: 0 auto;
    gap: 0.9rem;
}

/* Search Header */
.search-header {
    display: flex;
    gap: 0.4rem;
}

.input-group {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.3rem;
    align-items: center;
    width: 100%;
}

#word-input {
    flex: 1;
    padding: 0.65rem 0.9rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: white;
    color: #111827;
}

#word-input::placeholder {
    color: #9ca3af;
}

#word-input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

#search-btn {
    padding: 0.65rem 0.9rem;
    background: #6366f1;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.75rem;
    transition: background-color 0.2s, transform 0.1s;
    font-weight: 500;
    white-space: nowrap;
}

#search-btn:hover {
    background: #4f46e5;
}

#search-btn:active {
    transform: scale(0.95);
}

.inline-pronounce-btn {
    padding: 0.65rem 0.9rem;
    font-size: 0.75rem;
    border-radius: 8px;
    box-shadow: none;
}

.inline-pronounce-btn .icon {
    font-size: 0.85rem;
}

.inline-settings {
    position: relative;
    min-width: 0;
    width: auto;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fafafa;
    overflow: hidden;
}

.inline-settings summary {
    padding: 0.65rem 0.85rem;
    font-size: 0.75rem;
    white-space: nowrap;
}

.inline-settings .settings-grid {
    position: absolute;
    right: 0;
    top: calc(100% + 0.35rem);
    z-index: 10;
    width: min(540px, calc(100vw - 2rem));
    background: #fff;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
}

.icon-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Card Styling */
.card {
    background: white;
    padding: 0.8rem 0.9rem;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.2s;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

/* Primary Button - Pronunciation */
.btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.62rem 0.9rem;
    background: linear-gradient(135deg, #6366f1 0%, #7c3aed 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
    white-space: nowrap;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #4f46e5 0%, #6d28d9 100%);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.35);
    transform: translateY(-2px);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}

.btn-primary .icon {
    font-size: 0.95rem;
}

/* Advanced Settings (Details/Summary) - Right aligned */
.advanced-settings {
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 0;
    flex: 1;
    background: #fafafa;
    transition: all 0.2s;
    min-width: 200px;
}

.advanced-settings:hover {
    background: white;
    border-color: #d1d5db;
}

.advanced-settings summary {
    cursor: pointer;
    font-weight: 600;
    color: #4b5563;
    padding: 0.5rem 0.7rem;
    user-select: none;
    list-style: none;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
}

.advanced-settings summary:hover {
    color: #6366f1;
    background: #f3f4f6;
}

.advanced-settings summary::-webkit-details-marker {
    display: none;
}

.advanced-settings summary::before {
    content: '⚙️';
    font-size: 0.95rem;
    display: inline-block;
    transition: transform 0.2s;
}

.advanced-settings[open] summary {
    background: white;
    border-bottom: 1px solid #e5e7eb;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 0.45rem;
    padding: 0.5rem;
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.setting-group label {
    font-size: 0.6rem;
    font-weight: 600;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Toggle Group */
.toggle-group {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.toggle-btn {
    flex: 1;
    min-width: 50px;
    padding: 0.3rem 0.45rem;
    background: white;
    color: #4b5563;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
    white-space: nowrap;
}

.toggle-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.toggle-btn.active {
    background: #10b981;
    color: white;
    border-color: #059669;
    font-weight: 600;
}

.toggle-btn.active:hover {
    background: #059669;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.25);
}

/* Gender Buttons */
.gender-group {
    display: flex;
    gap: 0.25rem;
}

.gender-btn {
    flex: 1;
    padding: 0.3rem 0.4rem;
    background: white;
    color: #4b5563;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    font-family: inherit;
}

.gender-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.gender-btn.active {
    background: #3b82f6;
    color: white;
    border-color: #2563eb;
    font-weight: 600;
}

.gender-btn.active:hover {
    background: #2563eb;
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.25);
}

/* Phonetics Card */
.phonetics-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.8rem;
    justify-content: space-between;
}

.phonetic-display {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    flex: 0 1 auto;
}

.dictionary-widget .ipa-text {
    font-size: 1.2rem;
    font-weight: 700;
    color: #6366f1;
    font-family: 'Courier New', monospace;
    line-height: 1;
}

.dictionary-widget .phonetic-breakdown {
    font-size: 0.75rem;
    color: #4b5563;
    font-weight: 500;
}

/* Meanings Card */
.meanings-card h3,
.relations-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 0.55rem;
    margin-top: 0;
}

.meaning-item {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin-bottom: 0.55rem;
    padding-bottom: 0.55rem;
    border-bottom: 1px solid #e5e7eb;
}

.meaning-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.part-of-speech {
    font-size: 0.85rem;
    font-weight: 600;
    color: #6366f1;
    font-style: italic;
}

.definition {
    font-size: 1rem;
    color: #374151;
    line-height: 1.5;
    margin: 0;
}

.example {
    font-size: 0.95rem;
    color: #6b7280;
    font-style: italic;
    margin-top: 0.2rem;
    margin-left: 0.75rem;
    padding-left: 0.5rem;
    border-left: 2px solid #dbeafe;
}

/* Relations Card */
.relations-tabs {
    display: flex;
    gap: 0.35rem;
    border-bottom: 2px solid #e5e7eb;
    margin-bottom: 0.55rem;
}

.tab-btn {
    padding: 0.4rem 0.65rem;
    background: none;
    color: #6b7280;
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.tab-btn:hover {
    color: #374151;
}

.tab-btn.active {
    color: #6366f1;
    border-bottom-color: #6366f1;
}

.pill-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.relation-pill {
    display: inline-block;
    padding: 0.32rem 0.65rem;
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
    border-radius: 16px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    user-select: none;
}

.relation-pill:hover {
    background: #6366f1;
    color: white;
    border-color: #6366f1;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.relation-pill:active {
    transform: translateY(0);
}

/* Error and Loading States */
.meaning-item p.definition {
    color: #d9534f;
}

/* Responsive Design */
@media (max-width: 768px) {
    .tool-divider {
        padding: 2rem 0 1.5rem;
        margin: 0.75rem 0;
    }

    .divider-content h2 {
        font-size: 1.1rem;
        margin-bottom: 0.5rem;
    }

    .divider-content p {
        font-size: 0.85rem;
    }

    .dictionary-widget {
        padding: 1.5rem 0;
    }

    .dictionary-container {
        margin: 0 1rem;
        gap: 0.8rem;
    }

    .input-group {
        grid-template-columns: 1fr auto;
    }

    .card {
        padding: 0.75rem 0.85rem;
    }

    .advanced-settings {
        width: 100%;
    }

    .inline-settings .settings-grid {
        width: min(520px, calc(100vw - 2rem));
    }

    .settings-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
        padding: 0.5rem;
    }

    .toggle-group {
        gap: 0.3rem;
    }

    .toggle-btn {
        min-width: 54px;
        padding: 0.35rem 0.5rem;
        font-size: 0.75rem;
    }

    .gender-group {
        gap: 0.4rem;
    }

    .gender-btn {
        padding: 0.35rem 0.5rem;
        font-size: 0.75rem;
    }

    .btn-primary {
        padding: 0.85rem 1rem;
        font-size: 0.92rem;
    }

    .phonetics-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .dictionary-widget .ipa-text {
        font-size: 1.25rem;
    }

    .practice-cta {
        width: 100%;
    }

    .relations-tabs {
        gap: 0;
    }

    .tab-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.95rem;
    }

    .relation-pill {
        padding: 0.4rem 0.8rem;
        font-size: 0.95rem;
    }
}

@media (max-width: 480px) {
    .dictionary-widget {
        padding: 1rem 0;
    }

    .dictionary-container {
        margin: 0 0.75rem;
        gap: 0.65rem;
    }

    .input-group {
        grid-template-columns: 1fr auto;
    }

    .inline-pronounce-btn {
        grid-column: 1 / -1;
        justify-self: stretch;
    }

    .card {
        padding: 0.7rem;
    }

    .meanings-card h3,
    .relations-card h3 {
        font-size: 1rem;
    }

    .part-of-speech {
        font-size: 0.85rem;
    }

    .definition,
    .example,
    .tab-btn,
    .relation-pill {
        font-size: 0.95rem;
    }

    .input-group {
        gap: 0.25rem;
    }

    #word-input {
        padding: 0.6rem 0.7rem;
        font-size: 0.92rem;
    }

    #search-btn {
        padding: 0.6rem 0.7rem;
    }

    .btn-primary {
        padding: 0.75rem 0.9rem;
        font-size: 0.88rem;
    }

    .advanced-settings summary {
        padding: 0.45rem 0.65rem;
        font-size: 0.85rem;
    }

    .settings-grid {
        grid-template-columns: 1fr;
        gap: 0.4rem;
        padding: 0.45rem;
    }

    .toggle-btn {
        min-width: 55px;
        padding: 0.35rem 0.5rem;
        font-size: 0.7rem;
    }

    .gender-btn {
        padding: 0.35rem 0.5rem;
        font-size: 0.7rem;
    }

    .dictionary-widget .ipa-text {
        font-size: 1.25rem;
    }

    .practice-cta {
        padding: 0.65rem 1rem;
        font-size: 0.75rem;
    }
}
