/* ESA BIC Listings — esabic-listings.css
 * Design system: Trusty Azure #009bdb, Pure Teal #00ae9d, Deep Space #003247
 * Radius: buttons 6px (md), cards 8px (lg), pills 9999px (full)
 * Fonts: Outfit (headings/numbers), Inter (body) — loaded by esabic-theme
 */

/* ── Design tokens ────────────────────────────────────────────────────────── */

.esabic-listings-grid,
.esabic-form-wrap,
.esabic-edit-page {
    --el-primary:        #009bdb;
    --el-primary-dark:   #007db3;
    --el-teal:           #00ae9d;
    --el-space:          #003247;
    --el-red:            #d91b2b;
    --el-surface:        #f5f8f9;
    --el-border:         hsl(204 20% 88%);
    --el-text:           #111827;
    --el-text-muted:     #4b5563;
    --el-text-faint:     #6b7280;
    --el-radius-md:      6px;
    --el-radius-lg:      8px;
    --el-radius-full:    9999px;
    --el-shadow-card:    0 1px 3px hsl(0 0% 0% / 0.05);
    --el-shadow-hover:   0 4px 16px hsl(197 100% 43% / 0.10);
    --el-focus-ring:     0 0 0 3px hsl(197 100% 43% / 0.18);
    --el-font-body:      'Inter', system-ui, sans-serif;
    --el-font-display:   'Outfit', system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
    .esabic-listings-grid,
    .esabic-form-wrap,
    .esabic-edit-page {
        --el-surface:    hsl(198 60% 10%);
        --el-border:     hsl(197 30% 22%);
        --el-text:       hsl(204 15% 92%);
        --el-text-muted: hsl(204 10% 70%);
        --el-text-faint: hsl(204 8% 55%);
        --el-shadow-card: 0 1px 3px hsl(0 0% 0% / 0.25);
    }
    .esabic-listing-card {
        background: hsl(198 50% 12%);
        border-color: var(--el-border);
    }
    .esabic-form-wrap,
    .esabic-edit-page { color: var(--el-text); }
    .esabic-fieldset { background: hsl(198 50% 11%); border-color: var(--el-border); }
    .esabic-type-card { background: hsl(198 50% 12%); border-color: var(--el-border); }
    .esabic-type-card strong { color: var(--el-text); }
    .esabic-field input,
    .esabic-field select,
    .esabic-field textarea {
        background: hsl(198 50% 10%);
        border-color: var(--el-border);
        color: var(--el-text);
    }
}

/* ── Text selection ────────────────────────────────────────────────────────── */

.esabic-listings-grid ::selection,
.esabic-form-wrap ::selection,
.esabic-edit-page ::selection {
    background: hsl(197 100% 43% / 0.18);
    color: var(--el-space);
}

.esabic-field input,
.esabic-field textarea {
    caret-color: var(--el-primary);
}

/* ── Kuulutuste nimekiri ───────────────────────────────────────────────────── */

.esabic-listings-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.esabic-filter-btn {
    padding: 5px 14px;
    border: 1.5px solid var(--el-border, #d1d5db);
    border-radius: var(--el-radius-full, 9999px);
    background: transparent;
    color: var(--el-text-muted, #4b5563);
    font-family: var(--el-font-body);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    line-height: 1.5;
}

.esabic-filter-btn:hover {
    border-color: var(--el-primary);
    color: var(--el-primary);
}

.esabic-filter-btn.active {
    background: var(--el-primary);
    border-color: var(--el-primary);
    color: #fff;
}

.esabic-filter-btn:focus-visible {
    outline: none;
    box-shadow: var(--el-focus-ring);
}

.esabic-listings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.esabic-listings-empty {
    color: var(--el-text-faint);
    font-style: italic;
    font-family: var(--el-font-body);
}

/* ── Kuulutuse kaart ──────────────────────────────────────────────────────── */

.esabic-listing-card {
    background: #fff;
    border: 1px solid var(--el-border);
    border-radius: var(--el-radius-lg);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: var(--el-shadow-card);
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.esabic-listing-card:hover {
    border-color: hsl(197 100% 43% / 0.35);
    box-shadow: var(--el-shadow-hover);
}

.esabic-listing-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.esabic-listing-logo {
    width: 40px;
    height: 40px;
    border-radius: var(--el-radius-md);
    object-fit: contain;
    background: var(--el-surface);
    padding: 4px;
    flex-shrink: 0;
    border: 1px solid var(--el-border);
}

.esabic-listing-logo-placeholder {
    width: 40px;
    height: 40px;
    border-radius: var(--el-radius-md);
    background: hsl(197 60% 92%);
    color: hsl(197 100% 25%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--el-font-display);
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
}

.esabic-listing-type {
    display: inline-block;
    font-family: var(--el-font-body);
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--el-radius-full);
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.esabic-type-job {
    background: hsl(197 100% 43% / 0.12);
    color: hsl(197 100% 28%);
}

.esabic-type-cofounding {
    background: hsl(174 100% 34% / 0.12);
    color: hsl(174 100% 20%);
}

@media (prefers-color-scheme: dark) {
    .esabic-type-job { background: hsl(197 80% 30% / 0.25); color: hsl(197 100% 70%); }
    .esabic-type-cofounding { background: hsl(174 80% 25% / 0.25); color: hsl(174 100% 65%); }
}

.esabic-listing-company {
    font-family: var(--el-font-body);
    font-size: 0.8125rem;
    color: var(--el-text-muted);
    margin-top: 2px;
}

.esabic-listing-title {
    font-family: var(--el-font-display);
    font-size: 0.9375rem;
    font-weight: 600;
    margin: 0;
    line-height: 1.4;
    color: var(--el-text);
}

.esabic-listing-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.15s;
}

.esabic-listing-title a:hover {
    color: var(--el-primary);
}

.esabic-listing-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.esabic-tag {
    font-family: var(--el-font-body);
    font-size: 0.75rem;
    padding: 2px 8px;
    background: hsl(204 20% 93%);
    border-radius: var(--el-radius-full);
    color: var(--el-text-muted);
    white-space: nowrap;
}

@media (prefers-color-scheme: dark) {
    .esabic-tag { background: hsl(197 30% 20%); color: var(--el-text-muted); }
}

.esabic-tag-deadline {
    background: hsl(39 96% 48% / 0.12);
    color: hsl(32 90% 30%);
}

@media (prefers-color-scheme: dark) {
    .esabic-tag-deadline { background: hsl(39 80% 30% / 0.2); color: hsl(39 90% 65%); }
}

.esabic-listing-excerpt {
    font-family: var(--el-font-body);
    font-size: 0.8125rem;
    color: var(--el-text-muted);
    line-height: 1.65;
    flex: 1;
}

.esabic-listing-excerpt p { margin: 0; }

.esabic-listing-link {
    font-family: var(--el-font-body);
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--el-primary);
    text-decoration: none;
    align-self: flex-start;
    transition: color 0.15s;
}

.esabic-listing-link:hover {
    color: var(--el-primary-dark);
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* ── Vorm: wrapper ────────────────────────────────────────────────────────── */

.esabic-form-wrap,
.esabic-edit-page {
    max-width: 660px;
    margin: 0 auto;
    font-family: var(--el-font-body);
    color: var(--el-text);
}

.esabic-form-heading {
    font-family: var(--el-font-display);
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--el-text);
    margin: 0 0 18px;
}

/* ── Liigi valimiskaardid ─────────────────────────────────────────────────── */

.esabic-type-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

@media (max-width: 480px) {
    .esabic-type-cards { grid-template-columns: 1fr; }
}

.esabic-type-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
    padding: 24px 20px;
    background: #fff;
    border: 1.5px solid var(--el-border);
    border-radius: var(--el-radius-lg);
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
    box-shadow: var(--el-shadow-card);
}

.esabic-type-card:hover {
    border-color: var(--el-primary);
    box-shadow: 0 0 0 3px hsl(197 100% 43% / 0.10), var(--el-shadow-card);
}

.esabic-type-card:focus-visible {
    outline: none;
    box-shadow: var(--el-focus-ring);
    border-color: var(--el-primary);
}

.esabic-type-card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: var(--el-radius-lg);
    background: hsl(197 80% 95%);
    color: var(--el-primary);
    flex-shrink: 0;
}

@media (prefers-color-scheme: dark) {
    .esabic-type-card-icon {
        background: hsl(197 60% 18%);
        color: hsl(197 100% 68%);
    }
}

.esabic-type-card-icon svg {
    display: block;
}

.esabic-type-card strong {
    font-family: var(--el-font-display);
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--el-text);
    display: block;
}

.esabic-type-card span {
    font-size: 0.8rem;
    color: var(--el-text-faint);
    line-height: 1.4;
}

/* ── Fieldset ─────────────────────────────────────────────────────────────── */

.esabic-fieldset {
    border: 1px solid var(--el-border);
    border-radius: var(--el-radius-lg);
    padding: 18px 18px 14px;
    margin: 16px 0 0;
    background: #fff;
}

.esabic-fieldset legend {
    font-family: var(--el-font-display);
    font-weight: 600;
    font-size: 0.875rem;
    padding: 0 8px;
    color: var(--el-text);
    letter-spacing: 0.01em;
}

/* ── Väljad ───────────────────────────────────────────────────────────────── */

.esabic-field {
    margin-bottom: 14px;
}

.esabic-field:last-child {
    margin-bottom: 0;
}

.esabic-field label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--el-text);
    margin-bottom: 5px;
}

.esabic-field input[type="text"],
.esabic-field input[type="email"],
.esabic-field input[type="date"],
.esabic-field select,
.esabic-field textarea {
    width: 100%;
    padding: 8px 11px;
    border: 1.5px solid var(--el-border);
    border-radius: var(--el-radius-md);
    font-family: var(--el-font-body);
    font-size: 0.9rem;
    color: var(--el-text);
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
    line-height: 1.5;
}

.esabic-field input:focus,
.esabic-field select:focus,
.esabic-field textarea:focus {
    outline: none;
    border-color: var(--el-primary);
    box-shadow: 0 0 0 3px hsl(197 100% 43% / 0.14);
}

.esabic-field textarea {
    resize: vertical;
    min-height: 120px;
}

.esabic-field-invalid {
    border-color: var(--el-red) !important;
    box-shadow: 0 0 0 3px hsl(354 85% 49% / 0.10) !important;
}

.esabic-field-hint {
    font-size: 0.75rem;
    color: var(--el-text-faint);
    margin: 4px 0 0;
    line-height: 1.5;
}

.esabic-field-hint a {
    color: var(--el-primary);
    text-decoration: none;
}

.esabic-field-hint a:hover {
    text-decoration: underline;
    text-underline-offset: 2px;
}

.esabic-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 14px;
}

.esabic-field-row .esabic-field {
    margin-bottom: 0;
}

@media (max-width: 480px) {
    .esabic-field-row { grid-template-columns: 1fr; }
}

/* ── Vormipõhi ────────────────────────────────────────────────────────────── */

.esabic-form-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid var(--el-border);
    flex-wrap: wrap;
}

/* ── Nupud ────────────────────────────────────────────────────────────────── */

.esabic-btn-primary {
    padding: 9px 20px;
    background: var(--el-primary);
    color: #fff;
    border: none;
    border-radius: var(--el-radius-md);
    font-family: var(--el-font-body);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
    display: inline-block;
    line-height: 1.5;
}

.esabic-btn-primary:hover {
    background: var(--el-primary-dark);
    color: #fff;
}

.esabic-btn-primary:focus-visible {
    outline: none;
    box-shadow: var(--el-focus-ring);
}

.esabic-btn-primary:disabled {
    background: hsl(197 100% 43% / 0.45);
    cursor: not-allowed;
}

.esabic-btn-ghost {
    padding: 9px 14px;
    background: transparent;
    color: var(--el-text-muted);
    border: 1.5px solid var(--el-border);
    border-radius: var(--el-radius-md);
    font-family: var(--el-font-body);
    font-size: 0.9rem;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
    text-decoration: none;
    display: inline-block;
    line-height: 1.5;
}

.esabic-btn-ghost:hover {
    border-color: hsl(204 20% 65%);
    color: var(--el-text);
}

.esabic-btn-ghost:focus-visible {
    outline: none;
    box-shadow: var(--el-focus-ring);
}

/* ── Teated ───────────────────────────────────────────────────────────────── */

.esabic-message {
    text-align: center;
    padding: 36px 24px;
    border-radius: var(--el-radius-lg);
}

.esabic-message-success {
    background: hsl(152 60% 96%);
    border: 1px solid hsl(152 50% 82%);
}

.esabic-message-success h3 {
    font-family: var(--el-font-display);
    color: hsl(152 70% 22%);
    margin: 10px 0 6px;
    font-size: 1.0625rem;
}

.esabic-message-success p {
    color: var(--el-text-muted);
    margin: 0;
    font-size: 0.875rem;
}

.esabic-message-error {
    background: hsl(354 80% 97%);
    border: 1px solid hsl(354 70% 86%);
    color: hsl(354 70% 38%);
    padding: 11px 14px;
    text-align: left;
    border-radius: var(--el-radius-md);
    font-size: 0.8125rem;
    margin-top: 12px;
    line-height: 1.5;
}

.esabic-message-icon {
    font-size: 2rem;
    line-height: 1;
    color: hsl(152 70% 35%);
}

/* ── Teatis ───────────────────────────────────────────────────────────────── */

.esabic-notice {
    padding: 10px 14px;
    border-radius: var(--el-radius-md);
    font-size: 0.8125rem;
    margin-bottom: 18px;
    line-height: 1.5;
}

.esabic-notice-info {
    background: hsl(197 80% 95%);
    border: 1px solid hsl(197 60% 80%);
    color: hsl(197 100% 22%);
}

/* ── Muutmisleht ──────────────────────────────────────────────────────────── */

.esabic-edit-page h1 {
    font-family: var(--el-font-display);
    font-size: 1.375rem;
    font-weight: 600;
    color: var(--el-text);
    margin: 0 0 4px;
}

.esabic-edit-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--el-border);
}

.esabic-edit-logo {
    width: 52px;
    height: 52px;
    border-radius: var(--el-radius-lg);
    object-fit: contain;
    background: var(--el-surface);
    padding: 6px;
    border: 1px solid var(--el-border);
    flex-shrink: 0;
}

.esabic-edit-company {
    font-family: var(--el-font-body);
    font-size: 0.875rem;
    color: var(--el-text-muted);
    margin: 0;
}

/* ── Responsiivsus ────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
    .esabic-listings-grid {
        grid-template-columns: 1fr;
    }
    .esabic-form-footer {
        flex-direction: column-reverse;
        align-items: stretch;
    }
    .esabic-btn-primary,
    .esabic-btn-ghost {
        text-align: center;
        width: 100%;
    }
}
