/**
 * Contact Form Popup Styles
 */

/* Popup Overlay */
.contact-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.contact-popup-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Popup Container */
.contact-popup {
    background: var(--white);
    border-radius: 20px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    transform: translateY(20px);
    transition: transform 0.3s ease;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.contact-popup-overlay.active .contact-popup {
    transform: translateY(0);
}

/* Close Button */
.popup-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0, 53, 113, 0.1);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.popup-close:hover {
    background: var(--primary-color);
    color: var(--white);
    transform: rotate(90deg);
}

/* Popup Content */
.popup-content {
    padding: 50px 40px 40px;
}

.popup-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 15px;
    text-align: center;
    line-height: 1.3;
}

.popup-description {
    font-size: 1.1rem;
    color: var(--text-color);
    text-align: center;
    margin-bottom: 30px;
    line-height: 1.4;
}


/* Contact Form 7 Grid Layout */
.contact-popup .row {
  display: flex;
  flex-wrap: wrap;
  margin-bottom: 20px;
  gap: 0 15px;
}

.contact-popup .col-md-4 {
  flex: 0 0 calc(33.333% - 10px);
  max-width: calc(33.333% - 10px);
}

.contact-popup .col-md-6 {
  flex: 0 0 calc(50% - 7.5px);
  max-width: calc(50% - 7.5px);
}

.contact-popup .col-md-12 {
  flex: 0 0 100%;
  max-width: 100%;
}

.contact-popup .row p {
  margin: 0;
  width: 100%;
}

@media (max-width: 768px) {
  .contact-popup .col-md-6 {
    flex: 0 0 100%;
    max-width: 100%;
  }
  
  .contact-popup .row {
    gap: 0;
  }
  
  .contact-popup .row:not(:last-child) {
    margin-bottom: 15px;
  }
}

/* Contact Form 7 Styling to Match Custom Design */
.contact-popup .wpcf7 {
    width: 100%;
}

.contact-popup .wpcf7-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Bootstrap Row Styling */
.contact-popup .wpcf7-form .row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin: 0;
}

.contact-popup .wpcf7-form .col-md-6 {
    flex: 1;
    min-width: 0;
    padding: 0;
}

.contact-popup .wpcf7-form .col-md-12 {
    flex: 1 1 100%;
    padding: 0;
}

.contact-popup .wpcf7-form p {
    margin: 0;
    display: flex;
    flex-direction: column;
}

.contact-popup .wpcf7-form-control-wrap {
    display: block;
    width: 100%;
}

.contact-popup .wpcf7 input[type="text"],
.contact-popup .wpcf7 input[type="email"],
.contact-popup .wpcf7 input[type="tel"],
.contact-popup .wpcf7 select,
.contact-popup .wpcf7 textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
    background: var(--white);
    box-sizing: border-box;
}

.contact-popup .wpcf7 input:focus,
.contact-popup .wpcf7 select:focus,
.contact-popup .wpcf7 textarea:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(180, 138, 71, 0.1);
}

.contact-popup .wpcf7 textarea {
    resize: vertical;
    min-height: 100px;
}

.contact-popup .wpcf7 select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23003571' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    padding-right: 40px;
}

/* CF7 Form Labels */
.contact-popup .wpcf7 label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 8px;
    display: block;
}

/* CF7 Submit Button */
.contact-popup .wpcf7 .wpcf7-submit {
    width: 100%;
    padding: 16px 30px;
    background: linear-gradient(135deg, var(--primary-color), color-mix(in srgb, var(--primary-color) 85%, black));
    color: var(--white);
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.contact-popup .wpcf7 .wpcf7-submit::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.6s ease;
}

.contact-popup .wpcf7 .wpcf7-submit:hover::before {
    left: 100%;
}

.contact-popup .wpcf7 .wpcf7-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 53, 113, 0.3);
}

/* CF7 Response Messages */
.contact-popup .wpcf7-response-output {
    padding: 15px 20px;
    border-radius: 10px;
    margin-top: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.95rem;
    line-height: 1.5;
}

.contact-popup .wpcf7-mail-sent-ok {
    background: rgba(76, 175, 80, 0.1);
    border: 1px solid rgba(76, 175, 80, 0.3);
    color: #2e7d32;
}

.contact-popup .wpcf7-validation-errors,
.contact-popup .wpcf7-mail-sent-ng {
    background: rgba(244, 67, 54, 0.1);
    border: 1px solid rgba(244, 67, 54, 0.3);
    color: #c62828;
}

/* CF7 Validation Error Styles */
.contact-popup .wpcf7-not-valid {
    border-color: #f44336 !important;
    box-shadow: 0 0 0 3px rgba(244, 67, 54, 0.1) !important;
}

.contact-popup .wpcf7-not-valid-tip {
    font-size: 0.85rem;
    color: #c62828;
    margin-top: 5px;
    display: block;
}

/* Hide CF7 default spinner */
.contact-popup .wpcf7 .ajax-loader {
    display: none;
}

/* Custom rows for CF7 */
.contact-popup .cf7-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.contact-popup .cf7-form-row-triple {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
}

.contact-popup .cf7-form-group {
    display: flex;
    flex-direction: column;
}

.contact-popup .cf7-form-group label {
    margin-bottom: 8px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .contact-popup-overlay {
        padding: 0;
        align-items: stretch;
        justify-content: stretch;
    }
    
    .contact-popup {
        max-width: 100%;
        width: 100%;
        max-height: 100vh;
        height: 100vh;
        border-radius: 0;
        display: flex;
        flex-direction: column;
    }
    
    .popup-content {
        padding: 60px 25px 100px;
        flex: 1;
        overflow-y: auto;
    }
    
    .popup-title {
        font-size: 1.5rem;
        margin-bottom: 25px;
    }
    
    .contact-popup .cf7-form-row,
    .contact-popup .cf7-form-row-triple {
        grid-template-columns: 1fr;
    }
    
    /* Make Bootstrap rows stack on mobile */
    .contact-popup .wpcf7-form .row {
        flex-direction: column;
        gap: 10px;
    }
    
    .contact-popup .wpcf7-form .col-md-6,
    .contact-popup .wpcf7-form .col-md-4,
    .contact-popup .wpcf7-form .col-md-12 {
        flex: 1 1 100%;
        max-width: 100%;
        width: 100%;
    }
    
    /* Ensure all input fields are full width on mobile */
    .contact-popup .wpcf7 input[type="text"],
    .contact-popup .wpcf7 input[type="email"],
    .contact-popup .wpcf7 input[type="tel"],
    .contact-popup .wpcf7 select,
    .contact-popup .wpcf7 textarea {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box;
        margin-left: 0;
        margin-right: 0;
    }
    
    /* Form control wrapper full width */
    .contact-popup .wpcf7-form-control-wrap {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* Form paragraphs full width */
    .contact-popup .wpcf7-form p {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0;
        margin-right: 0;
    }
    
    .popup-close {
        top: 20px;
        right: 20px;
        width: 40px;
        height: 40px;
        background: rgba(255, 255, 255, 0.9);
        z-index: 20;
    }
}

@media (max-width: 480px) {
    .popup-content {
        padding: 70px 20px 100px;
    }
    
    .popup-title {
        font-size: 1.3rem;
    }
}

/* Conditional field styling for "Other" source option */
#other-source-row {
  transition: all 0.3s ease;
  margin-top: 0;
}

#other-source-row.show {
  display: block !important;
}

#other-source {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border-color, #e5e5e5);
  border-radius: 6px;
  font-size: 1rem;
  font-family: inherit;
  background: var(--white, #ffffff);
  transition: border-color 0.3s ease;
  box-sizing: border-box;
}

#other-source:focus {
  border-color: var(--primary-color, #003571);
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 53, 113, 0.1);
}

#other-source-row label {
  font-weight: 600;
  margin-bottom: 8px;
  display: block;
  color: var(--text-dark, #1a1a1a);
}