﻿/* ============================================
   ETI GIDA — UI Components
   Label · Input · Checkbox · Radio ·
   Button · Table · File Upload · Toast
   ============================================ */

/* ─────────────────────────────────────────────
   LABEL & INPUT
   ───────────────────────────────────────────── */
.eti-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--eti-gray-600);
    letter-spacing: 0.3px;
    text-transform: none;
    margin-bottom: 5px;
}

.eti-required {
    color: var(--eti-red);
    font-weight: 700;
}

.eti-input {
    width: 100%;
    padding: 9px 13px;
    border: 1.5px solid var(--eti-border);
    border-radius: var(--eti-radius-sm);
    font-size: 0.88rem;
    font-family: inherit;
    color: var(--eti-text);
    background: #fff;
    transition: border-color var(--eti-duration) var(--eti-ease),
                box-shadow var(--eti-duration) var(--eti-ease),
                background var(--eti-duration);
    outline: none;
    appearance: none;
}

    .eti-input:hover:not(:disabled):not([readonly]) {
        border-color: var(--eti-gray-300);
    }

    .eti-input:focus {
        border-color: var(--eti-red);
        background: #fff;
        box-shadow: 0 0 0 3px rgba(217,27,40,0.08);
    }

    .eti-input::placeholder {
        color: var(--eti-gray-300);
        font-weight: 400;
    }

    .eti-input[readonly],
    .eti-input:disabled {
        background: var(--eti-gray-50);
        border-color: var(--eti-gray-200);
        color: var(--eti-text-muted);
        cursor: not-allowed;
    }

    /* Bölüm başlığındaki "salt okunur" etiketi. Genişletme ekranında lokal bir <style>
       bloğunda duruyordu; Değişiklik ekranının kapalı Şirket Kodu / Satınalma bölümleri
       de kullandığı için ortak stile alındı. */
    .eti-readonly-badge {
        display: inline-block;
        margin-left: 8px;
        padding: 2px 8px;
        border-radius: 10px;
        font-size: .72rem;
        font-weight: 600;
        background: rgba(120, 120, 120, .14);
        color: #666;
        vertical-align: middle;
    }

    .eti-input--error {
        border-color: var(--eti-red);
        box-shadow: 0 0 0 3px rgba(217,27,40,0.08);
    }

    .eti-input--success {
        border-color: var(--eti-success);
        box-shadow: 0 0 0 3px rgba(5,150,105,0.08);
    }

.eti-input--table {
    padding: 7px 10px;
    border-radius: var(--eti-radius-xs);
    font-size: 0.83rem;
    border-width: 1px;
    background: var(--eti-gray-50);
    width: auto;
    min-width: 120px;
    max-width: 500px;
}

.eti-hint {
    font-size: 0.72rem;
    color: var(--eti-text-muted);
    font-style: italic;
    line-height: 1.4;
    margin-top: 3px;
}

.eti-error-msg {
    display: none;
    font-size: 0.73rem;
    color: var(--eti-red);
    font-weight: 600;
    margin-top: 3px;
}

.eti-input--error ~ .eti-error-msg {
    display: block;
}

.eti-text-muted {
    color: var(--eti-text-muted);
    font-size: 0.88rem;
}

/* ─────────────────────────────────────────────
   CHECKBOX
   ───────────────────────────────────────────── */
.eti-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--eti-text);
    cursor: pointer;
    user-select: none;
}

    .eti-checkbox input[type="checkbox"] {
        width: 16px;
        height: 16px;
        accent-color: var(--eti-red);
        cursor: pointer;
        flex-shrink: 0;
    }

.eti-form-group--checkbox {
    justify-content: center;
}

.eti-checkbox-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

    .eti-checkbox-grid .eti-checkbox {
        padding: 8px 16px;
        border-radius: var(--eti-radius-sm);
        border: 1.5px solid var(--eti-border);
        background: #fff;
        transition: all var(--eti-duration) var(--eti-ease);
        font-size: 0.84rem;
    }

        .eti-checkbox-grid .eti-checkbox:hover {
            border-color: var(--eti-red);
            background: var(--eti-red-light);
        }

        .eti-checkbox-grid .eti-checkbox:has(input:checked) {
            border-color: var(--eti-red);
            background: var(--eti-red-light);
            color: var(--eti-red);
        }

/* ─────────────────────────────────────────────
   RADIO / TOGGLE GROUP
   ───────────────────────────────────────────── */
.eti-toggle-group {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.eti-radio {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--eti-text);
    cursor: pointer;
    user-select: none;
    padding: 8px 16px;
    border-radius: var(--eti-radius-sm);
    border: 1.5px solid var(--eti-border);
    background: #fff;
    transition: all var(--eti-duration) var(--eti-ease);
}

    .eti-radio:hover {
        border-color: var(--eti-red);
        background: var(--eti-red-light);
    }

    .eti-radio input[type="radio"] {
        width: 15px;
        height: 15px;
        accent-color: var(--eti-red);
        cursor: pointer;
        flex-shrink: 0;
    }

    .eti-radio:has(input:checked) {
        border-color: var(--eti-red);
        background: var(--eti-red-light);
        color: var(--eti-red);
    }

/* ─────────────────────────────────────────────
   TABLE
   ───────────────────────────────────────────── */
.eti-table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--eti-border);
    border-radius: var(--eti-radius-sm);
    background: #fff;
    box-shadow: var(--eti-shadow-xs);
}

.eti-table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    font-size: 0.84rem;
}

    .eti-table thead {
        background: var(--eti-gray-50);
        border-bottom: 2px solid var(--eti-border);
    }

    .eti-table th {
        padding: 11px 14px;
        font-weight: 700;
        font-size: 0.75rem;
        color: var(--eti-gray-600);
        text-align: left;
        white-space: nowrap;
        letter-spacing: 0.4px;
        text-transform: uppercase;
    }

    .eti-table td {
        padding: 9px 12px;
        border-bottom: 1px solid var(--eti-gray-100);
        vertical-align: middle;
        white-space: nowrap;
    }

    .eti-table tbody tr:last-child td {
        border-bottom: none;
    }

    .eti-table tbody tr:hover td {
        background: var(--eti-gray-50);
    }

/* Hidden sizer element for auto-width inputs */
.eti-input-sizer {
    position: absolute;
    top: -9999px;
    left: -9999px;
    visibility: hidden;
    white-space: pre;
    pointer-events: none;
}

/* ─────────────────────────────────────────────
   BUTTONS
   ───────────────────────────────────────────── */
.eti-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 22px;
    border-radius: 50px;
    font-size: 0.86rem;
    font-weight: 700;
    font-family: inherit;
    border: 1.5px solid transparent;
    cursor: pointer;
    transition: all var(--eti-duration) var(--eti-ease);
    text-decoration: none;
    white-space: nowrap;
    line-height: 1;
}

    .eti-btn:focus-visible {
        outline: 2px solid var(--eti-red);
        outline-offset: 3px;
    }

.eti-btn--primary {
    background: var(--eti-red);
    color: #fff;
    border-color: var(--eti-red);
    box-shadow: var(--eti-shadow-red);
}

    .eti-btn--primary:hover {
        background: var(--eti-red-dark);
        border-color: var(--eti-red-dark);
        color: #fff;
        transform: translateY(-1px);
        box-shadow: 0 12px 28px rgba(217,27,40,0.28);
        text-decoration: none;
    }

    .eti-btn--primary:active {
        transform: translateY(0);
        box-shadow: var(--eti-shadow-red);
    }

.eti-btn--outline {
    background: #fff;
    color: var(--eti-text);
    border-color: var(--eti-border);
}

    .eti-btn--outline:hover {
        border-color: var(--eti-red);
        color: var(--eti-red);
        background: var(--eti-red-light);
        text-decoration: none;
    }

.eti-btn--ghost {
    background: transparent;
    color: var(--eti-text-muted);
    border-color: transparent;
}

    .eti-btn--ghost:hover {
        color: var(--eti-red);
        background: var(--eti-red-light);
        text-decoration: none;
    }

.eti-btn--sm {
    padding: 6px 14px;
    font-size: 0.78rem;
    border-radius: var(--eti-radius-xs);
    background: var(--eti-gray-100);
    color: var(--eti-gray-600);
    border-color: var(--eti-border);
}

    .eti-btn--sm:hover {
        background: var(--eti-red);
        color: #fff;
        border-color: var(--eti-red);
    }

.eti-btn-icon {
    width: 34px;
    height: 34px;
    border: 1.5px solid var(--eti-border);
    border-radius: var(--eti-radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: #fff;
    color: var(--eti-text-muted);
    transition: all var(--eti-duration) var(--eti-ease);
    flex-shrink: 0;
}

    .eti-btn-icon:hover {
        background: var(--eti-gray-50);
        border-color: var(--eti-gray-300);
    }

    .eti-btn-icon--danger:hover {
        background: var(--eti-red-light);
        border-color: var(--eti-red);
        color: var(--eti-red);
    }

.eti-btn--loading {
    pointer-events: none;
    opacity: 0.7;
}

    .eti-btn--loading::after {
        content: '';
        width: 13px;
        height: 13px;
        border: 2px solid rgba(255,255,255,0.3);
        border-top-color: #fff;
        border-radius: 50%;
        animation: eti-spin 0.65s linear infinite;
    }

@keyframes eti-spin {
    to { transform: rotate(360deg); }
}

/* ─────────────────────────────────────────────
   FILE UPLOAD
   ───────────────────────────────────────────── */
.eti-file-upload {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.eti-file-upload__input {
    display: none;
}

.eti-file-upload__btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: var(--eti-gray-100);
    color: var(--eti-gray-600);
    font-size: 0.8rem;
    font-weight: 700;
    font-family: inherit;
    border-radius: var(--eti-radius-xs);
    border: 1.5px solid var(--eti-border);
    white-space: nowrap;
    transition: all var(--eti-duration) var(--eti-ease);
    flex-shrink: 0;
    cursor: pointer;
}

.eti-file-upload:hover .eti-file-upload__btn {
    background: var(--eti-red);
    color: #fff;
    border-color: var(--eti-red);
}

.eti-file-upload__name {
    font-size: 0.78rem;
    color: var(--eti-text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 160px;
}

.eti-file-upload__name--selected {
    color: var(--eti-text);
    font-weight: 600;
}

/* ─────────────────────────────────────────────
   ATTACHMENT LIST
   ───────────────────────────────────────────── */
.eti-attachment-list {
    display: flex;
    flex-direction: column;
}

.eti-attachment-row {
    display: grid;
    grid-template-columns: 1fr 260px;
    align-items: center;
    gap: 20px;
    padding: 14px 0;
    border-bottom: 1px solid var(--eti-gray-100);
}

    .eti-attachment-row:last-child {
        border-bottom: none;
    }

.eti-attachment-row__info {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.eti-attachment-row__category {
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--eti-text);
}

.eti-attachment-row__hint {
    font-size: 0.72rem;
    color: var(--eti-text-muted);
    line-height: 1.4;
}

/* ─────────────────────────────────────────────
   TOAST
   ───────────────────────────────────────────── */
.eti-toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 9999;
    pointer-events: none;
}

.eti-toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    border-radius: var(--eti-radius-sm);
    background: #fff;
    box-shadow: var(--eti-shadow-lg);
    border-left: 4px solid var(--eti-red);
    min-width: 280px;
    pointer-events: all;
    animation: eti-toast-in 0.35s var(--eti-ease-out);
}

    .eti-toast--success { border-left-color: var(--eti-success); }
    .eti-toast--warning { border-left-color: var(--eti-yellow); }
    .eti-toast--error   { border-left-color: var(--eti-red); }

@keyframes eti-toast-in {
    from { transform: translateX(100px); opacity: 0; }
    to   { transform: translateX(0);     opacity: 1; }
}

/* ─────────────────────────────────────────────
   RESPONSIVE
   ───────────────────────────────────────────── */
@media (max-width: 767px) {
    .eti-attachment-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .eti-toggle-group {
        flex-direction: column;
        align-items: flex-start;
    }
}
