/* ==========================================================================
   UI KIT: FORMS & INPUTS (Текстови полета, Select, Checkbox, Radio)
   ========================================================================== */

/* 1. ГРУПИРАНЕ И ЕТИКЕТИ */
.aopc-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
    width: 100%;
}

.aopc-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--fiptec-slate-800);
    display: flex;
    align-items: center;
    gap: 4px;
}

.aopc-form-hint { font-size: 11px; color: var(--fiptec-slate-500); margin-top: 2px; }
.aopc-form-error { font-size: 12px; font-weight: 700; color: var(--fiptec-red); margin-top: 2px; }

/* 2. БАЗОВО ПОЛЕ (Input, Textarea, Select) */
.aopc-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.aopc-input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--fiptec-slate-200);
    border-radius: var(--fiptec-radius-global, 14px);
    font-family: inherit;
    font-size: 14px;
    color: var(--fiptec-slate-900);
    background-color: var(--fiptec-white);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    outline: none;
    line-height: 1.5;
}

.aopc-input::placeholder { color: var(--fiptec-slate-400); }

/* Активно състояние (Син ринг) */
.aopc-input:focus {
    border-color: var(--fiptec-blue);
    box-shadow: 0 0 0 3px var(--fiptec-blue-light);
}

/* Грешно състояние (Червен ринг) */
.aopc-input.has-error {
    border-color: var(--fiptec-red);
}
.aopc-input.has-error:focus {
    box-shadow: 0 0 0 3px var(--fiptec-red-light-border);
}

/* Заключено състояние */
.aopc-input:disabled {
    background-color: var(--fiptec-slate-50);
    color: var(--fiptec-slate-400);
    cursor: not-allowed;
    border-color: var(--fiptec-slate-100);
}

/* 3. ПОЛЕТА С ИКОНИ (Ляво и Дясно) */
.aopc-input-with-icon-left .aopc-input { padding-left: 40px; }
.aopc-input-icon-left {
    position: absolute;
    left: 14px;
    color: var(--fiptec-slate-400);
    pointer-events: none; /* За да може да се клика през нея */
}

.aopc-input-with-icon-right .aopc-input { padding-right: 40px; }
.aopc-input-icon-right {
    position: absolute;
    right: 14px;
    color: var(--fiptec-slate-400);
    cursor: pointer; /* Често дясната икона е бутон (напр. "Покажи парола" или "Изчисти") */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 4. СПЕЦИФИЧНИ ЕЛЕМЕНТИ (Textarea & Select) */
textarea.aopc-input {
    min-height: 100px;
    resize: vertical; /* Позволява разпъване само надолу */
}

select.aopc-input {
    appearance: none; /* Скрива грозната браузърна стрелка */
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
    cursor: pointer;
}

/* 5. CUSTOM CHECKBOX & RADIO (Модерен App-Look) */
.aopc-control-label {
    display: inline-flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    color: var(--fiptec-slate-700, #334155); /* Добавен fallback */
    margin-bottom: 8px;
    user-select: none;
}

/* Базово скриване на грозните браузърни елементи */
.aopc-checkbox, .aopc-radio {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    /* ТУК Е ФИКСЪТ: Слагаме fallback цвят #94a3b8 и го правим малко по-тъмен за по-добър контраст */
    border: 2px solid var(--fiptec-slate-400, #94a3b8); 
    background-color: var(--fiptec-white, #ffffff);
    display: inline-grid;
    place-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    margin: 0;
    margin-top: 2px;
}

/* Специфична форма */
.aopc-checkbox { border-radius: 6px; }
.aopc-radio { border-radius: 50%; }

/* Ховър на бордера */
.aopc-control-label:hover .aopc-checkbox:not(:disabled),
.aopc-control-label:hover .aopc-radio:not(:disabled) {
    border-color: var(--fiptec-blue-hover, #1d4ed8);
}

/* Маркер (Отметка или Точка) - Първоначално скрит (scale: 0) */
.aopc-checkbox::before, .aopc-radio::before {
    content: "";
    transform: scale(0);
    transition: 120ms transform ease-in-out;
    background-color: var(--fiptec-white, #ffffff);
}

/* Отметка за Чекбокс (SVG рисунка) */
.aopc-checkbox::before {
    width: 12px;
    height: 12px;
    transform-origin: center;
    clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}

/* Точка за Радио бутон */
.aopc-radio::before {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

/* Състояние ИЗБРАНО (Checked) */
.aopc-checkbox:checked, .aopc-radio:checked {
    background-color: var(--fiptec-blue, #2563eb);
    border-color: var(--fiptec-blue, #2563eb);
}
.aopc-checkbox:checked::before, .aopc-radio:checked::before {
    transform: scale(1); /* Показва маркера */
}

/* Състояние ЗАКЛЮЧЕНО (Disabled) */
.aopc-checkbox:disabled, .aopc-radio:disabled {
    background-color: var(--fiptec-slate-100, #f1f5f9);
    border-color: var(--fiptec-slate-200, #e2e8f0);
    cursor: not-allowed;
}
.aopc-control-label:has(input:disabled) {
    color: var(--fiptec-slate-400, #94a3b8);
    cursor: not-allowed;
}