/* Base Wrapper */
.cr-side-contact-wrapper {
    position: fixed !important; /* Force fixed even if Elementor tries to override */
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    pointer-events: none; /* Let clicks pass through when hidden */
    display: flex;
    justify-content: flex-end;
    
    /* CSS Variables for easier Elementor Control */
    /* Variables are now inherited or set via Elementor controls. Defaults handled in usage. */
}

/* Scope Wrapper (Safe container for Body Move) */
.cr-side-contact-scope {
    display: contents; /* Modern browsers: container disappears from box tree */
    /* Fallback for older browsers if needed, though most support contents */
    position: static;
    width: 0;
    height: 0;
}

.cr-side-contact-wrapper.active {
    pointer-events: auto;
}

/* Backdrop */
.cr-side-contact-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--cr-backdrop-bg, rgba(255, 255, 255, 0.1));
    backdrop-filter: var(--cr-backdrop-blur, blur(10px));
    -webkit-backdrop-filter: var(--cr-backdrop-blur, blur(10px));
    opacity: 0;
    transition: opacity 0.5s ease;
}

.cr-side-contact-wrapper.active .cr-side-contact-backdrop {
    opacity: 1;
}

/* Panel */
.cr-side-contact-panel {
    position: relative;
    width: 100%;
    max-width: 500px;
    height: auto;
    max-height: 90vh;
    margin: auto 20px; /* Centered vertically, offset from right */
    background: var(--cr-panel-bg, #ffffff);
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.1);
    transform: translateX(120%);
    transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.cr-side-contact-wrapper.active .cr-side-contact-panel {
    transform: translateX(0);
}

/* Close Button */
.cr-side-contact-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 10;
    transition: transform 0.3s ease;
    padding: 0;
}

.cr-side-contact-close:hover {
    transform: rotate(90deg);
}

.cr-close-line {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 2px;
    background: #000;
    transform: translate(-50%, -50%) rotate(45deg);
}

.cr-side-contact-close .cr-close-line:last-child {
    transform: translate(-50%, -50%) rotate(-45deg);
}

/* Content */
.cr-side-contact-content {
    padding: 30px 40px;
    overflow-y: hidden;
    height: 100%;
    /* Hide scrollbar for Chrome, Safari and Opera */
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
    display: flex;
    flex-direction: column;
}

.cr-side-contact-content::-webkit-scrollbar {
    display: none;
}

.cr-contact-headline {
    /* font-size: 28px;  Removed to allow Elementor control */
    /* line-height: 1.2; Removed to allow Elementor control */
    margin-bottom: 20px;
    /* font-weight: 700; Removed to allow Elementor control */
}

/* Form Styles */
.cr-side-contact-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cr-input-group {
    position: relative;
    padding-top: 15px;
}

.cr-input-group input,
.cr-input-group textarea,
.cr-input-group select {
    width: 100%;
    border: none;
    border-bottom: 1px solid #ddd;
    background: transparent;
    padding: 8px 0;
    font-size: 15px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.3s ease;
    border-radius: 0; /* Reset */
    color: #000;
}

.cr-input-group label {
    position: absolute;
    top: 25px;
    left: 0;
    font-size: 15px;
    color: #999;
    pointer-events: none;
    transition: all 0.3s ease;
}

/* Floating Label Logic */
.cr-input-group input:focus ~ label,
.cr-input-group input:not(:placeholder-shown) ~ label,
.cr-input-group textarea:focus ~ label,
.cr-input-group textarea:not(:placeholder-shown) ~ label,
.cr-input-group.has-value label {
    top: 0;
    font-size: 11px;
    color: var(--cr-contact-accent, #000);
}

/* Animated Border */
.cr-input-border {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--cr-contact-accent, #000);
    transition: width 0.3s ease;
}

.cr-input-group input:focus ~ .cr-input-border,
.cr-input-group textarea:focus ~ .cr-input-border,
.cr-input-group select:focus ~ .cr-input-border {
    width: 100%;
}

/* Select specifics */
.cr-select-group select {
    appearance: none;
    cursor: pointer;
    color: #000;
}

.cr-select-group select:invalid {
    color: #999;
}

/* When valid (selected), make it black */
.cr-select-group.has-value select {
    color: #000;
}

.cr-select-arrow {
    position: absolute;
    right: 0;
    bottom: 10px;
    font-size: 12px;
    pointer-events: none;
    color: #000;
}

/* Privacy Box */
.cr-privacy-box {
    border: 1px solid #dddddd;
    border-radius: 5px;
    padding: 10px;
    margin-bottom: 10px;
}

.cr-privacy-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    margin: 0;
    pointer-events: auto; /* Ensure clickable */
    position: static; /* Reset absolute from input group if needed */
}

.cr-privacy-checkbox-wrapper {
    flex-basis: 10%;
    display: flex;
    justify-content: center;
    padding-top: 3px; /* Align with first line of text */
    position: relative;
}

/* Hide default checkbox but keep it functional */
.cr-privacy-checkbox-wrapper input {
    position: absolute;
    opacity: 0;
    width: 20px;
    height: 20px;
    cursor: pointer;
    z-index: 2;
}

/* Custom Checkbox Design */
.cr-custom-checkbox {
    width: 20px;
    height: 20px;
    border: 1px solid #ccc;
    border-radius: 4px;
    position: relative;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background: #fff;
    z-index: 1;
    overflow: hidden;
}

/* Checked State - Background Splash */
.cr-privacy-checkbox-wrapper input:checked ~ .cr-custom-checkbox {
    border-color: var(--cr-contact-accent, #000);
    transform: scale(1.1);
    box-shadow: 0 0 0 4px rgba(0,0,0,0.1);
}

/* Splash Effect Element */
.cr-custom-checkbox::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200%;
    height: 200%;
    background: var(--cr-contact-accent, #000);
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    transition: transform 0.4s ease-out;
}

.cr-privacy-checkbox-wrapper input:checked ~ .cr-custom-checkbox::before {
    transform: translate(-50%, -50%) scale(1);
}

/* Checkmark Icon - Drawing Animation */
.cr-custom-checkbox::after {
    content: '';
    position: absolute;
    top: 45%;
    left: 50%;
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: translate(-50%, -60%) rotate(45deg) scale(0);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0.1s;
}

.cr-privacy-checkbox-wrapper input:checked ~ .cr-custom-checkbox::after {
    transform: translate(-50%, -60%) rotate(45deg) scale(1);
}

/* Pulse Animation on Click */
@keyframes checkbox-pulse {
    0% { box-shadow: 0 0 0 0 rgba(0,0,0, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(0,0,0, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0,0,0, 0); }
}

.cr-privacy-checkbox-wrapper input:active ~ .cr-custom-checkbox {
    transform: scale(0.9);
}

/* Hover Effect */
.cr-privacy-checkbox-wrapper:hover .cr-custom-checkbox {
    border-color: var(--cr-contact-accent, #000);
}

.cr-privacy-text {
    flex: 1;
    font-size: 11px;
    line-height: 1.3;
}

.cr-privacy-text p {
    margin: 0; /* Remove default p margin from WYSIWYG */
    padding: 0;
}

.cr-privacy-text a {
    text-decoration: underline;
    color: inherit;
}

/* Submit Button */
.cr-submit-btn {
    margin-top: 10px;
    padding: 12px 30px;
    background: var(--cr-contact-accent, #000);
    color: #fff;
    border: none;
    border-radius: 30px;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: transform 0.3s ease, box-shadow 0.3s ease, width 0.3s ease, border-radius 0.3s ease, background-color 0.3s ease;
    position: relative;
    overflow: hidden;
    width: 100%;
    min-height: 45px; /* Ensure height consistency */
}

.cr-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.btn-icon {
    transition: transform 0.3s ease;
}

.cr-submit-btn:hover .btn-icon {
    transform: translateX(5px);
}

/* Button Loading State */
.cr-submit-btn.loading {
    width: 45px !important;
    max-width: 45px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    pointer-events: none;
    color: transparent; /* Hide text */
}

/* Loader */
.btn-loader {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.cr-submit-btn.loading .btn-text,
.cr-submit-btn.loading .btn-icon {
    opacity: 0;
}

.cr-submit-btn.loading .btn-loader {
    display: block;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Success View */
.cr-contact-success-wrapper {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 300px; /* Ensure vertical centering */
    text-align: center;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.cr-contact-success-wrapper.visible {
    display: flex;
    opacity: 1;
    animation: fadeIn 0.5s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.cr-contact-form-wrapper.hidden {
    display: none;
}

/* Lottie Container */
.cr-success-lottie-wrapper {
    width: 200px;
    height: 200px;
    margin-bottom: 20px;
}

.cr-success-checkmark {
    width: 100%;
    height: 100%;
    stroke: var(--cr-contact-accent, #000);
    stroke-width: 2;
    stroke-miterlimit: 10;
    box-shadow: inset 0px 0px 0px var(--cr-contact-accent, #000);
}

.cr-success-circle {
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    stroke-width: 2;
    stroke-miterlimit: 10;
    stroke: var(--cr-contact-accent, #000);
    fill: none;
    animation: stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.cr-success-check {
    transform-origin: 50% 50%;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    animation: stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.6s forwards;
}

@keyframes stroke {
    100% { stroke-dashoffset: 0; }
}

.cr-success-headline {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 10px;
    color: #000;
}

.cr-success-text {
    font-size: 16px;
    color: #666;
    margin: 0;
}

/* Staggered Animation Initial State */
.staggered-item, .cr-contact-headline {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.cr-side-contact-wrapper.active .staggered-item,
.cr-side-contact-wrapper.active .cr-contact-headline {
    opacity: 1;
    transform: translateY(0);
}

/* Delays */
.cr-side-contact-wrapper.active .cr-contact-headline { transition-delay: 0.2s; }
/* The hidden fields are not staggered items, so inputs are first */
.cr-side-contact-wrapper.active .staggered-item:nth-of-type(1) { transition-delay: 0.3s; }
.cr-side-contact-wrapper.active .staggered-item:nth-of-type(2) { transition-delay: 0.35s; }
.cr-side-contact-wrapper.active .staggered-item:nth-of-type(3) { transition-delay: 0.4s; }
.cr-side-contact-wrapper.active .staggered-item:nth-of-type(4) { transition-delay: 0.45s; }
.cr-side-contact-wrapper.active .staggered-item:nth-of-type(5) { transition-delay: 0.5s; } /* Select */
.cr-side-contact-wrapper.active .staggered-item:nth-of-type(6) { transition-delay: 0.55s; } /* Message */
.cr-side-contact-wrapper.active .staggered-item:nth-of-type(7) { transition-delay: 0.6s; } /* Privacy */
.cr-side-contact-wrapper.active .staggered-item:nth-of-type(8) { transition-delay: 0.65s; } /* Button */

/* Response Message (Legacy - now we use success wrapper, but keep for error handling) */
.cr-form-message {
    margin-top: 15px;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.3s ease;
    text-align: center;
    display: none;
}

.cr-form-message.visible {
    opacity: 1;
    display: block;
}

.cr-form-message.success { color: #28a745; }
.cr-form-message.error { color: #dc3545; }

/* Responsive */
@media (max-width: 768px) {
    .cr-side-contact-panel {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
        margin: 0;
        box-shadow: none;
    }
}