/* Modern Dictionary Layout */
.dictionary-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    text-align: left;
}

.dictionary-entry {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 24px;
    padding: 24px;
    text-align: left;
    overflow: hidden;
    box-sizing: border-box;
    min-height: fit-content;
}

/* Clear floats to ensure proper containment */
.dictionary-entry::after {
    content: "";
    display: table;
    clear: both;
}

.dictionary-word {
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 16px;
    margin-bottom: 20px;
}

.search-results {
    text-align: left;
}

.search-results h1,
.search-results h2,
.search-results h3,
.search-results h4 {
    text-align: left;
    margin-left: 0;
}

.search-results p,
.search-results div {
    text-align: left;
    line-height: 1.6;
}

.editable {
    color: black;
    border: 1px solid green;
    box-shadow: inset 0px 0px 5px lime;
}

:disabled,
:hover:disabled {
    border: 1px solid silver;
    box-shadow: none;
    background: #dddddd;
    cursor: not-allowed;
    text-shadow: none;
}

.ddbox {
    z-index: 10;
    display: block;
    position: absolute;
    background: white;
    text-align: left;
    border: solid 1px #000066;
    border-radius: 5px;
    padding: 3px;
    min-width: 200px;
    max-width: 800px;
    visibility: hidden;
    margin-top: 1px;
}

.w0 {
    color: #1f2937;
    font-weight: 700;
    font-size: 2.5rem;
    margin: 0 0 12px 0;
    text-align: left;
    line-height: 1.2;
}

.w0lang {
    color: #6b7280;
    font-weight: 500;
    font-size: 1.25rem;
    margin: 0 0 8px 0;
    text-align: left;
}

.w0specs {
    font-weight: 400;
    font-size: 1.25rem;
    margin: 0 0 16px 0;
    color: #666666;
    text-align: left;
}

sub {
    color: #666666;
}

.mcnt {
    font-weight: 600;
    font-size: 1.5rem;
    margin: 16px 0 8px 0;
    color: #374151;
    text-align: left;
}

.tag0,
.tag0 a {
    padding: 6px 12px;
    color: #ffffff;
    background-color: #3b82f6;
    border: none;
    border-radius: 6px;
    margin: 0 6px 6px 0;
    font-size: 0.875rem;
    font-weight: 500;
    display: inline-block;
    line-height: 1.2;
}

.tag0R,
.tag0R a {
    padding: 4px 8px;
    color: #ffffff;
    background-color: #10b981;
    border: none;
    border-radius: 4px;
    float: right;
    margin: 0 0 4px 4px;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.2;
}

.info {
    float: right;
    color: #6b7280;
    font-size: 0.875rem;
    font-weight: 400;
    margin: 0px;
    text-align: right;
}

.newicon {
    color: red;
    font-size: 0.875rem;
    animation: blink-animation 1s steps(5, start) infinite;
    -webkit-animation: blink-animation 1s steps(5, start) infinite;
    -webkit-transform: rotate(-90deg);
    -moz-transform: rotate(-90deg);
    transform: rotate(-90deg);
    filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
}

.lang {
    color: #1976d2;
    font-weight: 600;
    font-size: 1.1rem;
    display: inline-block;
    min-width: 120px;
    text-align: right;
    padding-right: 8px;
    margin: 0;
    vertical-align: baseline;
}

/* Style words that come after language labels - legacy support */
.lang+.w1 {
    margin-left: 0;
}

/* Add some spacing between word groups - updated for new layout */
.w1+.w1 {
    margin-left: 0;
}

/* Words in the new two-column layout */
.words-column .w1 {
    margin: 0;
    white-space: nowrap;
}

.grammar {
    color: #02801d;
    font-weight: 500;
    font-size: 1.25rem;
    margin: 0 0 8px 0;
    text-align: left;
}

.meaning {
    color: #374151;
    font-weight: 400;
    font-size: 1.5rem;
    margin: 0 0 8px 0;
    text-align: left;
}

.photo {
    width: 100%;
    max-width: 100%;
    height: auto;
    margin: 0 0 16px 0;
    image-rendering: auto;
    border-radius: 8px;
    display: block;
    box-sizing: border-box;
    object-fit: contain;
}

/* Two-column layout for synonyms */
.synonyms-container {
    margin: 16px 0;
}

.synonym-row {
    display: flex;
    margin-bottom: 12px;
    align-items: baseline;
    min-height: 32px;
}

.language-column {
    flex: 0 0 140px;
    padding-right: 16px;
}

.words-column {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
    align-items: baseline;
}

.language-column .lang {
    text-align: right;
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    position: static;
    line-height: 1.4;
}

.icon {
    height: 24px;
    max-width: 50px;
}

/* Additional word and panel classes */
.w1 {
    color: #3b82f6 !important;
    margin: 0 0 1px 0;
    font-weight: 600 !important;
    font-size: 1.5rem !important;
    text-decoration: none !important;
    border-radius: 4px;
    padding: 1px 6px !important;
    transition: all 0.2s ease;
    display: inline-block;
    line-height: 1.4 !important;
    background: rgba(241, 248, 250, 0.2) !important;
    border: 1px solid rgba(173, 216, 230, 0.5);
    /* Override global anchor styles */
    min-height: auto !important;
    transform: none !important;
    position: relative;
}

/* Remove global anchor pseudo-element effects */
.w1::after {
    display: none !important;
}

.w1:hover {
    color: #1d4ed8 !important;
    background: rgba(173, 216, 230, 0.4) !important;
    border: 1px solid rgba(173, 216, 230, 0.8);
    text-decoration: none !important;
    /* Override global hover effects */
    transform: none !important;
}

.panelR {
    text-align: left;
    float: right;
    display: block;
    margin: 16px 0;
    width: 30%;
    margin-left: 16px;
    overflow: hidden;
    box-sizing: border-box;
}

.panelR a {
    display: inline-block;
    margin: 0 8px 8px 0;
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-radius: 0;
    color: #475569;
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 1.25rem;
}

.panelR a:hover {
    background: transparent;
    border-color: transparent;
    color: #334155;
    text-decoration: underline;
}

/* Ensure photos in right panel are contained */
.panelR .photo {
    width: 100%;
    max-width: 100%;
    height: auto;
    display: block;
    box-sizing: border-box;
    object-fit: contain;
}

/* Responsive Design */
@media (max-width: 768px) {
    .dictionary-container {
        padding: 8px;
    }

    .dictionary-entry {
        padding: 12px;
    }

    .w0 {
        font-size: 1.75rem;
    }

    .w1 {
        font-size: 0.875rem;
        padding: 2px 4px;
    }

    .w0lang {
        font-size: 0.875rem;
    }

    .w0specs {
        font-size: 0.875rem;
    }

    /* Inline layout for mobile and tablet */
    .synonym-row {
        flex-direction: row;
        margin-bottom: 8px;
        display: block;
    }

    .language-column {
        flex: none;
        padding-right: 8px;
        margin-bottom: 0;
        display: inline-block;
    }

    .language-column .lang {
        text-align: left;
        font-size: 0.9rem;
        font-weight: 700;
        color: #1976d2;
        display: inline;
        min-width: auto;
        padding-right: 4px;
    }

    .words-column {
        gap: 4px 6px;
        display: inline;
    }

    .words-column .w1 {
        display: inline;
        margin-right: 4px;
    }

    .mcnt {
        font-size: 1.25rem;
    }

    .tag0,
    .tag0 a {
        font-size: 0.75rem;
        padding: 4px 8px;
        margin: 0 4px 4px 0;
    }

    .tag0R,
    .tag0R a {
        font-size: 0.625rem;
        padding: 3px 6px;
    }

    .panelR {
        margin: 12px 0;
        width: 35%;
        margin-left: 12px;
    }

    .panelR a {
        font-size: 1rem;
        padding: 6px 10px;
        margin: 0 6px 6px 0;
    }

    .panelR .photo {
        width: 100%;
        max-width: 100%;
        height: auto;
        box-sizing: border-box;
        object-fit: contain;
    }

    .photo {
        width: 100%;
        max-width: 100%;
        height: auto;
        margin: 0 0 12px 0;
        box-sizing: border-box;
        object-fit: contain;
    }
}

@media (max-width: 480px) {
    .dictionary-container {
        padding: 6px;
    }

    .dictionary-entry {
        padding: 10px;
    }

    .w0 {
        font-size: 1.5rem;
    }

    .w1 {
        font-size: 0.75rem;
        padding: 1px 3px;
    }

    .w0lang {
        font-size: 0.75rem;
    }

    .w0specs {
        font-size: 0.75rem;
    }

    /* Further adjustments for very small screens */
    .language-column .lang {
        font-size: 0.8rem;
    }

    .mcnt {
        font-size: 1.125rem;
    }

    .tag0,
    .tag0 a {
        font-size: 0.625rem;
        padding: 3px 6px;
        margin: 0 3px 3px 0;
    }

    .tag0R,
    .tag0R a {
        font-size: 0.5rem;
        padding: 2px 4px;
    }

    .panelR {
        float: none;
        width: 100%;
        margin: 12px 0;
        margin-left: 0;
    }

    .panelR a {
        font-size: 0.875rem;
        padding: 4px 8px;
        margin: 0 4px 4px 0;
    }

    .panelR .photo {
        width: 100%;
        max-width: 100%;
        height: auto;
        box-sizing: border-box;
        object-fit: contain;
    }

    .photo {
        float: none;
        width: 100%;
        max-width: 100%;
        height: auto;
        margin: 0 0 12px 0;
        display: block;
        box-sizing: border-box;
        object-fit: contain;
    }
}

@media (min-width: 1200px) {
    .w1 {
        font-size: 1.25rem;
    }

    .w0 {
        font-size: 3rem;
    }

    .w0lang {
        font-size: 1.5rem;
    }

    .w0specs {
        font-size: 1.5rem;
    }

    .panelR a {
        font-size: 1.5rem;
    }

    .mcnt {
        font-size: 1.75rem;
    }
}
