/* =================================
   Modal Styles
   ================================= */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(5px);
}

.modal-content {
    position: relative;
    background: var(--white);
    border-radius: var(--radius-xl);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 3rem;
    box-shadow: var(--shadow-xl);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal.active .modal-content {
    transform: scale(1);
}

.modal-small {
    max-width: 450px;
}

.modal-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    width: 40px;
    height: 40px;
    background: var(--lighter-gray);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: var(--dark);
    cursor: pointer;
    transition: var(--transition-fast);
}

.modal-close:hover {
    background: var(--light-gray);
    transform: rotate(90deg);
}

.modal-header {
    text-align: center;
    margin-bottom: 2rem;
}

.modal-header h2 {
    font-family: var(--font-display);
    margin-bottom: 0.5rem;
}

.modal-header p {
    color: var(--gray);
}

.modal-offer {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--gradient-success);
    color: var(--white);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-lg);
    margin-top: 1rem;
    font-weight: 600;
    animation: pulse 2s infinite;
}

.modal-offer i {
    font-size: 1.25rem;
}

.modal-icon {
    text-align: center;
    margin-bottom: 2rem;
}

.modal-icon i {
    font-size: 4rem;
    color: var(--primary-color);
    animation: bounce 2s infinite;
}

.lead-form {
    margin-top: 2rem;
}

.form-note {
    text-align: center;
    margin-top: 1rem;
    color: var(--gray);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.form-note i {
    color: var(--secondary-color);
}

/* =================================
   Chat Widget
   ================================= */

.chat-widget {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 9998;
}

.chat-button {
    width: 60px;
    height: 60px;
    background: var(--gradient-primary);
    color: var(--white);
    border-radius: 50%;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition-fast);
    position: relative;
}

.chat-button:hover {
    transform: scale(1.1);
}

.chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger-color);
    color: var(--white);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    animation: pulse 2s infinite;
}

.chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    max-height: 500px;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    display: flex;
    flex-direction: column;
    transform: scale(0);
    transform-origin: bottom right;
    transition: transform 0.3s ease;
}

.chat-window.active {
    transform: scale(1);
}

.chat-header {
    padding: 1.5rem;
    background: var(--gradient-primary);
    color: var(--white);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.chat-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.chat-info {
    flex: 1;
}

.chat-info h4 {
    margin-bottom: 0.25rem;
}

.chat-status {
    font-size: 0.875rem;
    opacity: 0.9;
}

.chat-close {
    width: 30px;
    height: 30px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.chat-close:hover {
    background: rgba(255,255,255,0.3);
}

.chat-messages {
    padding: 1.5rem;
    flex: 1;
    overflow-y: auto;
}

.chat-message {
    max-width: 80%;
    margin-bottom: 1rem;
}

.chat-message.agent {
    margin-right: auto;
}

.chat-message p {
    background: var(--lighter-gray);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 0.25rem;
}

.message-time {
    font-size: 0.75rem;
    color: var(--gray);
}

.chat-form {
    padding: 1.5rem;
    border-top: 1px solid var(--light-gray);
}

.chat-form .form-group {
    margin-bottom: 1rem;
}

.chat-form input {
    width: 100%;
    padding: 0.75rem;
    background: var(--lighter-gray);
    border-radius: var(--radius-sm);
    border: none;
}

/* =================================
   Loading Overlay
   ================================= */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

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

.loading-overlay p {
    color: var(--white);
    font-size: 1.125rem;
}

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

@media (max-width: 768px) {
    .modal-content {
        padding: 2rem;
        max-width: 95%;
    }

    .chat-window {
        width: calc(100vw - 4rem);
        max-width: 350px;
    }

    .chat-widget {
        bottom: 1rem;
        right: 1rem;
    }
}
