/**
 * EstateSite Enhanced Contact Form Widget Styles
 *
 * @package EstateSite
 * @since 1.5.0
 */

/* ==========================================================================
   Container
   ========================================================================== */

.estatesite-contact-form-wrapper {
    max-width: 100%;
}

.estatesite-contact-form {
    display: flex;
    flex-direction: column;
}

/* ==========================================================================
   Section Labels
   ========================================================================== */

.estatesite-cf-section-label {
    font-size: 14px;
    font-weight: 600;
    color: #333333;
    margin-bottom: 15px;
}

/* ==========================================================================
   Meeting Type Cards
   ========================================================================== */

.estatesite-meeting-types {
    display: flex;
    flex-wrap: wrap;
    gap: var(--card-gap, 15px);
    margin-bottom: 30px;
}

.estatesite-meeting-card {
    flex: 1 1 calc((100% - 2 * var(--card-gap, 15px)) / 3);
    min-width: 0;
    background: #ffffff;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 25px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.estatesite-meeting-card:hover {
    border-color: #c4b99a;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.estatesite-meeting-card.selected {
    background-color: #F5F0E8;
    border-color: #c4b99a;
}

/* Icon Container */
.estatesite-meeting-card-icon-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    background-color: #f5f5f5;
    border-radius: 8px;
    margin-bottom: 12px;
    transition: all 0.3s ease;
}

.estatesite-meeting-card.selected .estatesite-meeting-card-icon-wrap {
    background-color: #e8e0d0;
}

.estatesite-meeting-card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #666666;
    transition: color 0.3s ease;
}

.estatesite-meeting-card-icon svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.estatesite-meeting-card.selected .estatesite-meeting-card-icon {
    color: #2C3E50;
}

/* Card Text */
.estatesite-meeting-card-title {
    font-size: 16px;
    font-weight: 600;
    color: #333333;
    margin: 0 0 5px 0;
    line-height: 1.3;
}

.estatesite-meeting-card-description {
    font-size: 13px;
    color: #666666;
    margin: 0;
    line-height: 1.4;
}

/* Animation Support */
.estatesite-meeting-card.animate__animated {
    animation-fill-mode: both;
}

/* ==========================================================================
   List Layout
   ========================================================================== */

.estatesite-meeting-types.layout-list {
    flex-direction: column;
}

.estatesite-meeting-types.layout-list .estatesite-meeting-card {
    flex: 0 0 100%;
    max-width: 100%;
    display: flex;
    align-items: center;
    text-align: left;
    padding: 18px 20px;
}

.estatesite-meeting-types.layout-list .estatesite-meeting-card-icon-wrap {
    flex-shrink: 0;
    margin-bottom: 0;
    margin-right: 15px;
}

.estatesite-meeting-types.layout-list .estatesite-meeting-card-content {
    flex: 1;
    min-width: 0;
}

.estatesite-meeting-types.layout-list .estatesite-meeting-card-title {
    margin-bottom: 3px;
}

.estatesite-meeting-types.layout-list .estatesite-meeting-card-description {
    margin: 0;
}

/* Multiple Selection Mode - Checkbox Indicator */
.estatesite-meeting-types[data-selection-mode="multiple"] .estatesite-meeting-card {
    position: relative;
}

.estatesite-meeting-types[data-selection-mode="multiple"] .estatesite-meeting-card::after {
    content: '';
    position: absolute;
    top: 12px;
    right: 12px;
    width: 20px;
    height: 20px;
    border: 2px solid #d0d0d0;
    border-radius: 4px;
    background: #fff;
    transition: all 0.2s ease;
}

.estatesite-meeting-types[data-selection-mode="multiple"] .estatesite-meeting-card.selected::after {
    background-color: #2C3E50;
    border-color: #2C3E50;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
    background-size: 14px;
    background-repeat: no-repeat;
    background-position: center;
}

/* Adjust padding for checkbox in grid layout */
.estatesite-meeting-types.layout-grid[data-selection-mode="multiple"] .estatesite-meeting-card {
    padding-top: 35px;
}

/* List layout checkbox positioning */
.estatesite-meeting-types.layout-list[data-selection-mode="multiple"] .estatesite-meeting-card {
    padding-right: 50px;
}

.estatesite-meeting-types.layout-list[data-selection-mode="multiple"] .estatesite-meeting-card::after {
    top: 50%;
    transform: translateY(-50%);
}

/* ==========================================================================
   Form Fields
   ========================================================================== */

.estatesite-cf-fields {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 20px 15px;
}

/* Width columns for repeater fields — 12-column grid */
.estatesite-cf-col-100 {
    grid-column: span 12;
}
.estatesite-cf-col-50 {
    grid-column: span 6;
}
.estatesite-cf-col-33 {
    grid-column: span 4;
}
.estatesite-cf-col-25 {
    grid-column: span 3;
}

.estatesite-cf-row {
    display: flex;
    gap: 15px;
}

.estatesite-cf-row > .estatesite-cf-field-group {
    flex: 1;
    min-width: 0;
}

/* Field Group */
.estatesite-cf-field-group {
    position: relative;
    box-sizing: border-box;
    min-width: 0;
}

/* Field Input Wrapper - for proper icon positioning */
.estatesite-cf-field-group .estatesite-cf-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

/* Field Icon - positioned at exact center of 52px input height */
.estatesite-cf-field-icon {
    position: absolute;
    left: 15px;
    top: 18px; /* (52px input height - 16px icon) / 2 = 18px */
    color: #999999;
    font-size: 16px;
    pointer-events: none;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    line-height: 1;
}

.estatesite-cf-field-icon svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
    display: block;
}

.estatesite-cf-field-icon i {
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
}

/* Adjust icon position for textarea */
.estatesite-cf-field-group:has(.estatesite-cf-textarea) .estatesite-cf-field-icon {
    top: 18px;
}

/* Input Fields */
.estatesite-cf-field {
    width: 100%;
    height: 52px;
    padding: 0 20px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    background: #ffffff;
    color: #333333;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    box-sizing: border-box;
    line-height: 52px;
}

.estatesite-cf-field-group.has-icon .estatesite-cf-field {
    padding-left: 45px;
}

.estatesite-cf-field:focus {
    outline: none;
    border-color: #2C3E50;
    box-shadow: 0 0 0 3px rgba(44, 62, 80, 0.1);
}

.estatesite-cf-field::placeholder {
    color: #999999;
    line-height: inherit;
}

/* Select Dropdown */
select.estatesite-cf-field {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: #ffffff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23999999' 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 15px center;
    padding-right: 40px;
    color: #333333;
    /* Override line-height for select - must be normal for proper text display */
    line-height: 1.4;
}

/* Placeholder state - when empty option is selected */
select.estatesite-cf-field:invalid,
select.estatesite-cf-field.placeholder-shown {
    color: #999999;
}

select.estatesite-cf-field:focus {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%232C3E50' 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");
}

select.estatesite-cf-field option {
    color: #333333;
    padding: 10px;
}

select.estatesite-cf-field option[value=""] {
    color: #999999;
}

select.estatesite-cf-field option:disabled {
    color: #999999;
}

/* Disabled select state */
select.estatesite-cf-field:disabled {
    background-color: #f5f5f5;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Location Row */
.estatesite-cf-location-row {
    display: flex;
    gap: 15px;
}

.estatesite-cf-location-row > .estatesite-cf-field-group {
    flex: 1;
    min-width: 0;
}

/* ==========================================================================
   Choices.js Overrides for Location Dropdowns
   ========================================================================== */

/* Outer container */
.estatesite-cf-field-group .choices {
    margin-bottom: 0;
}

.estatesite-cf-field-group .choices .choices__inner {
    height: 52px;
    min-height: 52px;
    max-height: 52px;
    padding: 0 20px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    background: #ffffff;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    align-items: center;
    line-height: 1;
    overflow: hidden;
    cursor: pointer;
}

.estatesite-cf-field-group.has-icon .choices .choices__inner {
    padding-left: 45px;
}

.estatesite-cf-field-group .choices.is-open .choices__inner,
.estatesite-cf-field-group .choices.is-focused .choices__inner {
    border-color: #2C3E50;
    box-shadow: 0 0 0 3px rgba(44, 62, 80, 0.1);
}

/* Placeholder */
.estatesite-cf-field-group .choices .choices__placeholder {
    color: #999999;
    opacity: 1;
}

/* Selected item text */
.estatesite-cf-field-group .choices .choices__item--selectable {
    color: #333333;
    font-size: 15px;
}

/* Dropdown */
.estatesite-cf-field-group .choices .choices__list--dropdown,
.estatesite-cf-field-group .choices .choices__list[aria-expanded] {
    border: 1px solid #e0e0e0;
    border-radius: 0 0 8px 8px;
    border-top: none;
    z-index: 10000;
}

/* Search input inside dropdown */
.estatesite-cf-field-group .choices .choices__list--dropdown .choices__input {
    border-bottom: 1px solid #e0e0e0;
    padding: 10px 15px;
    font-size: 14px;
    font-family: inherit;
    width: 100% !important;
    box-sizing: border-box;
}

/* Search input inside .choices__inner for multi-select - make it invisible
   (Choices.js puts a secondary input inside __inner for multi-select) */
.estatesite-cf-field-group .choices[data-type*="select-multiple"] .choices__inner .choices__input {
    position: absolute;
    width: 0 !important;
    min-width: 0;
    padding: 0;
    margin: 0;
    border: none;
    opacity: 0;
    height: 0;
}

/* Dropdown options */
.estatesite-cf-field-group .choices .choices__list--dropdown .choices__item {
    padding: 10px 15px;
    font-size: 15px;
    color: #333333;
}

.estatesite-cf-field-group .choices .choices__list--dropdown .choices__item--selectable.is-highlighted {
    background-color: #2C3E50;
    color: #ffffff;
}

/* No results / no choices text */
.estatesite-cf-field-group .choices .choices__list--dropdown .has-no-results,
.estatesite-cf-field-group .choices .choices__list--dropdown .has-no-choices {
    color: #999999;
    font-size: 14px;
}

/* Disabled state */
.estatesite-cf-field-group .choices.is-disabled .choices__inner {
    background-color: #f5f5f5;
    cursor: not-allowed;
    opacity: 0.6;
}

.estatesite-cf-field-group .choices.is-disabled .choices__input {
    display: none;
}

/* Hide the native select when Choices.js is active */
.estatesite-cf-field-group select.estatesite-cf-field[data-choice] {
    display: none;
}

/* Cursor: pointer everywhere except when actively searching */
.estatesite-cf-field-group .choices,
.estatesite-cf-field-group .choices .choices__inner *,
.estatesite-cf-field-group .choices .choices__item {
    cursor: pointer;
}

/* Custom arrow for Choices to match theme */
.estatesite-cf-field-group .choices::after {
    border-color: #999999 transparent transparent transparent;
    right: 15px;
    top: 50%;
    margin-top: -2.5px;
}

.estatesite-cf-field-group .choices.is-open::after {
    border-color: transparent transparent #999999 transparent;
    margin-top: -7.5px;
}

/* ==========================================================================
   Multi-Select: Summary Counter ("X избрани")
   ========================================================================== */

/* Hide default pills/tags in multi-select */
.estatesite-cf-field-group .choices[data-type*="select-multiple"] .choices__list--multiple {
    display: none;
}

/* Summary element inside .choices__inner */
.estatesite-choices-summary {
    font-size: 15px;
    color: #999999;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
    line-height: 52px;
}

.estatesite-choices-summary.has-value {
    color: #333333;
}

/* ==========================================================================
   Multi-Select: Checkmarks on Selected Items
   ========================================================================== */

/* Dropdown items in multi-select get a checkmark area */
.estatesite-cf-field-group .choices[data-type*="select-multiple"] .choices__list--dropdown .choices__item {
    position: relative;
    padding-right: 40px;
}

/* Checkmark circle for selected items */
.estatesite-cf-field-group .choices[data-type*="select-multiple"] .choices__list--dropdown .choices__item.is-selected::after {
    content: '';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid #2C3E50;
    background-color: #2C3E50;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
    background-size: 14px;
    background-position: center;
    background-repeat: no-repeat;
}

/* Unselected items get an empty circle */
.estatesite-cf-field-group .choices[data-type*="select-multiple"] .choices__list--dropdown .choices__item:not(.is-selected)::after {
    content: '';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid #ddd;
    background-color: #fff;
}

/* Keep selected items visible in dropdown (don't hide them) */
.estatesite-cf-field-group .choices[data-type*="select-multiple"] .choices__list--dropdown .choices__item.is-selected {
    display: block;
}

/* Override highlight color for selected items */
.estatesite-cf-field-group .choices[data-type*="select-multiple"] .choices__list--dropdown .choices__item.is-selected.is-highlighted {
    background-color: rgba(44, 62, 80, 0.08);
    color: #333333;
}

/* Textarea */
.estatesite-cf-textarea {
    height: auto;
    min-height: 120px;
    padding: 15px 20px;
    resize: vertical;
    line-height: 1.5;
}

.estatesite-cf-field-group.has-icon .estatesite-cf-textarea {
    padding-left: 45px;
    padding-top: 15px;
}

/* Labels */
.estatesite-cf-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #333333;
    margin-bottom: 8px;
}

.estatesite-cf-label-note {
    font-weight: 400;
    color: #999999;
    margin-left: 5px;
}

/* Error States */
.estatesite-cf-field.error {
    border-color: #e74c3c;
}

.estatesite-cf-field-error {
    display: block;
    color: #e74c3c;
    font-size: 12px;
    margin-top: 5px;
    min-height: 18px;
}

/* ==========================================================================
   Submit Button
   ========================================================================== */

.estatesite-cf-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 15px 30px;
    margin-top: 20px;
    background-color: #2C3E50;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
}

.estatesite-cf-submit:hover {
    background-color: #1a252f;
}

.estatesite-cf-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Loading State */
.estatesite-cf-submit .btn-loading {
    display: none;
    align-items: center;
    justify-content: center;
}

.estatesite-cf-submit.loading .btn-text {
    display: none;
}

.estatesite-cf-submit.loading .btn-loading {
    display: inline-flex;
}

/* Spinner */
.estatesite-cf-submit .spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: estatesite-spin 0.8s linear infinite;
    margin-right: 10px;
}

@keyframes estatesite-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==========================================================================
   Footer Text
   ========================================================================== */

.estatesite-cf-footer {
    text-align: center;
    font-size: 13px;
    color: #999999;
    margin: 15px 0 0 0;
}

/* ==========================================================================
   Message Display
   ========================================================================== */

.estatesite-cf-message {
    display: none;
    padding: 15px 20px;
    border-radius: 8px;
    margin-top: 20px;
    font-size: 14px;
    line-height: 1.5;
}

.estatesite-cf-message.success {
    display: block;
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.estatesite-cf-message.error {
    display: block;
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* ==========================================================================
   Flatpickr Customization
   ========================================================================== */

.flatpickr-calendar {
    font-family: inherit;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    border: none;
}

.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange,
.flatpickr-day.selected.inRange,
.flatpickr-day.startRange.inRange,
.flatpickr-day.endRange.inRange,
.flatpickr-day.selected:focus,
.flatpickr-day.startRange:focus,
.flatpickr-day.endRange:focus,
.flatpickr-day.selected:hover,
.flatpickr-day.startRange:hover,
.flatpickr-day.endRange:hover,
.flatpickr-day.selected.prevMonthDay,
.flatpickr-day.startRange.prevMonthDay,
.flatpickr-day.endRange.prevMonthDay,
.flatpickr-day.selected.nextMonthDay,
.flatpickr-day.startRange.nextMonthDay,
.flatpickr-day.endRange.nextMonthDay {
    background: #2C3E50;
    border-color: #2C3E50;
}

.flatpickr-day.today {
    border-color: #2C3E50;
}

.flatpickr-day.today:hover,
.flatpickr-day.today:focus {
    background: #2C3E50;
    border-color: #2C3E50;
    color: #fff;
}

.flatpickr-months .flatpickr-month {
    background: #2C3E50;
    color: #fff;
    border-radius: 8px 8px 0 0;
}

.flatpickr-months .flatpickr-prev-month,
.flatpickr-months .flatpickr-next-month {
    color: #fff;
    fill: #fff;
}

.flatpickr-months .flatpickr-prev-month:hover,
.flatpickr-months .flatpickr-next-month:hover {
    color: rgba(255, 255, 255, 0.8);
}

.flatpickr-months .flatpickr-prev-month:hover svg,
.flatpickr-months .flatpickr-next-month:hover svg {
    fill: rgba(255, 255, 255, 0.8);
}

.flatpickr-current-month .flatpickr-monthDropdown-months {
    background: transparent;
    color: #fff;
}

.flatpickr-current-month input.cur-year {
    color: #fff;
}

.flatpickr-time input {
    color: #333;
}

.flatpickr-time .flatpickr-am-pm {
    color: #333;
}

/* ==========================================================================
   Responsive Styles
   ========================================================================== */

@media (max-width: 768px) {
    .estatesite-meeting-card {
        flex: 0 0 calc(50% - var(--card-gap, 15px) / 2);
        max-width: calc(50% - var(--card-gap, 15px) / 2);
    }

    .estatesite-cf-col-50,
    .estatesite-cf-col-33,
    .estatesite-cf-col-25 {
        grid-column: span 12;
    }

    .estatesite-cf-row {
        flex-direction: column;
    }

    .estatesite-meeting-card-title {
        font-size: 14px;
    }

    .estatesite-meeting-card-description {
        font-size: 12px;
    }

    .estatesite-meeting-card-icon-wrap {
        width: 40px;
        height: 40px;
    }

    .estatesite-meeting-card-icon {
        font-size: 20px;
    }

    .estatesite-meeting-card-icon svg {
        width: 20px;
        height: 20px;
    }
}

@media (max-width: 480px) {
    .estatesite-meeting-card {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .estatesite-cf-field {
        padding: 12px 15px;
        font-size: 14px;
    }

    .estatesite-cf-field-group.has-icon .estatesite-cf-field {
        padding-left: 40px;
    }

    .estatesite-cf-field-icon {
        left: 12px;
        font-size: 14px;
    }

    .estatesite-cf-submit {
        padding: 12px 20px;
        font-size: 15px;
    }
}

/* ==========================================================================
   Elementor Editor Styles
   ========================================================================== */

.elementor-editor-active .estatesite-meeting-card:first-child {
    background-color: #F5F0E8;
    border-color: #c4b99a;
}

.elementor-editor-active .estatesite-meeting-card:first-child .estatesite-meeting-card-icon-wrap {
    background-color: #e8e0d0;
}

.elementor-editor-active .estatesite-meeting-card:first-child .estatesite-meeting-card-icon {
    color: #2C3E50;
}
