/**
 * EDD AI Assistant - Chat Widget Styles
 */

/* Variables */
:root {
    --edd-chat-primary: #1E3A5F;
    --edd-chat-primary-dark: #0A1628;
    --edd-chat-accent: #25D366;
    --edd-chat-white: #FFFFFF;
    --edd-chat-gray-light: #F5F7FA;
    --edd-chat-gray: #E8ECF1;
    --edd-chat-gray-text: #4A5568;
    --edd-chat-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    --edd-chat-radius: 16px;
}

/* Widget Container */
.edd-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

/* Toggle Button */
.edd-chat-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--edd-chat-accent);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--edd-chat-shadow);
    transition: all 0.3s ease;
    animation: pulse-chat 2s infinite;
}

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

.edd-chat-toggle svg {
    width: 32px;
    height: 32px;
    color: var(--edd-chat-white);
}

.edd-chat-toggle .icon-close {
    display: none;
}

.edd-chat-widget.open .edd-chat-toggle .icon-chat {
    display: none;
}

.edd-chat-widget.open .edd-chat-toggle .icon-close {
    display: block;
}

@keyframes pulse-chat {
    0% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.7); }
    70% { box-shadow: 0 0 0 15px rgba(37, 211, 102, 0); }
    100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); }
}

.edd-chat-widget.open .edd-chat-toggle {
    animation: none;
    background: var(--edd-chat-primary);
}

/* Chat Window */
.edd-chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 550px;
    max-height: calc(100vh - 120px);
    background: var(--edd-chat-white);
    border-radius: var(--edd-chat-radius);
    box-shadow: var(--edd-chat-shadow);
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s ease;
    overflow: hidden;
}

.edd-chat-widget.open .edd-chat-window {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Chat Header */
.edd-chat-header {
    background: linear-gradient(135deg, var(--edd-chat-primary-dark) 0%, var(--edd-chat-primary) 100%);
    color: var(--edd-chat-white);
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.edd-chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.edd-chat-avatar svg {
    width: 24px;
    height: 24px;
}

.edd-chat-header-text h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

.edd-chat-header-text p {
    margin: 0;
    font-size: 12px;
    opacity: 0.8;
}

.edd-chat-minimize {
    background: none;
    border: none;
    color: var(--edd-chat-white);
    cursor: pointer;
    padding: 8px;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.edd-chat-minimize:hover {
    opacity: 1;
}

.edd-chat-minimize svg {
    width: 20px;
    height: 20px;
}

/* Disclaimer */
.edd-chat-disclaimer {
    background: #FFF8E6;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: #92700C;
    border-bottom: 1px solid #F5C518;
}

.edd-chat-disclaimer svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* Messages Area */
.edd-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--edd-chat-gray-light);
}

/* Message Bubbles */
.edd-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    animation: fadeIn 0.3s ease;
}

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

.edd-message-user {
    background: var(--edd-chat-primary);
    color: var(--edd-chat-white);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.edd-message-assistant {
    background: var(--edd-chat-white);
    color: var(--edd-chat-gray-text);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.edd-message-assistant p {
    margin: 0 0 8px;
}

.edd-message-assistant p:last-child {
    margin-bottom: 0;
}

/* Typing Indicator */
.edd-typing {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: var(--edd-chat-white);
    border-radius: 16px;
    align-self: flex-start;
}

.edd-typing span {
    width: 8px;
    height: 8px;
    background: var(--edd-chat-gray);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.edd-typing span:nth-child(1) { animation-delay: 0s; }
.edd-typing span:nth-child(2) { animation-delay: 0.2s; }
.edd-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0.6); background: var(--edd-chat-gray); }
    40% { transform: scale(1); background: var(--edd-chat-primary); }
}

/* Input Area */
.edd-chat-input-wrapper {
    padding: 12px 16px;
    background: var(--edd-chat-white);
    border-top: 1px solid var(--edd-chat-gray);
}

.edd-chat-form {
    display: flex;
    gap: 8px;
}

.edd-chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--edd-chat-gray);
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.edd-chat-input:focus {
    border-color: var(--edd-chat-primary);
}

.edd-chat-send {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--edd-chat-primary);
    border: none;
    color: var(--edd-chat-white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.edd-chat-send:hover {
    background: var(--edd-chat-primary-dark);
}

.edd-chat-send svg {
    width: 20px;
    height: 20px;
}

/* Quick Actions */
.edd-chat-quick-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.edd-quick-action {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: var(--edd-chat-gray-light);
    border: 1px solid var(--edd-chat-gray);
    border-radius: 20px;
    font-size: 12px;
    color: var(--edd-chat-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.edd-quick-action:hover {
    background: var(--edd-chat-primary);
    color: var(--edd-chat-white);
    border-color: var(--edd-chat-primary);
}

.edd-quick-action svg {
    width: 14px;
    height: 14px;
}

/* Scheduler Panel */
.edd-scheduler-panel {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: var(--edd-chat-white);
}

.edd-intake-form h4 {
    margin: 0 0 8px;
    color: var(--edd-chat-primary-dark);
}

.edd-intake-form > p {
    margin: 0 0 16px;
    color: var(--edd-chat-gray-text);
    font-size: 13px;
}

.edd-intake-form h5 {
    margin: 0 0 12px;
    color: var(--edd-chat-primary-dark);
    font-size: 14px;
}

/* Form Groups */
.edd-form-group {
    margin-bottom: 12px;
}

.edd-form-group label {
    display: block;
    margin-bottom: 4px;
    font-size: 12px;
    font-weight: 500;
    color: var(--edd-chat-gray-text);
}

.edd-form-group .required {
    color: #E53E3E;
}

.edd-form-group input,
.edd-form-group select,
.edd-form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--edd-chat-gray);
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.edd-form-group input:focus,
.edd-form-group select:focus,
.edd-form-group textarea:focus {
    outline: none;
    border-color: var(--edd-chat-primary);
}

/* Buttons */
.edd-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    margin-top: 8px;
}

.edd-btn-primary {
    background: var(--edd-chat-primary);
    color: var(--edd-chat-white);
}

.edd-btn-primary:hover {
    background: var(--edd-chat-primary-dark);
}

.edd-btn-primary:disabled {
    background: var(--edd-chat-gray);
    cursor: not-allowed;
}

.edd-btn-secondary {
    background: var(--edd-chat-gray-light);
    color: var(--edd-chat-gray-text);
}

.edd-btn-secondary:hover {
    background: var(--edd-chat-gray);
}

/* Date Picker */
.edd-date-picker {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
    padding: 4px;
}

.edd-date-option {
    padding: 10px 8px;
    background: var(--edd-chat-gray-light);
    border: 1px solid var(--edd-chat-gray);
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.edd-date-option:hover {
    border-color: var(--edd-chat-primary);
}

.edd-date-option.selected {
    background: var(--edd-chat-primary);
    color: var(--edd-chat-white);
    border-color: var(--edd-chat-primary);
}

.edd-date-option .day-name {
    font-size: 11px;
    opacity: 0.8;
}

.edd-date-option .day-date {
    font-size: 14px;
    font-weight: 600;
}

/* Time Picker */
.edd-time-picker {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    max-height: 180px;
    overflow-y: auto;
    padding: 4px;
}

.edd-time-option {
    padding: 10px;
    background: var(--edd-chat-gray-light);
    border: 1px solid var(--edd-chat-gray);
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
}

.edd-time-option:hover {
    border-color: var(--edd-chat-primary);
}

.edd-time-option.selected {
    background: var(--edd-chat-primary);
    color: var(--edd-chat-white);
    border-color: var(--edd-chat-primary);
}

/* Appointment Summary */
.edd-appointment-summary {
    background: var(--edd-chat-gray-light);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 16px;
}

.edd-summary-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--edd-chat-gray);
    font-size: 13px;
}

.edd-summary-item:last-child {
    border-bottom: none;
}

.edd-summary-price {
    font-size: 16px;
    color: var(--edd-chat-primary);
}

/* Payment Methods */
.edd-payment-methods {
    margin-bottom: 16px;
}

.edd-payment-methods h6 {
    margin: 0 0 8px;
    font-size: 13px;
    color: var(--edd-chat-gray-text);
}

.edd-payment-options {
    display: flex;
    gap: 8px;
}

.edd-payment-option {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--edd-chat-gray);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 12px;
}

.edd-payment-option:has(input:checked) {
    border-color: var(--edd-chat-primary);
    background: rgba(30, 58, 95, 0.05);
}

.edd-payment-option input {
    margin: 0;
}

/* Card Element */
.edd-card-element {
    padding: 12px;
    border: 1px solid var(--edd-chat-gray);
    border-radius: 8px;
    margin-bottom: 12px;
}

.edd-card-errors {
    color: #E53E3E;
    font-size: 12px;
    margin-top: 8px;
}

/* Consent */
.edd-consent {
    margin-bottom: 12px;
}

.edd-consent label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 12px;
    color: var(--edd-chat-gray-text);
    cursor: pointer;
}

.edd-consent input {
    margin-top: 2px;
}

.edd-consent a {
    color: var(--edd-chat-primary);
}

/* Success Message */
.edd-success-message {
    text-align: center;
    padding: 20px;
}

.edd-success-message svg {
    width: 64px;
    height: 64px;
    color: #38A169;
    margin-bottom: 16px;
}

.edd-success-message h4 {
    margin: 0 0 8px;
    color: #38A169;
}

.edd-success-message p {
    margin: 0 0 16px;
    color: var(--edd-chat-gray-text);
}

.edd-confirmation-details {
    background: var(--edd-chat-gray-light);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 16px;
    text-align: left;
    font-size: 13px;
}

/* Loading */
.edd-loading {
    text-align: center;
    padding: 20px;
    color: var(--edd-chat-gray-text);
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .edd-chat-widget {
        bottom: 10px;
        right: 10px;
    }

    .edd-chat-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 100px);
        bottom: 70px;
        right: -10px;
        border-radius: 12px;
    }

    .edd-chat-toggle {
        width: 55px;
        height: 55px;
    }

    .edd-date-picker,
    .edd-time-picker {
        grid-template-columns: repeat(2, 1fr);
    }

    .edd-payment-options {
        flex-direction: column;
    }
}

/* Scrollbar Styling */
.edd-chat-messages::-webkit-scrollbar,
.edd-scheduler-panel::-webkit-scrollbar {
    width: 6px;
}

.edd-chat-messages::-webkit-scrollbar-track,
.edd-scheduler-panel::-webkit-scrollbar-track {
    background: transparent;
}

.edd-chat-messages::-webkit-scrollbar-thumb,
.edd-scheduler-panel::-webkit-scrollbar-thumb {
    background: var(--edd-chat-gray);
    border-radius: 3px;
}

.edd-chat-messages::-webkit-scrollbar-thumb:hover,
.edd-scheduler-panel::-webkit-scrollbar-thumb:hover {
    background: var(--edd-chat-primary);
}
