/* =============================================================
   Hreflang Customizer — Admin UI  (WordPress-safe)
   ============================================================= */

/* Scope everything tightly so WP core styles can't leak in */
.hl-wrap,
.hl-wrap * {
    box-sizing: border-box;
}

/* ── CSS custom props (scoped to plugin wrapper) ──────────── */
.hl-wrap {
    --hl-blue:          #185FA5;
    --hl-blue-light:    #E6F1FB;
    --hl-blue-mid:      #378ADD;
    --hl-blue-dark:     #0C447C;
    --hl-green:         #1D9E75;
    --hl-green-light:   #E1F5EE;
    --hl-green-border:  #9FE1CB;
    --hl-radius:        10px;
    --hl-radius-sm:     6px;
    --hl-border:        #dde3ec;
    --hl-text:          #1a2232;
    --hl-muted:         #64748b;
    --hl-bg:            #f4f6fa;
    --hl-card:          #ffffff;
    --hl-shadow:        0 1px 3px rgba(0,0,0,.07), 0 4px 14px rgba(0,0,0,.05);
    --hl-tag-bg:        #E6F1FB;
    --hl-tag-text:      #0C447C;
    --hl-tag-border:    #B5D4F4;

    max-width: 980px;
    margin: 20px 0;
    font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--hl-text);
    font-size: 14px;
    line-height: 1.5;
}

/* ── Page header ────────────────────────────────────────────── */
.hl-page-header {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--hl-card);
    border: 1px solid var(--hl-border);
    border-radius: var(--hl-radius);
    padding: 18px 22px;
    margin-bottom: 22px;
    box-shadow: var(--hl-shadow);
}

/* Icon box — use background-image dashicon, no inline SVG */
.hl-logo-icon {
    width: 40px;
    height: 40px;
    background: var(--hl-blue);
    border-radius: var(--hl-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #fff;
    font-size: 20px;
    line-height: 1;
}

/* Override WP's global SVG fill rule inside our icon box */
.hl-logo-icon svg {
    width: 22px !important;
    height: 22px !important;
    fill: #ffffff !important;
    display: block;
}

.hl-page-header h1 {
    font-size: 20px !important;
    font-weight: 600 !important;
    color: var(--hl-text) !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1.2 !important;
    border: none !important;
}
.hl-page-header p {
    margin: 3px 0 0 !important;
    font-size: 13px;
    color: var(--hl-muted);
}

/* ── Grid layout ────────────────────────────────────────────── */
.hl-layout {
    display: grid;
    grid-template-columns: 1fr 270px;
    gap: 20px;
    align-items: start;
}
@media (max-width: 820px) {
    .hl-layout { grid-template-columns: 1fr; }
}

/* ── Cards ──────────────────────────────────────────────────── */
.hl-card {
    background: var(--hl-card);
    border: 1px solid var(--hl-border);
    border-radius: var(--hl-radius);
    padding: 20px 22px;
    box-shadow: var(--hl-shadow);
    margin-bottom: 0;
}
.hl-card + .hl-card {
    margin-top: 18px;
}
.hl-card-title {
    font-size: 11px !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    letter-spacing: .065em;
    color: var(--hl-muted) !important;
    margin: 0 0 14px !important;
    padding-bottom: 12px !important;
    border-bottom: 1px solid var(--hl-border);
}

/* ── Search ─────────────────────────────────────────────────── */
.hl-search-wrap {
    position: relative;
    margin-bottom: 14px;
}
/* SVG search icon inside the box — force WP not to mess with it */
.hl-search {
    width: 100%;
    padding: 9px 12px !important;
    border: 1px solid var(--hl-border) !important;
    border-radius: var(--hl-radius-sm) !important;
    font-size: 13px;
    color: var(--hl-text);
    background: var(--hl-bg) !important;
    outline: none;
    box-shadow: none !important;
    transition: border-color .15s, box-shadow .15s;
    height: auto !important;
    line-height: normal;
    box-sizing: border-box !important;
}
.hl-search:focus {
    border-color: var(--hl-blue-mid) !important;
    box-shadow: 0 0 0 3px rgba(55,138,221,.18) !important;
    background: #fff !important;
    outline: none !important;
    /* override WP admin default orange focus ring */
    -webkit-box-shadow: 0 0 0 3px rgba(55,138,221,.18) !important;
}

/* ── Language card grid ─────────────────────────────────────── */
.hl-lang-scroll {
    max-height: 400px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
    scrollbar-width: thin;
    scrollbar-color: var(--hl-border) transparent;
}
.hl-lang-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(152px, 1fr));
    gap: 7px;
}
.hl-lang-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 11px;
    border: 1.5px solid var(--hl-border);
    border-radius: var(--hl-radius-sm);
    cursor: pointer;
    transition: border-color .14s, background .14s;
    user-select: none;
    background: #fff;
    min-width: 0;
}
.hl-lang-item:hover {
    border-color: var(--hl-blue-mid);
    background: var(--hl-blue-light);
}
.hl-lang-item.hl-selected {
    border-color: var(--hl-blue);
    background: var(--hl-blue-light);
}
.hl-lang-item.hl-selected .hl-check {
    background: var(--hl-blue);
    border-color: var(--hl-blue);
}
.hl-lang-item.hl-selected .hl-check::after {
    opacity: 1;
}
.hl-lang-item.hl-hidden {
    display: none;
}

.hl-check {
    flex-shrink: 0;
    width: 15px;
    height: 15px;
    border: 1.5px solid #c8d3e0;
    border-radius: 4px;
    position: relative;
    transition: background .1s, border-color .1s;
}
.hl-check::after {
    content: '';
    position: absolute;
    left: 3px;
    top: 1px;
    width: 5px;
    height: 8px;
    border: 2px solid #fff;
    border-top: none;
    border-left: none;
    transform: rotate(45deg);
    opacity: 0;
    transition: opacity .1s;
}

.hl-lang-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--hl-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}
.hl-no-results {
    text-align: center;
    padding: 28px 12px;
    color: var(--hl-muted);
    font-size: 13px;
    display: none;
    margin: 0;
}

/* Hidden WP select — stays in DOM for form submission */
.hl-hidden-select {
    display: none !important;
    visibility: hidden !important;
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
}

/* ── Save bar ───────────────────────────────────────────────── */
.hl-save-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--hl-border);
    flex-wrap: wrap;
}
/* Override WP's .button-primary to match our design */
.hl-wrap .hl-btn-save,
.hl-wrap input.hl-btn-save {
    background: var(--hl-blue) !important;
    border-color: var(--hl-blue-dark) !important;
    color: #fff !important;
    border-radius: var(--hl-radius-sm) !important;
    padding: 8px 22px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    height: auto !important;
    line-height: 1.4 !important;
    box-shadow: none !important;
    text-shadow: none !important;
    cursor: pointer;
    transition: background .14s;
}
.hl-wrap .hl-btn-save:hover,
.hl-wrap input.hl-btn-save:hover {
    background: var(--hl-blue-dark) !important;
    border-color: var(--hl-blue-dark) !important;
}
.hl-save-hint {
    font-size: 12px;
    color: var(--hl-muted);
}

/* ── Selected tags panel ────────────────────────────────────── */
.hl-selected-count {
    font-size: 13px;
    color: var(--hl-muted);
    margin: 0 0 10px !important;
}
.hl-selected-count strong {
    color: var(--hl-blue);
    font-weight: 700;
}
.hl-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 32px;
}
.hl-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px 3px 10px;
    background: var(--hl-tag-bg);
    border: 1px solid var(--hl-tag-border);
    border-radius: 100px;
    font-size: 12px;
    font-weight: 500;
    color: var(--hl-tag-text);
    line-height: 1.5;
}
.hl-tag-remove {
    background: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    cursor: pointer;
    font-size: 15px;
    line-height: 1;
    color: var(--hl-blue-dark);
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background .1s;
    box-shadow: none !important;
}
.hl-tag-remove:hover {
    background: var(--hl-tag-border) !important;
}
.hl-tag-code {
    font-size: 10px;
    font-weight: 600;
    font-family: monospace;
    background: var(--hl-blue);
    color: #fff;
    padding: 1px 6px;
    border-radius: 100px;
    margin-left: 2px;
    letter-spacing: .02em;
}
.hl-empty-tags {
    color: var(--hl-muted);
    font-size: 13px;
    font-style: italic;
}

/* ── Sidebar info & links ───────────────────────────────────── */
.hl-info-box {
    padding: 13px 15px;
    background: var(--hl-green-light);
    border: 1px solid var(--hl-green-border);
    border-radius: var(--hl-radius-sm);
    font-size: 12px;
    color: #085041;
    line-height: 1.6;
    margin-bottom: 14px;
}
.hl-info-box strong {
    display: block;
    margin-bottom: 3px;
    font-weight: 600;
}
.hl-sidebar-links {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}
.hl-sidebar-links li {
    padding: 8px 0;
    border-bottom: 1px solid var(--hl-border);
    list-style: none !important;
}
.hl-sidebar-links li:last-child { border-bottom: none; }
.hl-sidebar-links a {
    font-size: 13px;
    color: var(--hl-blue);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
}
.hl-sidebar-links a:hover {
    color: var(--hl-blue-dark);
    text-decoration: underline;
}

/* ── Support / System status page ──────────────────────────── */
.hl-stat-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}
@media (max-width: 600px) { .hl-stat-row { grid-template-columns: 1fr 1fr; } }
.hl-stat {
    background: var(--hl-card);
    border: 1px solid var(--hl-border);
    border-radius: var(--hl-radius);
    padding: 16px 18px;
    box-shadow: var(--hl-shadow);
}
.hl-stat-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .065em;
    color: var(--hl-muted);
    margin-bottom: 5px;
}
.hl-stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--hl-blue);
    line-height: 1.2;
}
.hl-stat-value.hl-ok    { color: #3B6D11; }
.hl-stat-value.hl-warn  { color: #854F0B; }

.hl-support-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}
@media (max-width: 700px) { .hl-support-grid { grid-template-columns: 1fr; } }

.hl-info-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.hl-info-table tr {
    border-bottom: 1px solid var(--hl-border);
}
.hl-info-table tr:last-child { border-bottom: none; }
.hl-info-table td {
    padding: 9px 0;
    vertical-align: middle;
}
.hl-info-table td:first-child {
    color: var(--hl-muted);
    width: 46%;
}
.hl-info-table td:last-child {
    font-weight: 500;
    word-break: break-word;
}

.hl-badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.6;
}
.hl-badge-ok   { background: #EAF3DE; color: #3B6D11; }
.hl-badge-warn { background: #FAEEDA; color: #854F0B; }

.hl-back-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 18px;
    font-size: 13px;
    color: var(--hl-blue);
    text-decoration: none;
}
.hl-back-link:hover { text-decoration: underline; }

/* ── Buy me a coffee card ───────────────────────────── */
.hl-coffee-card {
    background: linear-gradient(135deg, #fffbf0 0%, #fff8e7 100%);
    border-color: #f5d87a;
    text-align: center;
}
.hl-coffee-card .hl-card-title {
    border-bottom-color: #f5d87a;
}
.hl-coffee-text {
    font-size: 13px;
    color: var(--hl-muted, #64748b);
    line-height: 1.6;
    margin: 0 0 14px !important;
}
.hl-coffee-btn {
    display: inline-block;
    background: #f5a623;
    color: #fff !important;
    font-size: 13px;
    font-weight: 700;
    padding: 9px 20px;
    border-radius: 100px;
    text-decoration: none !important;
    transition: background .15s, transform .1s;
    letter-spacing: .01em;
}
.hl-coffee-btn:hover {
    background: #d4881a;
    transform: translateY(-1px);
}

/* ── Kill WordPress orange focus ring inside plugin pages ── */
.hl-wrap input[type="text"]:focus,
.hl-wrap input[type="search"]:focus,
.hl-wrap select:focus {
    border-color: var(--hl-blue-mid) !important;
    box-shadow: 0 0 0 3px rgba(55,138,221,.18) !important;
    outline: none !important;
}
