/**
 * Ottimo Connect Frontend Styles
 * Forms, Scheduler, and Chat widgets
 */

/* =====================
   CSS Variables
   ===================== */
:root {
    --ottimo-primary: #f97316;
    --ottimo-primary-hover: #ea580c;
    --ottimo-success: #22c55e;
    --ottimo-error: #ef4444;
    --ottimo-text: #1e293b;
    --ottimo-text-light: #64748b;
    --ottimo-border: #e2e8f0;
    --ottimo-background: #ffffff;
    --ottimo-background-secondary: #f8fafc;
    --ottimo-radius: 8px;
    --ottimo-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
}

/* Dark theme */
.ottimo-theme-dark {
    --ottimo-text: #f1f5f9;
    --ottimo-text-light: #94a3b8;
    --ottimo-border: #334155;
    --ottimo-background: #1e293b;
    --ottimo-background-secondary: #0f172a;
}

/* =====================
   Common Styles
   ===================== */
.ottimo-form-container,
.ottimo-scheduler-container,
.ottimo-chat-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--ottimo-text);
    background: var(--ottimo-background);
    border-radius: var(--ottimo-radius);
    box-sizing: border-box;
}

.ottimo-form-container *,
.ottimo-scheduler-container *,
.ottimo-chat-container * {
    box-sizing: border-box;
}

/* =====================
   Form Styles
   ===================== */
.ottimo-form-container {
    padding: 24px;
}

.ottimo-form-title {
    margin: 0 0 8px 0;
    font-size: 24px;
    font-weight: 700;
    color: var(--ottimo-text);
}

.ottimo-form-description {
    margin: 0 0 24px 0;
    color: var(--ottimo-text-light);
}

.ottimo-form-fields {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.ottimo-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ottimo-field-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--ottimo-text);
}

.ottimo-required {
    color: var(--ottimo-error);
    margin-left: 2px;
}

.ottimo-field-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 14px;
    color: var(--ottimo-text);
    background: var(--ottimo-background);
    border: 1px solid var(--ottimo-border);
    border-radius: 6px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.ottimo-field-input:focus {
    border-color: var(--ottimo-primary);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.15);
}

.ottimo-field-input::placeholder {
    color: var(--ottimo-text-light);
}

select.ottimo-field-input {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

textarea.ottimo-field-input {
    resize: vertical;
    min-height: 100px;
}

/* Checkbox */
.ottimo-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
}

.ottimo-field-checkbox {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: var(--ottimo-primary);
    cursor: pointer;
}

.ottimo-checkbox-text {
    font-size: 14px;
    color: var(--ottimo-text);
    line-height: 1.5;
}

/* Radio */
.ottimo-radio-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ottimo-radio-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.ottimo-field-radio {
    width: 18px;
    height: 18px;
    accent-color: var(--ottimo-primary);
    cursor: pointer;
}

/* Submit Button */
.ottimo-form-submit {
    margin-top: 24px;
}

.ottimo-submit-button,
.ottimo-scheduler-submit,
.ottimo-lead-form-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
    background: var(--ottimo-primary);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

.ottimo-submit-button:hover,
.ottimo-scheduler-submit:hover,
.ottimo-lead-form-submit:hover {
    background: var(--ottimo-primary-hover);
}

.ottimo-submit-button:active,
.ottimo-scheduler-submit:active,
.ottimo-lead-form-submit:active {
    transform: scale(0.98);
}

.ottimo-submit-button:disabled,
.ottimo-scheduler-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.ottimo-button-loading {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ottimo-spinner {
    animation: ottimo-spin 1s linear infinite;
}

@keyframes ottimo-spin {
    to { transform: rotate(360deg); }
}

/* Messages */
.ottimo-form-messages {
    margin-top: 20px;
}

.ottimo-success-message {
    padding: 16px;
    background: #dcfce7;
    border: 1px solid #86efac;
    border-radius: 6px;
    color: #166534;
    text-align: center;
}

.ottimo-success-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.ottimo-error-message {
    padding: 16px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    color: #dc2626;
}

.ottimo-error {
    padding: 16px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    color: #dc2626;
}

/* =====================
   Scheduler Styles
   ===================== */
.ottimo-scheduler-container {
    padding: 24px;
}

.ottimo-scheduler-title {
    margin: 0 0 8px 0;
    font-size: 24px;
    font-weight: 700;
}

.ottimo-scheduler-description {
    margin: 0 0 24px 0;
    color: var(--ottimo-text-light);
}

.ottimo-step-title {
    margin: 0 0 16px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--ottimo-text);
}

/* Service List */
.ottimo-service-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ottimo-service-item {
    padding: 16px;
    background: var(--ottimo-background-secondary);
    border: 2px solid var(--ottimo-border);
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
}

.ottimo-service-item:hover {
    border-color: var(--ottimo-primary);
}

.ottimo-service-item.selected {
    border-color: var(--ottimo-primary);
    background: rgba(249, 115, 22, 0.05);
}

.ottimo-service-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ottimo-service-name {
    font-weight: 600;
    color: var(--ottimo-text);
}

.ottimo-service-duration {
    font-size: 13px;
    color: var(--ottimo-text-light);
    background: var(--ottimo-background);
    padding: 4px 10px;
    border-radius: 20px;
}

.ottimo-service-description {
    margin: 8px 0 0 0;
    font-size: 13px;
    color: var(--ottimo-text-light);
}

/* Calendar */
.ottimo-calendar {
    margin-bottom: 20px;
}

.ottimo-calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.ottimo-calendar-month {
    font-size: 16px;
    font-weight: 600;
    color: var(--ottimo-text);
}

.ottimo-calendar-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--ottimo-background-secondary);
    border: 1px solid var(--ottimo-border);
    border-radius: 6px;
    cursor: pointer;
    color: var(--ottimo-text);
    transition: background-color 0.2s;
}

.ottimo-calendar-nav:hover {
    background: var(--ottimo-border);
}

.ottimo-calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 8px;
}

.ottimo-calendar-weekdays span {
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--ottimo-text-light);
    padding: 8px 0;
}

.ottimo-calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.ottimo-calendar-day {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    font-size: 14px;
    font-weight: 500;
    color: var(--ottimo-text);
    background: var(--ottimo-background);
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.ottimo-calendar-day:hover:not(.disabled):not(.empty) {
    border-color: var(--ottimo-primary);
}

.ottimo-calendar-day.selected {
    background: var(--ottimo-primary);
    color: #ffffff;
}

.ottimo-calendar-day.today:not(.selected) {
    border-color: var(--ottimo-primary);
}

.ottimo-calendar-day.disabled {
    color: var(--ottimo-text-light);
    opacity: 0.5;
    cursor: not-allowed;
}

.ottimo-calendar-day.empty {
    cursor: default;
}

/* Time Slots */
.ottimo-selected-date {
    margin-bottom: 16px;
    font-weight: 500;
    color: var(--ottimo-text);
}

.ottimo-time-slots {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.ottimo-time-slot {
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--ottimo-text);
    background: var(--ottimo-background-secondary);
    border: 2px solid var(--ottimo-border);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.ottimo-time-slot:hover {
    border-color: var(--ottimo-primary);
}

.ottimo-time-slot.selected {
    background: var(--ottimo-primary);
    border-color: var(--ottimo-primary);
    color: #ffffff;
}

.ottimo-timezone-note {
    font-size: 12px;
    color: var(--ottimo-text-light);
    margin-bottom: 16px;
}

/* Booking Summary */
.ottimo-booking-summary {
    padding: 16px;
    background: var(--ottimo-background-secondary);
    border-radius: 8px;
    margin-bottom: 20px;
}

.ottimo-summary-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--ottimo-border);
}

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

.ottimo-summary-label {
    color: var(--ottimo-text-light);
}

.ottimo-summary-value {
    font-weight: 600;
    color: var(--ottimo-text);
}

/* Back Button */
.ottimo-step-back {
    display: inline-flex;
    align-items: center;
    padding: 10px 16px;
    font-size: 14px;
    color: var(--ottimo-text-light);
    background: transparent;
    border: 1px solid var(--ottimo-border);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.ottimo-step-back:hover {
    background: var(--ottimo-background-secondary);
    color: var(--ottimo-text);
}

/* Form Actions */
.ottimo-form-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

/* Success State */
.ottimo-scheduler-success {
    text-align: center;
    padding: 40px 20px;
}

.ottimo-success-title {
    margin: 16px 0 8px 0;
    font-size: 20px;
    font-weight: 700;
    color: var(--ottimo-text);
}

.ottimo-book-another {
    margin-top: 20px;
    padding: 12px 24px;
    font-size: 14px;
    color: var(--ottimo-primary);
    background: transparent;
    border: 2px solid var(--ottimo-primary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.ottimo-book-another:hover {
    background: var(--ottimo-primary);
    color: #ffffff;
}

/* =====================
   Chat Styles
   ===================== */
.ottimo-chat-container {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ottimo-chat-inline {
    height: 500px;
    border: 1px solid var(--ottimo-border);
}

/* Chat Header */
.ottimo-chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--ottimo-primary);
    color: #ffffff;
}

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

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

.ottimo-chat-header-info {
    display: flex;
    flex-direction: column;
}

.ottimo-chat-bot-name {
    font-weight: 600;
    font-size: 14px;
}

.ottimo-chat-status {
    font-size: 12px;
    opacity: 0.9;
}

/* Lead Form */
.ottimo-chat-lead-form {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 24px;
}

.ottimo-lead-form-title {
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--ottimo-text);
}

.ottimo-lead-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ottimo-lead-form-submit {
    margin-top: 8px;
    width: 100%;
}

/* Messages */
.ottimo-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ottimo-chat-message {
    display: flex;
}

.ottimo-chat-message.user {
    justify-content: flex-end;
}

.ottimo-chat-bubble {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
}

.ottimo-chat-bubble.bot {
    background: var(--ottimo-background-secondary);
    color: var(--ottimo-text);
    border-bottom-left-radius: 4px;
}

.ottimo-chat-bubble.user {
    background: var(--ottimo-primary);
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

/* Input Area */
.ottimo-chat-input-area {
    padding: 12px;
    border-top: 1px solid var(--ottimo-border);
}

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

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

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

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

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

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

/* Powered By */
.ottimo-chat-powered {
    padding: 8px;
    text-align: center;
    font-size: 11px;
}

.ottimo-chat-powered a {
    color: var(--ottimo-text-light);
    text-decoration: none;
}

.ottimo-chat-powered a:hover {
    color: var(--ottimo-primary);
}

/* Floating Chat */
.ottimo-chat-floating-wrapper {
    position: fixed;
    z-index: 99999;
    bottom: 20px;
}

.ottimo-chat-bottom-right {
    right: 20px;
}

.ottimo-chat-bottom-left {
    left: 20px;
}

.ottimo-chat-floating-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    background: var(--ottimo-primary);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
}

.ottimo-chat-floating-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(249, 115, 22, 0.5);
}

.ottimo-chat-floating-window {
    position: absolute;
    bottom: 70px;
    width: 380px;
    max-height: 600px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.ottimo-chat-bottom-right .ottimo-chat-floating-window {
    right: 0;
}

.ottimo-chat-bottom-left .ottimo-chat-floating-window {
    left: 0;
}

.ottimo-chat-floating-window .ottimo-chat-container {
    height: 500px;
}

/* =====================
   Responsive
   ===================== */
@media (max-width: 480px) {
    .ottimo-chat-floating-window {
        width: calc(100vw - 40px);
        right: 0 !important;
        left: 0 !important;
        margin: 0 auto;
    }
    
    .ottimo-time-slots {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* =====================
   Elementor Editor
   ===================== */
.ottimo-placeholder {
    padding: 40px;
    text-align: center;
    background: var(--ottimo-background-secondary);
    border: 2px dashed var(--ottimo-border);
    border-radius: var(--ottimo-radius);
    color: var(--ottimo-text-light);
}
