/*
 * EnFavori Design System — Foundation
 * -----------------------------------
 * Bu dosya EnFavori arayüzünün ortak tasarım sözleşmesidir.
 *
 * Geçiş prensibi:
 * - Yeni ortak UI kuralları burada tanımlanır.
 * - Sayfaya özel geçici yamalar yerine ef-* primitive/component sınıfları kullanılır.
 * - Eski sayfalar aşamalı olarak taşınır; bu dosya tek başına mevcut görünümü değiştirmez.
 */

:root {
    /* Brand */
    --ef-color-navy: #142844;
    --ef-color-navy-dark: #0d1b2d;
    --ef-color-blue: #1c9cf0;
    --ef-color-blue-dark: #1688d1;
    --ef-color-turquoise: #18c7bb;
    --ef-color-turquoise-dark: #10aa9f;

    /* Neutral */
    --ef-color-white: #ffffff;
    --ef-color-page: #f4f6f8;
    --ef-color-surface: #ffffff;
    --ef-color-surface-soft: #f8fafc;
    --ef-color-text: #172033;
    --ef-color-text-soft: #334155;
    --ef-color-muted: #64748b;
    --ef-color-light: #94a3b8;
    --ef-color-border: #e2e8f0;

    /* Semantic */
    --ef-color-success: #169b78;
    --ef-color-danger: #dc3545;
    --ef-color-warning: #d99a00;
    --ef-color-info-soft: #edf7ff;
    --ef-color-success-soft: #e9fbf8;
    --ef-color-danger-soft: #fff1f2;
    --ef-color-warning-soft: #fff8df;

    /* Typography */
    --ef-font-sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --ef-font-size-xs: 12px;
    --ef-font-size-sm: 13px;
    --ef-font-size-md: 15px;
    --ef-font-size-lg: 18px;
    --ef-font-size-xl: 22px;
    --ef-font-size-2xl: 28px;
    --ef-font-size-3xl: 36px;
    --ef-line-height-tight: 1.2;
    --ef-line-height-normal: 1.5;
    --ef-line-height-relaxed: 1.65;

    /* Spacing — 4px base scale */
    --ef-space-0: 0;
    --ef-space-1: 4px;
    --ef-space-2: 8px;
    --ef-space-3: 12px;
    --ef-space-4: 16px;
    --ef-space-5: 24px;
    --ef-space-6: 32px;
    --ef-space-7: 40px;
    --ef-space-8: 48px;

    /* Shape */
    --ef-radius-sm: 8px;
    --ef-radius-md: 12px;
    --ef-radius-lg: 16px;
    --ef-radius-pill: 999px;

    /* Elevation */
    --ef-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --ef-shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
    --ef-shadow-lg: 0 18px 45px rgba(15, 23, 42, 0.12);

    /* Layout */
    --ef-container-max: 1200px;
    --ef-page-gutter: 24px;
    --ef-control-height: 44px;

    /* Motion */
    --ef-transition-fast: 150ms ease;
    --ef-transition-normal: 220ms ease;
}

/*
 * Scope primitive.
 * Yeni veya taşınmış bir ekranın ana wrapper'ında kullanılır.
 */
.ef-ui,
.ef-ui *,
.ef-ui *::before,
.ef-ui *::after {
    box-sizing: border-box;
}

.ef-ui {
    color: var(--ef-color-text);
    font-family: var(--ef-font-sans);
    font-size: var(--ef-font-size-md);
    line-height: var(--ef-line-height-normal);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.ef-container {
    width: min(100%, var(--ef-container-max));
    margin-inline: auto;
    padding-inline: var(--ef-page-gutter);
}

.ef-stack {
    display: flex;
    flex-direction: column;
    gap: var(--ef-stack-gap, var(--ef-space-4));
}

.ef-cluster {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--ef-cluster-gap, var(--ef-space-3));
}

.ef-grid {
    display: grid;
    grid-template-columns: repeat(var(--ef-grid-columns, 12), minmax(0, 1fr));
    gap: var(--ef-grid-gap, var(--ef-space-5));
}

/* Page heading */
.ef-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--ef-space-5);
    margin-bottom: var(--ef-space-5);
}

.ef-page-header__main {
    min-width: 0;
}

.ef-page-header__actions {
    display: flex;
    flex: 0 0 auto;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: var(--ef-space-2);
}

.ef-page-title {
    margin: 0;
    color: var(--ef-color-navy);
    font-family: var(--ef-font-sans);
    font-size: clamp(24px, 3vw, var(--ef-font-size-3xl));
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.025em;
    overflow-wrap: anywhere;
}

.ef-page-description {
    max-width: 760px;
    margin: var(--ef-space-2) 0 0;
    color: var(--ef-color-muted);
    font-size: var(--ef-font-size-md);
    line-height: var(--ef-line-height-relaxed);
}

/* Card */
.ef-card {
    min-width: 0;
    background: var(--ef-color-surface);
    border: 1px solid var(--ef-color-border);
    border-radius: var(--ef-radius-md);
    box-shadow: var(--ef-shadow-sm);
}

.ef-card__header,
.ef-card__body,
.ef-card__footer {
    padding: var(--ef-space-4);
}

.ef-card__header {
    border-bottom: 1px solid var(--ef-color-border);
}

.ef-card__footer {
    border-top: 1px solid var(--ef-color-border);
}

.ef-card__title {
    margin: 0;
    color: var(--ef-color-text);
    font-size: var(--ef-font-size-lg);
    font-weight: 750;
    line-height: 1.3;
}

/* Buttons */
.ef-btn {
    display: inline-flex;
    min-height: var(--ef-control-height);
    align-items: center;
    justify-content: center;
    gap: var(--ef-space-2);
    padding: 0 16px;
    appearance: none;
    border: 1px solid transparent;
    border-radius: var(--ef-radius-sm);
    cursor: pointer;
    font-family: var(--ef-font-sans);
    font-size: var(--ef-font-size-sm);
    font-weight: 750;
    line-height: 1;
    text-align: center;
    text-decoration: none;
    transition:
        background-color var(--ef-transition-fast),
        border-color var(--ef-transition-fast),
        color var(--ef-transition-fast),
        box-shadow var(--ef-transition-fast),
        transform var(--ef-transition-fast);
}

.ef-btn:hover {
    text-decoration: none;
}

.ef-btn:active {
    transform: translateY(1px);
}

.ef-btn:disabled,
.ef-btn[aria-disabled="true"] {
    cursor: not-allowed;
    opacity: 0.55;
    pointer-events: none;
}

.ef-btn--primary {
    color: var(--ef-color-white);
    background: var(--ef-color-navy);
    border-color: var(--ef-color-navy);
}

.ef-btn--primary:hover {
    color: var(--ef-color-white);
    background: var(--ef-color-navy-dark);
    border-color: var(--ef-color-navy-dark);
}

.ef-btn--accent {
    color: var(--ef-color-white);
    background: var(--ef-color-turquoise-dark);
    border-color: var(--ef-color-turquoise-dark);
}

.ef-btn--accent:hover {
    color: var(--ef-color-white);
    background: var(--ef-color-turquoise);
    border-color: var(--ef-color-turquoise);
}

.ef-btn--secondary {
    color: var(--ef-color-navy);
    background: var(--ef-color-white);
    border-color: var(--ef-color-border);
}

.ef-btn--secondary:hover {
    color: var(--ef-color-navy-dark);
    background: var(--ef-color-surface-soft);
    border-color: #cbd5e1;
}

.ef-btn--ghost {
    color: var(--ef-color-navy);
    background: transparent;
    border-color: transparent;
}

.ef-btn--ghost:hover {
    color: var(--ef-color-navy-dark);
    background: var(--ef-color-surface-soft);
}

.ef-btn--danger {
    color: var(--ef-color-white);
    background: var(--ef-color-danger);
    border-color: var(--ef-color-danger);
}

.ef-btn--sm {
    min-height: 36px;
    padding-inline: 12px;
    font-size: var(--ef-font-size-xs);
}

.ef-btn--lg {
    min-height: 50px;
    padding-inline: 20px;
    font-size: var(--ef-font-size-md);
}

.ef-btn--block {
    width: 100%;
}

/* Forms */
.ef-form-field {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: var(--ef-space-2);
}

.ef-label {
    margin: 0;
    color: var(--ef-color-text-soft);
    font-size: var(--ef-font-size-sm);
    font-weight: 700;
    line-height: 1.35;
}

.ef-help {
    margin: 0;
    color: var(--ef-color-muted);
    font-size: var(--ef-font-size-xs);
    line-height: 1.5;
}

.ef-error {
    margin: 0;
    color: var(--ef-color-danger);
    font-size: var(--ef-font-size-xs);
    font-weight: 650;
    line-height: 1.45;
}

.ef-input,
.ef-select,
.ef-textarea {
    width: 100%;
    min-width: 0;
    color: var(--ef-color-text);
    background: var(--ef-color-white);
    border: 1px solid #cbd5e1;
    border-radius: var(--ef-radius-sm);
    font-family: var(--ef-font-sans);
    font-size: 14px;
    line-height: 1.4;
    transition:
        border-color var(--ef-transition-fast),
        box-shadow var(--ef-transition-fast),
        background-color var(--ef-transition-fast);
}

.ef-input,
.ef-select {
    min-height: var(--ef-control-height);
    padding: 0 12px;
}

.ef-textarea {
    min-height: 120px;
    padding: 11px 12px;
    resize: vertical;
}

.ef-input::placeholder,
.ef-textarea::placeholder {
    color: var(--ef-color-light);
}

.ef-input[aria-invalid="true"],
.ef-select[aria-invalid="true"],
.ef-textarea[aria-invalid="true"] {
    border-color: var(--ef-color-danger);
}

/* Badge */
.ef-badge {
    display: inline-flex;
    min-height: 24px;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 4px 8px;
    color: var(--ef-color-text-soft);
    background: var(--ef-color-surface-soft);
    border: 1px solid var(--ef-color-border);
    border-radius: var(--ef-radius-pill);
    font-size: 10.5px;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
}

.ef-badge--info {
    color: #075985;
    background: var(--ef-color-info-soft);
    border-color: #cfe9fb;
}

.ef-badge--success {
    color: #08715a;
    background: var(--ef-color-success-soft);
    border-color: #bcebe2;
}

.ef-badge--warning {
    color: #7a4d00;
    background: var(--ef-color-warning-soft);
    border-color: #efd27a;
}

.ef-badge--danger {
    color: #9f1239;
    background: var(--ef-color-danger-soft);
    border-color: #fecdd3;
}

/* Empty state */
.ef-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--ef-space-3);
    min-height: 220px;
    padding: var(--ef-space-6);
    color: var(--ef-color-muted);
    background: var(--ef-color-surface);
    border: 1px dashed #cbd5e1;
    border-radius: var(--ef-radius-md);
    text-align: center;
}

.ef-empty-state__title {
    margin: 0;
    color: var(--ef-color-text);
    font-size: var(--ef-font-size-lg);
    font-weight: 750;
}

.ef-empty-state__text {
    max-width: 560px;
    margin: 0;
    line-height: var(--ef-line-height-relaxed);
}

/* Simple table shell */
.ef-table-wrap {
    width: 100%;
    overflow-x: auto;
    background: var(--ef-color-white);
    border: 1px solid var(--ef-color-border);
    border-radius: var(--ef-radius-md);
}

.ef-table {
    width: 100%;
    border-collapse: collapse;
    color: var(--ef-color-text-soft);
    font-family: var(--ef-font-sans);
    font-size: var(--ef-font-size-sm);
}

.ef-table th,
.ef-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--ef-color-border);
    text-align: left;
    vertical-align: middle;
}

.ef-table th {
    color: var(--ef-color-navy);
    background: var(--ef-color-surface-soft);
    font-size: var(--ef-font-size-xs);
    font-weight: 800;
    letter-spacing: 0.02em;
}

.ef-table tr:last-child td {
    border-bottom: 0;
}

/* Accessibility */
.ef-btn:focus-visible,
.ef-input:focus-visible,
.ef-select:focus-visible,
.ef-textarea:focus-visible,
.ef-ui a:focus-visible {
    outline: 3px solid rgba(28, 156, 240, 0.25);
    outline-offset: 2px;
}

.ef-input:focus,
.ef-select:focus,
.ef-textarea:focus {
    border-color: var(--ef-color-blue);
    box-shadow: 0 0 0 3px rgba(28, 156, 240, 0.12);
    outline: 0;
}

.ef-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 767.98px) {
    :root {
        --ef-page-gutter: 16px;
        --ef-control-height: 44px;
    }

    .ef-page-header {
        flex-direction: column;
        gap: var(--ef-space-3);
        margin-bottom: var(--ef-space-4);
    }

    .ef-page-header__actions {
        width: 100%;
        justify-content: flex-start;
    }

    .ef-page-title {
        font-size: 24px;
        line-height: 1.18;
    }

    .ef-card__header,
    .ef-card__body,
    .ef-card__footer {
        padding: var(--ef-space-3);
    }

    .ef-grid {
        grid-template-columns: 1fr;
        gap: var(--ef-space-4);
    }
}

@media (prefers-reduced-motion: reduce) {
    .ef-ui *,
    .ef-ui *::before,
    .ef-ui *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
