/* webapp/css/themes/modern-dark-forms.css */
/* Современные формы и инпуты для темы Modern Dark */

/* === НЕОМОРФНЫЕ ИНПУТЫ С ВДАВЛЕННЫМ ЭФФЕКТОМ === */

body.theme-modern-dark .input-field,
body.theme-modern-dark select.input-field,
body.theme-modern-dark textarea.input-field {
    background: var(--theme-bg-content) !important;
    border: none !important;
    border-radius: 16px !important;
    padding: 16px 20px !important;
    font-size: 1rem !important;
    font-weight: 500 !important;
    color: var(--theme-text-primary) !important;
    position: relative !important;
    
    /* Неоморфный ВДАВЛЕННЫЙ эффект для инпутов */
    box-shadow: 
        inset 6px 6px 12px var(--neo-shadow-dark),
        inset -6px -6px 12px var(--neo-shadow-light),
        0 0 0 1px rgba(255, 255, 255, 0.05) !important;
    
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
    outline: none !important;
    letter-spacing: 0.01em !important;
    line-height: 1.5 !important;
}

/* Плейсхолдеры с улучшенным стилем */
body.theme-modern-dark .input-field::placeholder,
body.theme-modern-dark select.input-field::placeholder,
body.theme-modern-dark textarea.input-field::placeholder {
    color: var(--theme-text-placeholder);
    opacity: 0.7;
    font-weight: 400;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* === АНИМАЦИИ ФОКУСА С НЕОНОВЫМ СВЕЧЕНИЕМ === */

body.theme-modern-dark .input-field:focus,
body.theme-modern-dark select.input-field:focus,
body.theme-modern-dark textarea.input-field:focus {
    /* Усиленный вдавленный эффект с неоновым свечением */
    box-shadow: 
        inset 8px 8px 16px var(--neo-shadow-dark),
        inset -8px -8px 16px var(--neo-shadow-light),
        0 0 0 2px var(--theme-accent-primary),
        0 0 20px rgba(0, 212, 255, 0.4),
        0 0 40px rgba(0, 212, 255, 0.2);
    
    transform: scale(1.02);
    background: color-mix(in srgb, var(--theme-bg-content) 95%, var(--theme-accent-primary) 5%);
}

body.theme-modern-dark .input-field:focus::placeholder,
body.theme-modern-dark select.input-field:focus::placeholder,
body.theme-modern-dark textarea.input-field:focus::placeholder {
    opacity: 0.5;
    transform: translateY(-2px);
    color: var(--theme-accent-primary);
}

/* === АНИМИРОВАННЫЕ ЛЕЙБЛЫ === */

.modern-input-container {
    position: relative;
    margin-bottom: 24px;
}

body.theme-modern-dark .modern-input-label {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--theme-text-placeholder);
    font-size: 1rem;
    font-weight: 500;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: transparent;
    padding: 0 8px;
    z-index: 2;
}

/* Анимация лейбла при фокусе или заполненном поле */
body.theme-modern-dark .modern-input-container .input-field:focus + .modern-input-label,
body.theme-modern-dark .modern-input-container .input-field:not(:placeholder-shown) + .modern-input-label,
body.theme-modern-dark .modern-input-container .input-field.has-value + .modern-input-label {
    top: -8px;
    left: 16px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--theme-accent-primary);
    background: var(--theme-bg-content);
    text-shadow: 0 0 8px rgba(0, 212, 255, 0.6);
    transform: translateY(0) scale(1.1);
}

/* Специальная анимация для textarea */
body.theme-modern-dark .modern-input-container textarea.input-field + .modern-input-label {
    top: 24px;
}

body.theme-modern-dark .modern-input-container textarea.input-field:focus + .modern-input-label,
body.theme-modern-dark .modern-input-container textarea.input-field:not(:placeholder-shown) + .modern-input-label,
body.theme-modern-dark .modern-input-container textarea.input-field.has-value + .modern-input-label {
    top: -8px;
}

/* === СТЕКЛЯННЫЕ СЕЛЕКТЫ С РАЗМЫТЫМ ФОНОМ === */

body.theme-modern-dark select.input-field {
    background: var(--neo-glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--neo-glass-border);
    border-radius: 16px;
    
    /* Стеклянный эффект с неоморфными тенями */
    box-shadow: 
        inset 4px 4px 8px rgba(0, 0, 0, 0.3),
        inset -4px -4px 8px rgba(255, 255, 255, 0.05),
        0 8px 32px var(--neo-glass-shadow),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    
    /* Кастомная стрелка */
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%2300d4ff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 16px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 48px;
    
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

body.theme-modern-dark select.input-field:focus {
    background: var(--neo-glass-bg);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-color: var(--theme-accent-primary);
    
    box-shadow: 
        inset 6px 6px 12px rgba(0, 0, 0, 0.4),
        inset -6px -6px 12px rgba(255, 255, 255, 0.08),
        0 12px 40px var(--neo-glass-shadow),
        inset 0 1px 0 rgba(255, 255, 255, 0.15),
        0 0 0 2px var(--theme-accent-primary),
        0 0 30px rgba(0, 212, 255, 0.5);
    
    transform: scale(1.02) translateY(-2px);
    
    /* Анимированная стрелка при фокусе */
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23ff6ec7' stroke-linecap='round' stroke-linejoin='round' stroke-width='2.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
}

/* === СПЕЦИАЛЬНЫЕ ЭФФЕКТЫ ДЛЯ РАЗНЫХ СОСТОЯНИЙ === */

/* Состояние ошибки */
body.theme-modern-dark .input-field.error,
body.theme-modern-dark select.input-field.error {
    box-shadow: 
        inset 6px 6px 12px var(--neo-shadow-dark),
        inset -6px -6px 12px var(--neo-shadow-light),
        0 0 0 2px var(--theme-error-color),
        0 0 20px rgba(255, 71, 87, 0.4);
    
    animation: modernInputErrorShake 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modernInputErrorShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

/* Состояние успеха */
body.theme-modern-dark .input-field.success,
body.theme-modern-dark select.input-field.success {
    box-shadow: 
        inset 6px 6px 12px var(--neo-shadow-dark),
        inset -6px -6px 12px var(--neo-shadow-light),
        0 0 0 2px var(--theme-success-color),
        0 0 20px rgba(0, 255, 136, 0.4);
    
    animation: modernInputSuccessPulse 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modernInputSuccessPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Состояние загрузки */
body.theme-modern-dark .input-field.loading,
body.theme-modern-dark select.input-field.loading {
    position: relative;
    overflow: hidden;
}

body.theme-modern-dark .input-field.loading::after,
body.theme-modern-dark select.input-field.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(0, 212, 255, 0.3) 50%, 
        transparent 100%);
    animation: modernInputLoadingShimmer 2s infinite;
}

@keyframes modernInputLoadingShimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* === ГРУППЫ ФОРМ === */

.modern-form-group {
    margin-bottom: 32px;
    position: relative;
}

.modern-form-row {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.modern-form-row .modern-input-container {
    flex: 1;
}

/* === ЧЕКБОКСЫ И РАДИО КНОПКИ === */

body.theme-modern-dark .modern-checkbox-container,
body.theme-modern-dark .modern-radio-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    cursor: pointer;
    position: relative;
}

body.theme-modern-dark .modern-checkbox,
body.theme-modern-dark .modern-radio {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    background: var(--theme-bg-content);
    border: none;
    position: relative;
    cursor: pointer;
    
    /* Неоморфный вдавленный эффект */
    box-shadow: 
        inset 3px 3px 6px var(--neo-shadow-dark),
        inset -3px -3px 6px var(--neo-shadow-light);
    
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    appearance: none;
    -webkit-appearance: none;
}

.modern-radio {
    border-radius: 50%;
}

/* Состояние checked */
body.theme-modern-dark .modern-checkbox:checked,
body.theme-modern-dark .modern-radio:checked {
    background: linear-gradient(135deg, var(--theme-accent-primary), var(--theme-accent-secondary));
    
    box-shadow: 
        inset 2px 2px 4px rgba(0, 0, 0, 0.3),
        inset -2px -2px 4px rgba(255, 255, 255, 0.1),
        0 0 15px rgba(0, 212, 255, 0.5);
}

/* Галочка для чекбокса */
body.theme-modern-dark .modern-checkbox:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
    text-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
}

/* Точка для радио */
.modern-radio:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: white;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.3);
}

/* Лейблы для чекбоксов и радио */
body.theme-modern-dark .modern-checkbox-label,
body.theme-modern-dark .modern-radio-label {
    color: var(--theme-text-primary);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body.theme-modern-dark .modern-checkbox-container:hover .modern-checkbox-label,
body.theme-modern-dark .modern-radio-container:hover .modern-radio-label {
    color: var(--theme-accent-primary);
}

/* === КНОПКИ ОТПРАВКИ ФОРМ === */

body.theme-modern-dark .modern-submit-button {
    background: linear-gradient(135deg, var(--theme-accent-primary), var(--theme-accent-secondary));
    border: none;
    border-radius: 16px;
    padding: 16px 32px;
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    
    /* Неоморфный выпуклый эффект */
    box-shadow: 
        8px 8px 16px var(--neo-shadow-dark),
        -8px -8px 16px var(--neo-shadow-light),
        0 0 20px rgba(0, 212, 255, 0.3);
    
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 0.02em;
}

body.theme-modern-dark .modern-submit-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.2) 0%, 
        rgba(255, 255, 255, 0.1) 50%, 
        rgba(255, 255, 255, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

body.theme-modern-dark .modern-submit-button:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 
        12px 12px 24px var(--neo-shadow-dark),
        -12px -12px 24px var(--neo-shadow-light),
        0 0 30px rgba(0, 212, 255, 0.5),
        0 0 60px rgba(255, 110, 199, 0.3);
}

body.theme-modern-dark .modern-submit-button:hover::before {
    opacity: 1;
}

body.theme-modern-dark .modern-submit-button:active {
    transform: translateY(-1px) scale(1.02);
    box-shadow: 
        inset 4px 4px 8px var(--neo-shadow-dark),
        inset -4px -4px 8px var(--neo-shadow-light),
        0 0 15px rgba(0, 212, 255, 0.4);
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

/* === АНИМИРОВАННЫЕ ПЛЕЙСХОЛДЕРЫ === */

.modern-animated-placeholder {
    position: relative;
    overflow: hidden;
}

.modern-animated-placeholder .input-field {
    background: transparent;
}

.modern-animated-placeholder::before {
    content: attr(data-placeholder);
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--theme-text-placeholder);
    font-size: 1rem;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 1;
}

.modern-animated-placeholder.focused::before,
.modern-animated-placeholder.has-value::before {
    opacity: 0;
    transform: translateY(-50%) translateX(10px);
}

/* Анимированные частицы в плейсхолдере */
.modern-animated-placeholder::after {
    content: '';
    position: absolute;
    left: 20px;
    top: 50%;
    width: 4px;
    height: 4px;
    background: var(--theme-accent-primary);
    border-radius: 50%;
    opacity: 0;
    transform: translateY(-50%);
    animation: modernPlaceholderParticle 2s infinite;
}

@keyframes modernPlaceholderParticle {
    0%, 100% { 
        opacity: 0; 
        transform: translateY(-50%) translateX(0); 
    }
    50% { 
        opacity: 1; 
        transform: translateY(-50%) translateX(200px); 
    }
}

/* === ПОИСК С АВТОДОПОЛНЕНИЕМ === */

.modern-search-container {
    position: relative;
}

.modern-search-input {
    padding-left: 48px;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2300d4ff'%3e%3cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z'/%3e%3c/svg%3e");
    background-position: left 16px center;
    background-repeat: no-repeat;
    background-size: 20px;
}

.modern-search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--neo-glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--neo-glass-border);
    border-radius: 12px;
    margin-top: 8px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    
    box-shadow: 
        0 12px 40px var(--neo-glass-shadow),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modern-search-suggestions.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.modern-search-suggestion {
    padding: 12px 16px;
    color: var(--theme-text-primary);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.modern-search-suggestion:last-child {
    border-bottom: none;
}

.modern-search-suggestion:hover {
    background: rgba(0, 212, 255, 0.1);
    color: var(--theme-accent-primary);
    transform: translateX(4px);
}

/* === АДАПТИВНОСТЬ === */

@media (max-width: 768px) {
    .modern-form-row {
        flex-direction: column;
        gap: 0;
    }
    
    body.theme-modern-dark .input-field,
    body.theme-modern-dark select.input-field,
    body.theme-modern-dark textarea.input-field {
        padding: 14px 16px;
        font-size: 16px; /* Предотвращает зум на iOS */
    }
    
    .modern-input-label {
        left: 16px;
    }
    
    .modern-submit-button {
        width: 100%;
        padding: 16px;
    }
}

/* === ТЕМНАЯ ТЕМА ДЛЯ АВТОЗАПОЛНЕНИЯ === */

body.theme-modern-dark .input-field:-webkit-autofill,
body.theme-modern-dark .input-field:-webkit-autofill:hover,
body.theme-modern-dark .input-field:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px var(--theme-bg-content) inset !important;
    -webkit-text-fill-color: var(--theme-text-primary) !important;
    transition: background-color 5000s ease-in-out 0s;
}

/* === СПЕЦИАЛЬНЫЕ ЭФФЕКТЫ === */

/* Эффект печатной машинки для плейсхолдеров */
.typewriter-placeholder::before {
    content: attr(data-text);
    animation: modernTypewriter 3s steps(40) infinite;
    border-right: 2px solid var(--theme-accent-primary);
}

@keyframes modernTypewriter {
    0%, 50% { width: 0; }
    100% { width: 100%; }
}

/* Пульсирующий эффект для активных полей */
.modern-input-container.active .input-field {
    animation: modernInputPulse 2s ease-in-out infinite;
}

@keyframes modernInputPulse {
    0%, 100% { 
        box-shadow: 
            inset 6px 6px 12px var(--neo-shadow-dark),
            inset -6px -6px 12px var(--neo-shadow-light),
            0 0 0 2px var(--theme-accent-primary),
            0 0 20px rgba(0, 212, 255, 0.4);
    }
    50% { 
        box-shadow: 
            inset 6px 6px 12px var(--neo-shadow-dark),
            inset -6px -6px 12px var(--neo-shadow-light),
            0 0 0 2px var(--theme-accent-primary),
            0 0 30px rgba(0, 212, 255, 0.6);
    }
}