/* ============================================
   solver.css — Word solver tool styles
   ============================================ */

/* --- Results Area Hidden --- */
.results-area-hidden {
    display: none;
}

/* --- Embedded Input --- */
.solver-input-wrap {
    position: relative;
    max-width: var(--tool-max-width);
    margin: 0 auto 1rem;
}

.solver-input {
    width: 100%;
    padding: 0.875rem 3.5rem 0.875rem 1.25rem;
    font-size: 1.125rem;
    font-weight: 500;
    border: 2px solid var(--border);
    border-radius: var(--radius-full);
    background: var(--bg);
    color: var(--text);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.solver-input::placeholder {
    color: var(--text-light);
    font-weight: 400;
}

.solver-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-shadow);
}

.solver-btn {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: var(--accent);
    color: #FFFFFF;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.solver-btn:hover {
    background: var(--accent-dark);
}

.solver-btn:active {
    transform: translateY(-50%) scale(0.95);
}

/* --- Filters Toggle --- */
.filters-toggle {
    display: inline-block;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0.5rem 0;
    margin-bottom: 0.5rem;
    transition: color 0.15s;
}

.filters-toggle:hover {
    color: var(--accent);
}

.filters-toggle.open {
    color: var(--accent-dark);
}

/* --- Filters Panel --- */
.filters-panel {
    display: none;
    max-width: var(--tool-max-width);
    margin: 0 auto 1rem;
    padding: 1rem;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.filters-panel.open {
    display: block;
}

.filter-row {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.filter-row:last-child {
    margin-bottom: 0;
}

.filter-group {
    flex: 1;
    min-width: 120px;
}

.filter-label {
    display: block;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.375rem;
}

.filter-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    background: var(--bg);
    color: var(--text);
    outline: none;
    transition: border-color 0.15s;
}

.filter-input:focus {
    border-color: var(--accent);
}

.filter-select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    background: var(--bg);
    color: var(--text);
    outline: none;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
}

.filter-select:focus {
    border-color: var(--accent);
}

.filter-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-top: 1.5rem;
}

.filter-check input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--accent);
    cursor: pointer;
}

.filter-check label {
    font-size: 1rem;
    color: var(--text);
    cursor: pointer;
}

.filter-radio-group {
    display: flex;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-top: 0.375rem;
}

.filter-radio {
    display: none;
}

.filter-radio-label {
    flex: 1;
    text-align: center;
    padding: 0.5rem 1rem;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    border-right: 1px solid var(--border);
}

.filter-radio-label:last-of-type {
    border-right: none;
}

.filter-radio:checked + .filter-radio-label {
    background: var(--accent);
    color: #FFFFFF;
}

.filter-dict-group {
    display: flex;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-top: 0.375rem;
}

.filter-dict-radio {
    display: none;
}

.filter-dict-label {
    flex: 1;
    text-align: center;
    padding: 0.5rem 0.75rem;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    border-right: 1px solid var(--border);
    white-space: nowrap;
}

.filter-dict-label:last-of-type {
    border-right: none;
}

.filter-dict-radio:checked + .filter-dict-label {
    background: var(--accent);
    color: #FFFFFF;
}

/* --- Results Header --- */
.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: var(--tool-max-width);
    margin: 0 auto 1rem;
    padding: 0.5rem 0;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.results-count {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

.results-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.view-toggle {
    display: flex;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.view-toggle-btn {
    padding: 0.375rem 1rem;
    border: none;
    background: var(--bg);
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.view-toggle-btn.active {
    background: var(--accent);
    color: #FFFFFF;
}

.view-toggle-btn:first-child {
    border-right: 1px solid var(--border);
}

/* --- Chips View --- */
.word-group {
    max-width: var(--tool-max-width);
    margin: 0 auto 1.5rem;
    text-align: left;
}

.word-group-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.5rem;
    padding-bottom: 0.375rem;
    border-bottom: 2px solid var(--border-light);
}

.word-group:first-child .word-group-title {
    border-bottom-color: var(--accent);
    color: var(--accent-dark);
}

.word-chips {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.5rem;
}

.word-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    font-size: 1rem;
    font-weight: 500;
    color: var(--text);
    text-decoration: none;
    min-height: 44px;
    transition: border-color 0.15s, background 0.15s;
}

.word-chip:hover {
    border-color: var(--accent);
    background: var(--accent-light);
    color: var(--accent-dark);
    text-decoration: none;
}

.word-group:first-child .word-chip {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent-dark);
}

.word-group:first-child .word-chip:hover {
    background: var(--accent);
    color: #FFFFFF;
}

.pts-badge {
    font-size: 1rem;
    font-weight: 600;
    color: var(--accent-dark);
    background: var(--accent-light);
    padding: 0.125rem 0.375rem;
    border-radius: var(--radius-full);
}

.word-group:first-child .pts-badge {
    background: rgba(255, 255, 255, 0.5);
    color: var(--accent-dark);
}

/* --- Table View --- */
.results-table-wrap {
    max-width: var(--tool-max-width);
    margin: 0 auto;
    display: none;
}

.results-table-wrap.active {
    display: block;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.results-table th {
    padding: 0.75rem;
    text-align: left;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    background: var(--bg-subtle);
    border-bottom: 2px solid var(--border);
}

.results-table td {
    padding: 0.625rem 0.75rem;
    font-size: 1rem;
    color: var(--text);
    border-bottom: 1px solid var(--border-light);
}

.results-table tr:last-child td {
    border-bottom: none;
}

.results-table .word-link {
    font-weight: 600;
    color: var(--accent-dark);
    text-decoration: none;
}

.results-table .word-link:hover {
    color: var(--accent);
    text-decoration: underline;
}

.results-table .pts-cell {
    text-align: center;
}

.results-table .pts-pill {
    display: inline-block;
    background: var(--accent-light);
    color: var(--accent-dark);
    font-weight: 600;
    font-size: 1rem;
    padding: 0.125rem 0.5rem;
    border-radius: var(--radius-full);
}

/* --- Loading / No Results --- */
.solver-loading,
.solver-no-results {
    display: none;
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 1.0625rem;
}

.solver-loading.active {
    display: block;
}

.solver-no-results.active {
    display: block;
}

.solver-loading::before {
    content: "";
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-right: 0.5rem;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* --- Dictionary Badges --- */
.dict-badges {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.dict-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.875rem;
    border-radius: var(--radius-full);
    font-size: 1rem;
    font-weight: 600;
    min-height: 36px;
}

.dict-valid {
    background: rgba(16, 185, 129, 0.15);
    color: #065F46;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.dict-invalid {
    background: rgba(107, 114, 128, 0.1);
    color: #6B7280;
    border: 1px solid rgba(107, 114, 128, 0.2);
}

/* --- Anagram Highlight --- */
.word-group-anagram {
    background: var(--accent-light);
    border: 2px solid var(--accent);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
}

.word-group-anagram .word-group-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--accent-dark);
}

.word-group-anagram .word-chip {
    background: var(--accent);
    color: #fff;
}

.word-group-anagram .word-chip:hover {
    background: #059669;
}

.word-group-anagram .word-chip .pts-badge {
    background: rgba(255, 255, 255, 0.3);
    color: #fff;
}

.word-chip-anagram {
    background: var(--accent);
    color: #fff;
}

.anagram-row {
    background: var(--accent-light);
}

.anagram-label {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.125rem 0.5rem;
    background: var(--accent);
    color: #fff;
    border-radius: var(--radius-full);
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    vertical-align: middle;
}

/* --- Responsive --- */
@media (max-width: 480px) {
    .filter-row {
        flex-direction: column;
    }

    .filter-check {
        padding-top: 0;
    }

    .solver-input {
        font-size: 1rem;
        padding: 0.75rem 3.25rem 0.75rem 1rem;
    }

    .word-chips {
        gap: 0.375rem;
    }

    .word-chip {
        padding: 0.25rem 0.625rem;
    }
}
