﻿/* ==================================================
   CUSTOM INPUT
   هماهنگ با قالب custom-education-theme
   ================================================== */

.custom-input {
    position: relative;
}

    .custom-input input[type="text"],
    .custom-input input[type="password"],
    .custom-input select,
    .custom-input textarea,
    .custom-input img {
        display: block;
        width: 100%;
        padding: .675rem .75rem;
        border: 2px solid var(--neutral-border);
        border-radius: var(--radius-md);
        color: var(--text-primary);
        font-family: var(--font-family);
        font-size: 16px;
        background-color: transparent;
        box-sizing: border-box;
        transition: var(--transition);
        outline: none;
    }

        .custom-input input[type="text"]:focus,
        .custom-input input[type="password"]:focus,
        .custom-input select:focus,
        .custom-input textarea:focus {
            border-color: var(--accent);
            box-shadow: 0 0 0 4px var(--accent-glow-15);
        }

        /* ============ DISABLED ============ */
        .custom-input input[type="text"]:disabled,
        .custom-input input[type="password"]:disabled,
        .custom-input select:disabled,
        .custom-input textarea:disabled {
            background-color: var(--glass-bg);
            border-color: var(--input-border);
            color: var(--text-secondary);
            cursor: not-allowed;
            opacity: 0.6;
        }

    /* ============ IMAGE SELECTOR SPECIAL CASE ============ */
    .custom-input:has(.custom-image-selector-container) {
        height: 100%;
    }

        .custom-input:has(.custom-image-selector-container) img {
            border: unset !important;
            border-radius: unset !important;
        }

    /* ============ TEXT INPUT (بدون shadow) ============ */
    .custom-input input[type="text"],
    .custom-input input[type="password"] {
        box-shadow: none;
    }

    /* ============ IMAGE LIST ============ */
    .custom-input .custom-image-list {
        position: relative;
        z-index: 1;
        height: unset;
    }

    /* ============ TEXT ALIGN HELPERS ============ */
    .custom-input .text-right {
        text-align: right;
    }

    .custom-input .text-center {
        text-align: center;
    }

    .custom-input .text-left {
        text-align: left;
    }

    .custom-input .text-justify {
        text-align: justify;
    }

    /* ============ MASK / CURRENCY ============ */
    .custom-input input[mask]:not([mask=""]) {
        letter-spacing: 3px;
    }

    .custom-input input[original-type="currency"] {
        letter-spacing: 1px;
    }

    /* ============ FLOATING LABEL ============ */
    .custom-input > label:not(:empty) {
        position: absolute;
        color: var(--accent);
        background-color: var(--bg-primary);
        border-radius: var(--radius-sm);
        top: 1px;
        left: 14px;
        transform: translateY(-50%);
        font-size: 12px;
        font-weight: 600;
        padding: 2px 6px;
        z-index: 2;
    }

    .custom-input:has(input[required], select[required], textarea[required], div[required], [contenteditable][required]) > label:not(:empty)::after {
        content: " *";
        color: #ff4d4f;
        font-weight: bold;
    }

[dir="rtl"] .custom-input > label:not(:empty) {
    left: unset;
    right: 14px;
}

/* ============ CUSTOM DROPDOWN (input wrapper) ============ */
.custom-dropdown {
    position: relative;
}

    .custom-dropdown label:not(:empty) {
        position: absolute;
        color: var(--accent);
        background-color: var(--bg-primary);
        top: -20px;
        font-size: 12px;
        font-weight: 600;
        margin-top: 7px;
        z-index: 1000;
    }

/* ============ INVALID ============ */
.custom-input .invalid {
    border: 2px solid var(--danger) !important;
    box-shadow: 0 0 0 4px rgba(255, 107, 107, 0.15) !important;
}

/* ============ AUTOCOMPLETE DROPDOWN ============ */
.custom-input-dropdown {
    background: var(--megamenu-bg);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    color: var(--text-primary);
    border: 1px solid var(--input-border);
    border-radius: var(--radius-md);
    box-shadow: var(--glass-shadow-hover);
    max-height: 200px;
    overflow: auto;
    position: absolute;
    z-index: 999999;
    display: none;
    padding: 6px;
    margin-top: 4px;
}

/* ============ DROPDOWN ITEM ============ */
.custom-input-item {
    padding: 8px 10px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.88rem;
    font-weight: 600;
    transition: var(--transition);
}

    .custom-input-item:hover,
    .custom-input-item.selected {
        background: var(--accent-glow-15);
        color: var(--accent);
        transform: translateX(-3px);
    }

[dir="ltr"] .custom-input-item:hover,
[dir="ltr"] .custom-input-item.selected {
    transform: translateX(3px);
}

/* ============ DARK THEME (نیاز مینیمال) ============ */
[data-theme="dark"] .custom-input > label:not(:empty),
[data-theme="dark"] .custom-dropdown label:not(:empty) {
    background-color: var(--bg-secondary);
}
