/**
 * TRINEX FORM ELEMENTS v1.0 - CSS
 * Dedem için özel hazırlanmış form stilleri
 */

/* ============================================
   CSS DEĞİŞKENLERİ
   ============================================ */
:root {
    --trinex-input-border: #e5e7eb;
    --trinex-input-border-focus: #0d9488;
    --trinex-input-bg: #ffffff;
    --trinex-input-bg-readonly: #f9fafb;
    --trinex-input-text: #1f2937;
    --trinex-input-text-readonly: #6b7280;
    --trinex-input-placeholder: #9ca3af;
    --trinex-input-radius: 8px;
    --trinex-input-shadow-focus: 0 0 0 3px rgba(13, 148, 136, 0.15);
    --trinex-label-color: #374151;
    --trinex-required-color: #ef4444;
    --trinex-error-color: #ef4444;
    --trinex-help-color: #6b7280;
}

/* ============================================
   FORM GRUBU
   ============================================ */
.trinex-form-group {
    margin-bottom: 20px;
    position: relative;
}

/* ============================================
   LABEL
   ============================================ */
.trinex-label {
    display: block;
    font-weight: 600;
    font-size: 13px;
    color: var(--trinex-label-color);
    margin-bottom: 6px;
    letter-spacing: -0.01em;
}

.trinex-required {
    color: var(--trinex-required-color);
    margin-left: 3px;
    font-weight: 700;
}

/* ============================================
   INPUT WRAPPER (İkon için)
   ============================================ */
.trinex-input-wrapper {
    position: relative;
}

    .trinex-input-wrapper.has-icon .trinex-input {
        padding-left: 42px;
    }

.trinex-input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--trinex-input-placeholder);
    font-size: 14px;
    z-index: 1;
    pointer-events: none;
    transition: color 0.2s ease;
}

.trinex-input-wrapper:focus-within .trinex-input-icon {
    color: var(--trinex-input-border-focus);
}

/* ============================================
   ANA INPUT STİLİ
   ============================================ */
.trinex-input {
    width: 100%;
    padding: 12px 14px;
    font-size: 14px;
    font-family: inherit;
    color: var(--trinex-input-text);
    background-color: var(--trinex-input-bg);
    border: 2px solid var(--trinex-input-border);
    border-radius: var(--trinex-input-radius);
    outline: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-appearance: none;
    appearance: none;
}

    .trinex-input::placeholder {
        color: var(--trinex-input-placeholder);
    }

    /* Focus durumu */
    .trinex-input:focus {
        border-color: var(--trinex-input-border-focus);
        box-shadow: var(--trinex-input-shadow-focus);
    }

    /* Hover durumu */
    .trinex-input:hover:not(:focus):not(:disabled):not(.trinex-readonly) {
        border-color: #d1d5db;
    }

    /* ============================================
   READONLY DURUMU
   ============================================ */
    .trinex-input.trinex-readonly,
    .trinex-input:disabled,
    .trinex-input[readonly] {
        background-color: var(--trinex-input-bg-readonly);
        color: var(--trinex-input-text-readonly);
        border-color: #f3f4f6;
        cursor: not-allowed;
    }

        .trinex-input.trinex-readonly:focus,
        .trinex-input:disabled:focus,
        .trinex-input[readonly]:focus {
            border-color: #f3f4f6;
            box-shadow: none;
        }

    /* ============================================
   NUMBER INPUT
   ============================================ */
    .trinex-input.trinex-number {
        text-align: right;
        font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
        font-size: 14px;
        letter-spacing: 0.5px;
    }

    /* ============================================
   DATE/TIME INPUTLARI
   ============================================ */
    .trinex-input.trinex-date,
    .trinex-input.trinex-time,
    .trinex-input.trinex-datetime {
        cursor: pointer;
    }

        .trinex-input.trinex-date::-webkit-calendar-picker-indicator,
        .trinex-input.trinex-time::-webkit-calendar-picker-indicator,
        .trinex-input.trinex-datetime::-webkit-calendar-picker-indicator {
            cursor: pointer;
            padding: 4px;
            margin-right: -4px;
            border-radius: 4px;
            transition: background 0.2s;
        }

            .trinex-input.trinex-date::-webkit-calendar-picker-indicator:hover,
            .trinex-input.trinex-time::-webkit-calendar-picker-indicator:hover,
            .trinex-input.trinex-datetime::-webkit-calendar-picker-indicator:hover {
                background: rgba(13, 148, 136, 0.1);
            }

    /* ============================================
   SELECT (Native)
   ============================================ */
    .trinex-input.trinex-select {
        cursor: pointer;
        padding-right: 40px;
        background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
        background-repeat: no-repeat;
        background-position: right 12px center;
        background-size: 14px;
    }

        .trinex-input.trinex-select:focus {
            background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%230d9488' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
        }

/* ============================================
   SELECT2 ÖZEL STİLLERİ
   ============================================ */
.trinex-form-group .select2-container {
    width: 100% !important;
}

.trinex-form-group .select2-container--bootstrap-5 .select2-selection {
    border: 2px solid var(--trinex-input-border) !important;
    border-radius: var(--trinex-input-radius) !important;
    padding: 8px 12px !important;
    min-height: 46px !important;
    transition: all 0.2s ease !important;
}

.trinex-form-group .select2-container--bootstrap-5.select2-container--focus .select2-selection,
.trinex-form-group .select2-container--bootstrap-5.select2-container--open .select2-selection {
    border-color: var(--trinex-input-border-focus) !important;
    box-shadow: var(--trinex-input-shadow-focus) !important;
}

.trinex-form-group .select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    color: var(--trinex-input-text) !important;
    font-size: 14px !important;
    padding: 0 !important;
    line-height: 1.5 !important;
}

.trinex-form-group .select2-container--bootstrap-5 .select2-selection--single .select2-selection__placeholder {
    color: var(--trinex-input-placeholder) !important;
}

.trinex-form-group .select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__choice {
    background-color: var(--trinex-input-border-focus) !important;
    border: none !important;
    color: #fff !important;
    border-radius: 6px !important;
    padding: 4px 10px !important;
    margin: 2px 4px 2px 0 !important;
}

.trinex-form-group .select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__choice__remove {
    color: rgba(255, 255, 255, 0.8) !important;
    margin-right: 6px !important;
}

    .trinex-form-group .select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__choice__remove:hover {
        color: #fff !important;
    }

/* Select2 Dropdown */
.select2-container--bootstrap-5 .select2-dropdown {
    border: 2px solid var(--trinex-input-border) !important;
    border-radius: var(--trinex-input-radius) !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1) !important;
    margin-top: 4px !important;
}

.select2-container--bootstrap-5 .select2-results__option--highlighted {
    background-color: var(--trinex-input-border-focus) !important;
}

.select2-container--bootstrap-5 .select2-results__option--selected {
    background-color: rgba(13, 148, 136, 0.1) !important;
}

/* ============================================
   TEXTAREA
   ============================================ */
.trinex-input.trinex-textarea {
    min-height: 100px;
    resize: vertical;
    line-height: 1.6;
}

/* ============================================
   CHECKBOX
   ============================================ */
.trinex-checkbox-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    color: var(--trinex-input-text);
    user-select: none;
    padding: 8px 0;
}

.trinex-checkbox {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    width: 0;
    height: 0;
}

.trinex-checkbox-mark {
    width: 22px;
    height: 22px;
    background: var(--trinex-input-bg);
    border: 2px solid var(--trinex-input-border);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

    .trinex-checkbox-mark::after {
        content: '';
        width: 6px;
        height: 10px;
        border: solid white;
        border-width: 0 2.5px 2.5px 0;
        transform: rotate(45deg) scale(0);
        transition: transform 0.2s ease;
        margin-top: -2px;
    }

.trinex-checkbox:checked + .trinex-checkbox-mark {
    background: var(--trinex-input-border-focus);
    border-color: var(--trinex-input-border-focus);
}

    .trinex-checkbox:checked + .trinex-checkbox-mark::after {
        transform: rotate(45deg) scale(1);
    }

.trinex-checkbox:focus + .trinex-checkbox-mark {
    box-shadow: var(--trinex-input-shadow-focus);
}

.trinex-checkbox-wrapper:hover .trinex-checkbox-mark {
    border-color: var(--trinex-input-border-focus);
}

/* ============================================
   HELP TEXT
   ============================================ */
.trinex-help-text {
    display: block;
    font-size: 12px;
    color: var(--trinex-help-color);
    margin-top: 6px;
    line-height: 1.4;
}

/* ============================================
   ERROR DURUMU
   ============================================ */
.trinex-input.trinex-error {
    border-color: var(--trinex-error-color) !important;
    background-color: #fef2f2;
}

    .trinex-input.trinex-error:focus {
        box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15) !important;
    }

.trinex-error-message {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--trinex-error-color);
    margin-top: 6px;
}

    .trinex-error-message i {
        font-size: 13px;
    }

/* ============================================
   ANİMASYONLAR
   ============================================ */
@keyframes trinexShake {
    0%, 100% {
        transform: translateX(0);
    }

    20%, 60% {
        transform: translateX(-5px);
    }

    40%, 80% {
        transform: translateX(5px);
    }
}

.trinex-input.trinex-error {
    animation: trinexShake 0.4s ease;
}

/* ============================================
   FORM SATIRI (yan yana inputlar için)
   ============================================ */
.trinex-form-row {
    display: flex;
    gap: 16px;
    margin-bottom: 0;
}

    .trinex-form-row .trinex-form-group {
        flex: 1;
        margin-bottom: 20px;
    }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .trinex-form-row {
        flex-direction: column;
        gap: 0;
    }

    .trinex-input {
        padding: 10px 12px;
        font-size: 16px; /* iOS zoom engelleme */
    }

    .trinex-label {
        font-size: 12px;
    }
}

/* ============================================
   DARK MODE DESTEĞİ (Opsiyonel)
   ============================================ */
@media (prefers-color-scheme: dark) {
    .trinex-form-group[data-theme="auto"] {
        --trinex-input-border: #374151;
        --trinex-input-bg: #1f2937;
        --trinex-input-bg-readonly: #111827;
        --trinex-input-text: #f9fafb;
        --trinex-input-text-readonly: #9ca3af;
        --trinex-input-placeholder: #6b7280;
        --trinex-label-color: #e5e7eb;
    }
}

/* Select2 menüsünü her şeyin önüne getir */
.select2-container--open {
    z-index: 9999999 !important;
}

.select2-dropdown {
    z-index: 9999999 !important;
}

/* Eğer container'da overflow:hidden varsa onu iptal etmemiz gerekebilir */
.component-section, .trinex-group-content {
    overflow: visible !important;
}

/* ... Diğer CSS kodlarının arasına ekle ... */

/* ============================================
   PASSWORD INPUT & TOGGLE
   ============================================ */
.trinex-input.trinex-password {
    padding-right: 40px; /* Göz ikonu için yer aç */
    font-family: 'Verdana', sans-serif; /* Noktalar daha düzgün görünsün */
    letter-spacing: 2px;
}

    /* Şifre görünür olunca font normale dönsün */
    .trinex-input.trinex-password[type="text"] {
        font-family: inherit;
        letter-spacing: normal;
    }

.trinex-password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--trinex-input-placeholder);
    cursor: pointer;
    padding: 4px;
    font-size: 14px;
    transition: color 0.2s;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .trinex-password-toggle:hover {
        color: var(--trinex-input-border-focus);
    }

    .trinex-password-toggle:focus {
        outline: none;
        color: var(--trinex-input-border-focus);
    }