/**
 * "Tøm køleskabet" — Empty Fridge page styles.
 *
 * Design system tokens (shared with meal-plan-form-v2):
 *  --ef-primary       : hsl(140, 45%, 35%)
 *  --ef-primary-light : hsl(140, 45%, 95%)
 *  --ef-border        : hsl(120, 15%, 88%)
 *  --ef-muted         : hsl(120, 10%, 95%)
 *  --ef-foreground    : #1a1a1a
 *  --ef-radius        : 0.75rem
 */

/* ─── Variables ─────────────────────────────────────────────────────── */
.ef-wrapper {
    --ef-primary: hsl(140, 45%, 35%);
    --ef-primary-glow: hsl(140, 60%, 45%);
    --ef-primary-light: hsl(140, 45%, 95%);
    --ef-border: hsl(120, 15%, 88%);
    --ef-muted: hsl(120, 10%, 95%);
    --ef-muted-foreground: hsl(140, 15%, 45%);
    --ef-foreground: #1a1a1a;
    --ef-radius: 0.75rem;
    --ef-radius-lg: 1rem;
    --ef-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    font-family: inherit;
    color: var(--ef-foreground);
}

/* ─── Search Section ────────────────────────────────────────────────── */
.ef-search-section {
    background: linear-gradient(to bottom, rgba(145, 200, 180, 0.35), var(--ef-muted));
    padding: 2.5rem 1rem 2rem;
    text-align: center;
}

@media (min-width: 768px) {
    .ef-search-section {
        padding: 3.5rem 1rem 2.5rem;
    }
}

.ef-search-section-inner {
    max-width: 640px;
    margin: 0 auto;
}

.ef-search-icon-main {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: white;
    box-shadow: 0 4px 16px -4px rgba(107, 123, 107, 0.15);
    margin-bottom: 1.25rem;
}

.ef-search-icon-main svg {
    width: 28px;
    height: 28px;
    color: var(--ef-primary);
}

.ef-search-title {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.2;
    margin: 0 0 0.5rem;
    color: #1d2622;
}

@media (min-width: 768px) {
    .ef-search-title {
        font-size: 2rem;
    }
}

.ef-search-subtitle {
    font-size: 1rem;
    color: var(--ef-muted-foreground);
    margin: 0 0 1.75rem;
    line-height: 1.5;
}

/* ─── Search Input ──────────────────────────────────────────────────── */
.ef-search-box {
    position: relative;
    max-width: 520px;
    margin: 0 auto;
}

.ef-search-input-wrap {
    position: relative;
}

.ef-search-icon {
    position: absolute;
    left: 1.15rem;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--ef-muted-foreground);
    pointer-events: none;
    z-index: 2;
}

.ef-search-input,
input[type="text"].ef-search-input {
    width: 100%;
    padding: 1rem 1.25rem 1rem 3rem;
    border: 2px solid var(--ef-border);
    border-radius: 999px;
    font-size: 1rem;
    height: auto;
    outline: none;
    transition: var(--ef-transition);
    background: white;
    color: var(--ef-foreground);
    box-sizing: border-box;
    box-shadow: 0 4px 20px -4px rgba(80, 120, 95, 0.12);
    -webkit-appearance: none;
    appearance: none;
}

.ef-search-input:focus,
input[type="text"].ef-search-input:focus {
    border-color: var(--ef-primary);
    box-shadow: 0 4px 20px -4px rgba(80, 120, 95, 0.22), 0 0 0 3px hsla(140, 45%, 35%, 0.1);
}

.ef-search-input::placeholder {
    color: var(--ef-muted-foreground);
    font-weight: 400;
}

/* ─── Search Dropdown ───────────────────────────────────────────────── */
.ef-search-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--ef-border);
    border-top: none;
    border-radius: 0 0 var(--ef-radius-lg) var(--ef-radius-lg);
    box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.12);
    z-index: 100;
    max-height: 300px;
    overflow-y: auto;
    margin-top: -2px;
}

.ef-search-dropdown.open {
    display: block;
}

/* When dropdown is open, flatten input bottom corners */
.ef-search-input-wrap.results-open .ef-search-input,
.ef-search-input-wrap.results-open input[type="text"].ef-search-input {
    border-radius: 999px 999px var(--ef-radius-lg) var(--ef-radius-lg);
    border-bottom-color: var(--ef-border);
}

.ef-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.15rem;
    cursor: pointer;
    transition: background 0.15s ease;
    text-align: left;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.ef-dropdown-item:last-child {
    border-bottom: none;
}

.ef-dropdown-item:hover,
.ef-dropdown-item.active {
    background: var(--ef-primary-light);
}

.ef-dropdown-item-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--ef-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.95rem;
    overflow: hidden;
}
.ef-dropdown-item-icon--img {
    padding: 0;
}
.ef-dropdown-item-icon--img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.ef-dropdown-item-text {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.ef-dropdown-item-name {
    font-weight: 500;
    font-size: 0.92rem;
    color: var(--ef-foreground);
}

.ef-dropdown-item-category {
    font-size: 0.75rem;
    color: var(--ef-muted-foreground);
}

.ef-dropdown-empty {
    padding: 1rem 1.15rem;
    text-align: center;
    color: var(--ef-muted-foreground);
    font-size: 0.88rem;
}

/* ─── Ingredients Chips ─────────────────────────────────────────────── */
.ef-ingredients {
    margin-top: 1.5rem;
    text-align: left;
}

.ef-ingredients-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.ef-ingredients-label {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: #2c3d36;
}

.ef-ingredients-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 10px;
    background: var(--ef-primary);
    color: white;
    font-size: 0.72rem;
    font-weight: 700;
}

.ef-clear-all {
    background: none;
    border: none;
    color: var(--ef-muted-foreground);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0.3rem 0.5rem;
    border-radius: 6px;
    transition: var(--ef-transition);
}

.ef-clear-all:hover {
    color: #c0392b;
    background: rgba(192, 57, 43, 0.08);
}

.ef-ingredients-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.ef-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.55rem 0.45rem 0.75rem;
    background: white;
    border: 1px solid var(--ef-border);
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--ef-foreground);
    animation: efChipIn 0.25s ease;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}
.ef-chip-img {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: contain;
    background: var(--ef-muted, #f3f4f6);
    flex-shrink: 0;
    margin-left: -0.25rem;
}

@keyframes efChipIn {
    from {
        opacity: 0;
        transform: scale(0.85);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.ef-chip-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--ef-muted);
    border: none;
    cursor: pointer;
    padding: 0;
    color: var(--ef-muted-foreground);
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.ef-chip-remove:hover {
    background: #e74c3c;
    color: white;
}

.ef-chip-remove svg {
    width: 12px;
    height: 12px;
}

/* ─── Results Section ───────────────────────────────────────────────── */
.ef-results-section {
    padding: 1.5rem 1rem 3rem;
    max-width: 1200px;
    margin: 0 auto;
}

@media (min-width: 768px) {
    .ef-results-section {
        padding: 2rem 1rem 4rem;
    }
}

.ef-results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--ef-border);
}

.ef-results-count {
    font-size: 0.92rem;
    font-weight: 600;
    color: #2c3d36;
}

/* ─── Results Grid ──────────────────────────────────────────────────── */
.ef-results-grid {
    min-height: 200px;
}

.ef-results-grid .legacy-shortcode-grid {
    gap: 1.5rem;
}

/* ─── Match Badge (injected into recipe cards) ──────────────────────── */
.ef-match-badge {
    position: absolute;
    top: 0.65rem;
    left: 0.65rem;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    z-index: 3;
    backdrop-filter: blur(4px);
    line-height: 1.2;
}

.ef-match-badge.ef-match-high {
    background: rgba(39, 174, 96, 0.92);
    color: white;
}

.ef-match-badge.ef-match-medium {
    background: rgba(243, 156, 18, 0.9);
    color: white;
}

.ef-match-badge.ef-match-low {
    background: rgba(255, 255, 255, 0.92);
    color: var(--ef-muted-foreground);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

/* ─── Empty State ───────────────────────────────────────────────────── */
.ef-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 3rem 1rem;
    min-height: 250px;
}

.ef-empty-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: var(--ef-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.ef-empty-icon svg {
    width: 32px;
    height: 32px;
    color: var(--ef-muted-foreground);
}

.ef-empty-text {
    font-size: 1rem;
    font-weight: 600;
    color: #2c3d36;
    margin: 0 0 0.35rem;
}

.ef-empty-hint {
    font-size: 0.88rem;
    color: var(--ef-muted-foreground);
    margin: 0;
}

/* ─── No Results (in grid) ──────────────────────────────────────────── */
.ef-no-results {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--ef-muted-foreground);
    font-size: 0.95rem;
}

/* ─── Loading Indicator ─────────────────────────────────────────────── */
.ef-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    gap: 1rem;
}

.ef-loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--ef-border);
    border-top-color: var(--ef-primary);
    border-radius: 50%;
    animation: efSpin 0.7s linear infinite;
}

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

.ef-loading-text {
    font-size: 0.9rem;
    color: var(--ef-muted-foreground);
    font-weight: 500;
}

/* ─── Load More ─────────────────────────────────────────────────────── */
.ef-load-more {
    text-align: center;
    margin-top: 2rem;
}

.ef-load-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 2rem;
    background: white;
    border: 2px solid var(--ef-border);
    border-radius: 999px;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--ef-foreground);
    cursor: pointer;
    transition: var(--ef-transition);
}

.ef-load-more-btn:hover {
    border-color: var(--ef-primary);
    color: var(--ef-primary);
    box-shadow: 0 4px 16px -4px rgba(40, 160, 90, 0.25);
}

.ef-load-more-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ─── Responsive ────────────────────────────────────────────────────── */
@media (max-width: 767px) {
    .ef-search-section {
        padding: 2rem 0.75rem 1.5rem;
    }

    .ef-search-title {
        font-size: 1.35rem;
    }

    .ef-search-subtitle {
        font-size: 0.9rem;
        margin-bottom: 1.25rem;
    }

    .ef-search-input,
    input[type="text"].ef-search-input {
        font-size: 0.95rem;
        padding: 0.85rem 1rem 0.85rem 2.75rem;
    }

    .ef-search-icon {
        left: 0.9rem;
        width: 18px;
        height: 18px;
    }

    .ef-results-section {
        padding: 1rem 0.5rem 2rem;
    }

    .ef-chip {
        font-size: 0.8rem;
        padding: 0.4rem 0.45rem 0.4rem 0.65rem;
    }

    .ef-search-icon-main {
        width: 48px;
        height: 48px;
        border-radius: 12px;
    }

    .ef-search-icon-main svg {
        width: 24px;
        height: 24px;
    }
}
