/* static/css/form-styles.css */

/* Общие стили для полей формы */
.form-field {
    margin-bottom: 1.5em;
}

.form-label {
    display: block;
    margin-bottom: 0.5em;
    font-weight: 600;
    color: #fff;
}

/* Базовые стили для всех полей ввода */
.form-input,
.form-select,
.form-textarea,
.phone-mask,
.telegram-input {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    backdrop-filter: blur(5px);
    transition: all 0.2s ease;
    box-sizing: border-box;
}

/* Специфичные стили для select */
.form-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"/></svg>');
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1rem;
    padding-right: 2.5rem;
}

/* Стили при наведении */
.form-input:hover,
.form-select:hover,
.form-textarea:hover,
.phone-mask:hover,
.telegram-input:hover {
    border-color: rgba(255, 255, 255, 0.5);
}

/* Стили при фокусе */
.form-input:focus,
.form-select:focus,
.form-textarea:focus,
.phone-mask:focus,
.telegram-input:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.3);
    outline: none;
}

/* Стили для сообщений об ошибках */
.form-errors {
    width: 100%;
    margin-top: 0.55rem;
    padding: 0.65rem 0.8rem;
    border: 1px solid rgba(248, 113, 113, 0.35);
    border-radius: 7px;
    color: #fecaca;
    background: rgba(127, 29, 29, 0.38);
    font-size: 0.9rem;
    line-height: 1.35;
    text-align: left;
}

.form-errors[hidden] {
    display: none;
}

.form-errors span {
    display: block;
}

.form-errors span + span {
    margin-top: 0.25rem;
}

.form-field.has-error input,
.form-field.has-error select {
    border-color: #f87171;
    box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.17);
}

.order-form-card {
    border-radius: 14px;
    overflow: hidden;
}

#order_form .order-form-card form {
    width: 100%;
    border: 0;
    border-radius: 0;
    background: transparent !important;
    box-shadow: none;
    backdrop-filter: none;
}

.order-form-status {
    margin: 0 0 1.25rem;
    padding: 0.9rem 1rem;
    border: 1px solid rgba(96, 165, 250, 0.4);
    border-radius: 9px;
    color: #dbeafe;
    background: rgba(30, 64, 175, 0.32);
    font-weight: 600;
    line-height: 1.4;
    text-align: center;
}

.order-form-status[hidden] {
    display: none;
}

.order-form-status.success {
    border-color: rgba(74, 222, 128, 0.4);
    color: #dcfce7;
    background: rgba(20, 83, 45, 0.5);
}

.order-form-status.error {
    border-color: rgba(248, 113, 113, 0.4);
    color: #fee2e2;
    background: rgba(127, 29, 29, 0.5);
}

.order-form-toast {
    position: fixed;
    z-index: 10000;
    top: 1rem;
    right: 1rem;
    display: grid;
    width: min(430px, calc(100vw - 2rem));
    padding: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    grid-template-columns: 34px minmax(0, 1fr) 28px;
    align-items: center;
    gap: 0.75rem;
    color: #fff;
    background: rgba(19, 26, 35, 0.97);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
    opacity: 0;
    transform: translateY(-16px);
    transition: opacity 220ms ease, transform 220ms ease;
}

.order-form-toast.visible {
    opacity: 1;
    transform: translateY(0);
}

.order-form-toast.success {
    border-color: rgba(74, 222, 128, 0.55);
}

.order-form-toast.error {
    border-color: rgba(248, 113, 113, 0.55);
}

.order-form-toast-icon {
    display: grid;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    place-items: center;
    color: #fff;
    background: #23864b;
    font-size: 1.2rem;
    font-weight: 800;
}

.order-form-toast.error .order-form-toast-icon {
    background: #b63131;
}

.order-form-toast-text {
    font-weight: 600;
    line-height: 1.4;
}

.order-form-toast-close {
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    color: rgba(255, 255, 255, 0.75);
    background: transparent;
    cursor: pointer;
    font-size: 1.4rem;
    line-height: 1;
}

@media screen and (max-width: 736px) {
    .order-form-toast {
        top: 0.75rem;
        right: 0.75rem;
        width: calc(100vw - 1.5rem);
    }
}

.form-button:disabled {
    cursor: wait;
    opacity: 0.7;
    transform: none;
}

.contact-methods {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.85rem;
}

.personal-data-consent {
    display: flex;
    padding: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    align-items: flex-start;
    gap: 0.8rem;
    color: #e8edf5;
    background: rgba(255, 255, 255, 0.055);
    cursor: pointer;
    line-height: 1.55;
}

.personal-data-consent input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.consent-check {
    display: grid;
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 6px;
    place-items: center;
    color: transparent;
    background: rgba(0, 0, 0, 0.25);
}

.personal-data-consent:has(input:checked) {
    border-color: rgba(30, 117, 255, 0.75);
    background: rgba(30, 117, 255, 0.1);
}

.personal-data-consent:has(input:checked) .consent-check {
    border-color: #1e75ff;
    color: #fff;
    background: #1e75ff;
}

.personal-data-consent:has(input:focus-visible) {
    outline: 3px solid rgba(30, 117, 255, 0.35);
    outline-offset: 2px;
}

.personal-data-consent a {
    color: #70a9ff;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.privacy-policy-note {
    margin: 0.65rem 0 0;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.88rem;
}

.privacy-policy-note a {
    color: #70a9ff;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.form-field.has-error .personal-data-consent {
    border-color: #f87171;
    box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.17);
}

.contact-method-card {
    position: relative;
    display: flex;
    min-height: 96px;
    padding: 1rem 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 12px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 0.45rem;
    color: #f5f7fb;
    background: linear-gradient(145deg, rgba(45, 48, 54, 0.86), rgba(22, 24, 28, 0.9));
    cursor: pointer;
    transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.contact-method-card:hover {
    border-color: rgba(30, 117, 255, 0.8);
    transform: translateY(-2px);
}

.contact-method-card input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.contact-method-card:has(input:focus-visible) {
    outline: 3px solid rgba(30, 117, 255, 0.35);
    outline-offset: 2px;
}

.contact-method-card:has(input:checked) {
    border-color: #1e75ff;
    background: linear-gradient(145deg, rgba(24, 79, 164, 0.7), rgba(18, 32, 56, 0.95));
    box-shadow: 0 0 0 1px rgba(30, 117, 255, 0.35), 0 10px 30px rgba(0, 0, 0, 0.22);
}

.contact-method-icon {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
}

.contact-method-icon svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
}

.contact-method-whatsapp .contact-method-icon {
    color: #38d975;
}

.contact-method-telegram .contact-method-icon {
    color: #35a9e8;
}

.contact-method-vk .contact-method-icon {
    color: #4c91e9;
}

.contact-method-max .contact-method-icon {
    color: #fff;
}

.profile-url-input {
    display: flex;
    width: 100%;
    min-width: 0;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 9px;
    align-items: stretch;
    background: rgba(31, 31, 31, 0.92);
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

.profile-url-input:focus-within {
    border-color: #1e75ff;
    box-shadow: 0 0 0 3px rgba(30, 117, 255, 0.16);
}

.profile-url-prefix {
    display: flex;
    padding: 0 0.8rem;
    border-right: 1px solid rgba(255, 255, 255, 0.18);
    align-items: center;
    color: #b8c0cc;
    background: rgba(255, 255, 255, 0.055);
    white-space: nowrap;
}

.profile-url-input input {
    min-width: 0;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

.form-field.has-error .profile-url-input {
    border-color: #f87171;
    box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.17);
}

@media screen and (max-width: 480px) {
    .profile-url-input {
        display: block;
    }

    .profile-url-prefix {
        min-height: 42px;
        border-right: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.18);
    }
}

.contact-method-label {
    font-weight: 700;
}

.contact-method-check {
    position: absolute;
    top: 0.55rem;
    right: 0.6rem;
    display: grid;
    width: 21px;
    height: 21px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 50%;
    place-items: center;
    color: transparent;
    font-size: 0.75rem;
}

.contact-method-card:has(input:checked) .contact-method-check {
    border-color: #1e75ff;
    color: #fff;
    background: #1e75ff;
}

@media screen and (max-width: 736px) {
    .contact-methods {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .contact-method-card {
        min-height: 88px;
    }
}

/* Стили для контейнера кнопок */
.form-actions {
    display: flex;
    gap: 2rem;
    width: 100%;
    margin-top: 1.5em;
}

/* ========== СТИЛИ КНОПОК ИЗ CUSTOM_MAIN.CSS ========== */

/* Базовые стили для всех кнопок */
.form-button {
    display: inline-block;
    padding: 0.8rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--color-primary, #0d6efd);
    color: white;
    position: relative;
    overflow: hidden;
    z-index: 1;
    flex: 1;
}

/* Эффект пульсации при наведении */
.form-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
    z-index: -1;
}

.form-button:hover::before {
    width: 300px;
    height: 300px;
}

.form-button:hover {
    background: var(--color-primary-hover, #0b5ed7);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(13, 110, 253, 0.3);
}

/* Основная кнопка */
.form-button.primary {
    background: var(--color-primary, #0d6efd);
    color: white;
}

.form-button.primary:hover {
    background: var(--color-primary-hover, #0a58ca);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(13, 110, 253, 0.3);
}

/* Альтернативная кнопка */
.form-button.alt {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.form-button.alt:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: var(--color-primary, #0d6efd);
}

/* Стили для списка действий */
.actions {
    display: flex;
    gap: 1rem;
    list-style: none;
    justify-content: center;
    flex-wrap: wrap;
}

/* ========== КОНЕЦ СТИЛЕЙ КНОПОК ========== */

/* Стили для опций в select */
.form-select option {
    background: rgba(0, 0, 0, 0.9);
    color: white;
}

/* Стили для placeholder */
.form-input::placeholder,
.phone-mask::placeholder,
.telegram-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

/* Стили для автозаполнения */
.form-input:-webkit-autofill,
.form-input:-webkit-autofill:hover,
.form-input:-webkit-autofill:focus,
.phone-mask:-webkit-autofill,
.phone-mask:-webkit-autofill:hover,
.phone-mask:-webkit-autofill:focus,
.telegram-input:-webkit-autofill,
.telegram-input:-webkit-autofill:hover,
.telegram-input:-webkit-autofill:focus {
    -webkit-text-fill-color: white;
    -webkit-box-shadow: 0 0 0px 1000px rgba(13, 110, 253, 0.2) inset;
    transition: background-color 5000s ease-in-out 0s;
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
    .form-actions {
        flex-direction: column;
        gap: 1rem;
    }
    
    .form-button {
        width: 100%;
    }
    
    .actions {
        flex-direction: column;
        align-items: center;
    }
    
    .actions li {
        width: 100%;
        max-width: 250px;
    }
    
    .actions .form-button {
        width: 100%;
    }
}
