/* Chat Widget CSS for Coach Zach Soccer Training Website */

.chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Chat Bubble */
.chat-bubble {
    background: linear-gradient(135deg, #16a34a, #22c55e);
    color: white;
    padding: 16px 20px;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 200px;
}

.chat-bubble:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(22, 163, 74, 0.4);
}

.chat-icon {
    font-size: 20px;
    line-height: 1;
}

.chat-text {
    font-weight: 600;
    font-size: 14px;
}

/* Chat Interface */
.chat-interface {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    max-height: 600px; /* Increased height to accommodate form */
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    opacity: 0;
    pointer-events: none;
}

.chat-interface.open {
    transform: translateX(0);
    opacity: 1;
    pointer-events: all;
}

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, #16a34a, #22c55e);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0; /* Prevent header from shrinking */
}

.chat-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Chat Messages */
.chat-messages {
    padding: 20px;
    max-height: 150px; /* Reduced to make room for form */
    overflow-y: auto;
    flex-shrink: 0; /* Prevent messages from shrinking */
}

.message {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
}

.message-content {
    background: #f3f4f6;
    padding: 12px 16px;
    border-radius: 18px;
    max-width: 80%;
    word-wrap: break-word;
}

.coach-message .message-content {
    background: #dcfce7;
    color: #166534;
}

.customer-message .message-content {
    background: #dbeafe;
    color: #1e40af;
    margin-left: auto;
}

.message-time {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 4px;
    text-align: right;
}

.customer-message .message-time {
    text-align: left;
}

/* Chat Form */
.chat-form {
    padding: 20px;
    border-top: 1px solid #e5e7eb;
    background: white;
    overflow-y: auto; /* Add scrolling to form area */
    max-height: 300px; /* Limit form height */
    flex: 1; /* Allow form to take remaining space */
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #374151;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #16a34a;
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1);
}

/* Checkbox Styling */
.checkbox-group {
    margin-bottom: 20px;
}

.checkbox-label {
    display: flex !important;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    font-size: 13px;
    line-height: 1.4;
    color: #374151;
    font-weight: 400;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    margin: 0;
    flex-shrink: 0;
    margin-top: 2px;
}

.checkbox-label .checkmark {
    display: none; /* We'll use the default checkbox for now */
}

.checkbox-label:hover {
    color: #16a34a;
}

.checkbox-label:focus-within {
    color: #16a34a;
}

/* Terms Links Styling */
.terms-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
    margin-bottom: 20px;
    font-size: 12px;
    color: #6b7280;
}

.terms-link {
    color: #16a34a;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.terms-link:hover {
    color: #15803d;
    text-decoration: underline;
}

.terms-separator {
    color: #9ca3af;
    font-weight: 400;
}

.submit-btn {
    width: 100%;
    background: linear-gradient(135deg, #16a34a, #22c55e);
    color: white;
    border: none;
    padding: 14px 20px; /* Slightly increased padding */
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 8px; /* Add margin to separate from form fields */
    flex-shrink: 0; /* Prevent button from shrinking */
}

.submit-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
}

.submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Waiting State */
.waiting-state {
    text-align: center;
    padding: 20px;
}

.waiting-icon {
    font-size: 48px;
    margin-bottom: 16px;
    animation: pulse 2s infinite;
}

.waiting-state h3 {
    color: #16a34a;
    margin-bottom: 12px;
    font-size: 18px;
}

.waiting-state p {
    color: #6b7280;
    margin-bottom: 8px;
    font-size: 14px;
    line-height: 1.5;
}

.waiting-state p:last-child {
    margin-bottom: 0;
    font-weight: 500;
    color: #374151;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
}

/* Success Message */
.success-message {
    background: #dcfce7;
    color: #166534;
    padding: 16px;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 16px;
    display: none;
}

.success-message.show {
    display: block;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .chat-interface {
        width: calc(100vw - 40px);
        right: -20px;
        bottom: 100px;
        max-height: 70vh; /* Use viewport height on mobile */
    }
    
    .chat-bubble {
        min-width: 180px;
        padding: 14px 18px;
    }
    
    .chat-messages {
        max-height: 120px; /* Smaller on mobile */
    }
    
    .chat-form {
        max-height: 250px; /* Smaller on mobile */
    }
    
    .checkbox-label {
        font-size: 12px;
    }
}

/* Animation for new messages */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message {
    animation: slideIn 0.3s ease;
}

/* Scrollbar styling for chat messages and form */
.chat-messages::-webkit-scrollbar,
.chat-form::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track,
.chat-form::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb,
.chat-form::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover,
.chat-form::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Focus states for accessibility */
.chat-bubble:focus,
.close-btn:focus,
.submit-btn:focus {
    outline: 2px solid #16a34a;
    outline-offset: 2px;
}

/* Loading state for submit button */
.btn-loading {
    display: none;
}

/* Error state styling */
.form-group.error input,
.form-group.error select,
.form-group.error textarea {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.form-group.error label {
    color: #dc2626;
}

/* Success state styling */
.form-group.success input,
.form-group.success select,
.form-group.success textarea {
    border-color: #16a34a;
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1);
}
