/* =========================================
   Block Editor Preview (Placeholder)
   ========================================= */

.cg-polylang-dropdown-editor {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-width: 60px;
    height: 30px;
    padding: 0 6px;

    font: inherit;
    color: inherit;
    background: inherit;

    border: 1px solid var(--wp--preset--color--contrast);
    border-radius: 4px;

    box-sizing: border-box;
}

.cg-polylang-editor-placeholder {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

/* ===========================
   Polylang Dropdown Block - Frontend
   =========================== */

/* Main container */
.wp-block-cg-polylang-dropdown {
    display: inline-block;
    position: relative;
    vertical-align: middle;
    min-width: 30px; /* minimal width */
    max-width: 120px; /* optional max width */
}

/* Select itself */
.wp-block-cg-polylang-dropdown select.pll-switcher-select {
    font: inherit; /* inherit font-family, size, weight */
    color: inherit; /* inherit text color */
    background: transparent; /* inherit background */
    border: 1px solid currentColor; /* border matches text color */
    border-radius: 0; /* no rounded corners */
    padding: 8px 12px; /* padding inside select */
    cursor: pointer;
    width: 100%;
    min-height: 36px; /* same height as menu items */
    
    /* Use default browser arrow */
    appearance: auto;
    -webkit-appearance: auto;
    -moz-appearance: auto;
    
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Hover & focus states */
.wp-block-cg-polylang-dropdown select.pll-switcher-select:hover,
.wp-block-cg-polylang-dropdown select.pll-switcher-select:focus {
    border-color: var(--wp--preset--color--primary, #007cba);
    box-shadow: 0 0 0 1px var(--wp--preset--color--primary, #007cba);
    outline: none;
}

/* Option styling (if Polylang adds flags) */
.wp-block-cg-polylang-dropdown select.pll-switcher-select option {
    padding: 8px 12px;
}

/* Responsive: mobile */
@media (max-width: 768px) {
    .wp-block-cg-polylang-dropdown {
        width: auto;
        max-width: 180px;
        margin: 8px 0;
    }
    
    .wp-block-cg-polylang-dropdown select.pll-switcher-select {
        font-size: 15px;
        min-height: 36px;
        padding: 6px 10px;
    }
}

/* Dark theme support */
@media (prefers-color-scheme: dark) {
    .wp-block-cg-polylang-dropdown select.pll-switcher-select {
        background-color: var(--wp--preset--color--base-dark, #1e1e1e);
        color: var(--wp--preset--color--contrast-dark, #fff);
        border-color: currentColor;
    }
    
    .wp-block-cg-polylang-dropdown select.pll-switcher-select:hover,
    .wp-block-cg-polylang-dropdown select.pll-switcher-select:focus {
        border-color: var(--wp--preset--color--primary-dark, #00a0d2);
        box-shadow: 0 0 0 1px var(--wp--preset--color--primary-dark, #00a0d2);
    }
}
