/* === Avifo Planner Pro - Cal.com-achtige Layout === */

:root {
    --avifo-primary: #2563eb;
    --avifo-primary-dark: #1d4ed8;
    --avifo-primary-light: #3b82f6;
    --avifo-success: #10b981;
    --avifo-error: #ef4444;
    --avifo-warning: #f59e0b;
    --avifo-gray-50: #f9fafb;
    --avifo-gray-100: #f3f4f6;
    --avifo-gray-200: #e5e7eb;
    --avifo-gray-300: #d1d5db;
    --avifo-gray-400: #9ca3af;
    --avifo-gray-500: #6b7280;
    --avifo-gray-600: #4b5563;
    --avifo-gray-700: #374151;
    --avifo-gray-800: #1f2937;
    --avifo-gray-900: #111827;
}

/* === MAIN CONTAINER === */
.avifo-booking-wrapper {
    max-width: 1100px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.avifo-booking-container {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    overflow: hidden;
}

.avifo-booking-title {
    text-align: center;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--avifo-gray-900);
    padding: 1.5rem 2rem;
    margin: 0;
    border-bottom: 1px solid var(--avifo-gray-200);
    background: var(--avifo-gray-50);
}

/* === STEP 1: 3-COLUMN LAYOUT === */
.avifo-step-planner {
    display: none;
}

.avifo-step-planner.active {
    display: block;
}

.avifo-planner-grid {
    display: grid;
    grid-template-columns: 200px 1fr 220px;
    min-height: 450px;
}

/* Column borders */
.avifo-planner-col {
    padding: 1.5rem;
}

.avifo-planner-col:not(:last-child) {
    border-right: 1px solid var(--avifo-gray-200);
}

.avifo-planner-col-header {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--avifo-gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

/* === COLUMN 1: DURATION SELECTION === */
.avifo-duration-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.avifo-duration-option {
    display: flex;
    align-items: center;
    padding: 1rem;
    border: 2px solid var(--avifo-gray-200);
    border-radius: 10px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    text-align: left;
    width: 100%;
}

.avifo-duration-option:hover {
    border-color: var(--avifo-primary-light);
    background: var(--avifo-gray-50);
}

.avifo-duration-option.selected {
    border-color: var(--avifo-primary);
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
}

.avifo-duration-radio {
    width: 20px;
    height: 20px;
    border: 2px solid var(--avifo-gray-300);
    border-radius: 50%;
    margin-right: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.avifo-duration-option.selected .avifo-duration-radio {
    border-color: var(--avifo-primary);
    background: var(--avifo-primary);
}

.avifo-duration-option.selected .avifo-duration-radio::after {
    content: '';
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
}

.avifo-duration-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.avifo-duration-label {
    font-weight: 600;
    font-size: 1rem;
    color: var(--avifo-gray-900);
}

.avifo-duration-sublabel {
    font-size: 0.75rem;
    color: var(--avifo-gray-500);
}

/* === COLUMN 2: CALENDAR === */
.avifo-calendar-wrapper {
    max-width: 350px;
    margin: 0 auto;
}

.avifo-calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.avifo-calendar-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--avifo-gray-900);
}

.avifo-calendar-nav {
    display: flex;
    gap: 0.5rem;
}

.avifo-cal-nav {
    background: var(--avifo-gray-100);
    border: none;
    border-radius: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.125rem;
    color: var(--avifo-gray-600);
    transition: all 0.2s ease;
}

.avifo-cal-nav:hover {
    background: var(--avifo-primary);
    color: white;
}

.avifo-cal-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.avifo-cal-nav:disabled:hover {
    background: var(--avifo-gray-100);
    color: var(--avifo-gray-600);
}

/* Calendar Grid */
.avifo-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.avifo-cal-day-name {
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--avifo-gray-500);
    padding: 0.5rem 0;
    text-transform: uppercase;
}

.avifo-cal-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    background: transparent;
    color: var(--avifo-gray-900);
    border: none;
    padding: 0;
}

.avifo-cal-day:hover:not(.disabled):not(.unavailable) {
    background: var(--avifo-gray-100);
}

.avifo-cal-day.available {
    background: var(--avifo-gray-50);
    font-weight: 600;
}

.avifo-cal-day.available:hover {
    background: var(--avifo-primary);
    color: white;
    transform: scale(1.05);
}

.avifo-cal-day.selected {
    background: var(--avifo-primary);
    color: white;
    font-weight: 600;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.3);
}

/* Range selection styling for multi-day bookings */
.avifo-cal-day.range-start,
.avifo-cal-day.range-end {
    background: var(--avifo-primary);
    color: white;
    font-weight: 600;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.3);
}

.avifo-cal-day.range-in {
    background: rgba(37, 99, 235, 0.15);
    color: var(--avifo-gray-900);
    font-weight: 500;
}

.avifo-cal-day.range-in:hover {
    background: rgba(37, 99, 235, 0.25);
}

.avifo-cal-day.today {
    border: 2px solid var(--avifo-primary);
}

.avifo-cal-day.today.selected {
    border-color: transparent;
}

.avifo-cal-day.disabled,
.avifo-cal-day.unavailable {
    opacity: 0.3;
    cursor: not-allowed;
}

.avifo-cal-day.other-month {
    opacity: 0.2;
    cursor: default;
}

/* Loading state for calendar */
.avifo-calendar-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 280px;
    color: var(--avifo-gray-500);
}

/* === COLUMN 3: TIME SLOTS === */
.avifo-times-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.avifo-times-date {
    font-size: 0.875rem;
    color: var(--avifo-gray-600);
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--avifo-gray-200);
}

.avifo-times-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
    overflow-y: auto;
    max-height: 350px;
    padding-right: 0.5rem;
}

/* === START/END TIME DISPLAY === */
.avifo-time-block {
    background: var(--avifo-gray-50);
    border: 1px solid var(--avifo-gray-200);
    border-radius: 10px;
    padding: 10px 12px;
    margin-top: 6px;
}

.avifo-time-block:last-child {
    margin-bottom: 16px;
}

.avifo-time-label {
    font-size: 12px;
    color: var(--avifo-gray-600);
    margin-bottom: 4px;
    font-weight: 600;
    display: block;
}

.avifo-time-value {
    font-size: 13px;
    line-height: 1.4;
    font-weight: 600;
    color: var(--avifo-gray-900);
}

.avifo-time-select {
    width: 100%;
    font-size: 13px;
    line-height: 1.4;
    padding: 8px 10px;
    border: 1px solid var(--avifo-gray-300);
    border-radius: 6px;
    background: white;
}

.avifo-times-list::-webkit-scrollbar {
    width: 6px;
}

.avifo-times-list::-webkit-scrollbar-track {
    background: var(--avifo-gray-100);
    border-radius: 3px;
}

.avifo-times-list::-webkit-scrollbar-thumb {
    background: var(--avifo-gray-300);
    border-radius: 3px;
}

.avifo-time-btn {
    padding: 0.875rem 1rem;
    border: 1px solid var(--avifo-gray-200);
    border-radius: 8px;
    background: var(--avifo-gray-50);
    cursor: pointer;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--avifo-gray-800);
    transition: all 0.2s ease;
    font-family: inherit;
    text-align: center;
}

.avifo-time-btn:hover {
    border-color: var(--avifo-gray-300);
    background: white;
}

.avifo-time-btn.selected {
    border-color: var(--avifo-gray-900);
    background: var(--avifo-gray-900);
    color: white;
}

.avifo-cal-day.blocked {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fee2e2;
    cursor: not-allowed;
}

.avifo-cal-day.blocked:hover {
    background: #fee2e2;
}

.avifo-times-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem 1rem;
    color: var(--avifo-gray-500);
    flex: 1;
}

.avifo-times-empty-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.avifo-times-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem 1rem;
    color: var(--avifo-gray-400);
    font-size: 0.875rem;
    flex: 1;
}

/* === FOOTER / ACTION BAR === */
.avifo-planner-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    background: var(--avifo-gray-50);
    border-top: 1px solid var(--avifo-gray-200);
}

.avifo-selected-summary {
    display: flex;
    gap: 1.5rem;
    font-size: 0.875rem;
    color: var(--avifo-gray-600);
}

.avifo-selected-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.avifo-selected-item strong {
    color: var(--avifo-gray-900);
}

.avifo-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.avifo-btn-primary {
    background: var(--avifo-primary);
    color: white;
}

.avifo-btn-primary:hover:not(:disabled) {
    background: var(--avifo-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.avifo-btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.avifo-btn-secondary {
    background: var(--avifo-gray-200);
    color: var(--avifo-gray-700);
}

.avifo-btn-secondary:hover {
    background: var(--avifo-gray-300);
}

.avifo-btn-success {
    background: var(--avifo-success);
    color: white;
}

.avifo-btn-success:hover:not(:disabled) {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

/* === STEP 2: FORM === */
.avifo-step-form {
    display: none;
    padding: 2rem;
}

.avifo-step-form.active {
    display: block;
    animation: avifo-fade-in 0.3s ease;
}

.avifo-form-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
}

.avifo-form-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--avifo-gray-900);
    margin: 0 0 0.5rem 0;
}

.avifo-form-subtitle {
    color: var(--avifo-gray-500);
    font-size: 0.9375rem;
    margin: 0;
}

.avifo-booking-summary-card {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border: 1px solid var(--avifo-primary-light);
    border-radius: 12px;
    padding: 1.25rem;
    min-width: 280px;
}

.avifo-booking-summary-card h4 {
    margin: 0 0 0.75rem 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--avifo-primary-dark);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.avifo-booking-summary-card p {
    margin: 0.25rem 0;
    font-size: 0.9375rem;
    color: var(--avifo-gray-700);
}

.avifo-booking-summary-card strong {
    color: var(--avifo-gray-900);
}

/* Form Fields */
.avifo-fields-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.avifo-field-group {
    display: flex;
    flex-direction: column;
}

.avifo-field-full {
    grid-column: 1 / -1;
}

.avifo-label {
    font-weight: 600;
    color: var(--avifo-gray-700);
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.avifo-required {
    color: var(--avifo-error);
}

.avifo-input,
.avifo-textarea {
    padding: 0.75rem 1rem;
    border: 2px solid var(--avifo-gray-200);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s ease;
    font-family: inherit;
}

.avifo-input:focus,
.avifo-textarea:focus {
    outline: none;
    border-color: var(--avifo-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.avifo-textarea {
    resize: vertical;
    min-height: 100px;
}

/* Protected fields */
.avifo-input.avifo-protected,
.avifo-textarea.avifo-protected {
    background-color: var(--avifo-gray-100);
    color: var(--avifo-gray-600);
    cursor: not-allowed;
    border-color: var(--avifo-gray-300);
}

.avifo-input.avifo-protected:focus,
.avifo-textarea.avifo-protected:focus {
    border-color: var(--avifo-gray-300);
    box-shadow: none;
}

.avifo-protected-badge {
    font-size: 0.75rem;
    margin-left: 0.25rem;
    opacity: 0.7;
}

/* Radio and Checkbox Groups */
.avifo-radio-group,
.avifo-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.5rem 0;
}

.avifo-radio-label,
.avifo-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border: 2px solid var(--avifo-gray-200);
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9375rem;
    color: var(--avifo-gray-700);
}

.avifo-radio-label:hover,
.avifo-checkbox-label:hover {
    border-color: var(--avifo-primary-light);
    background: var(--avifo-gray-50);
}

.avifo-radio-label input[type="radio"],
.avifo-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
    accent-color: var(--avifo-primary);
}

.avifo-radio-label input[type="radio"]:checked,
.avifo-checkbox-label input[type="checkbox"]:checked {
    ~ * {
        font-weight: 600;
    }
}

.avifo-radio-label:has(input:checked),
.avifo-checkbox-label:has(input:checked) {
    border-color: var(--avifo-primary);
    background: #eff6ff;
    font-weight: 600;
}

.avifo-radio-label input[type="radio"]:disabled,
.avifo-checkbox-label input[type="checkbox"]:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.avifo-radio-label:has(input:disabled),
.avifo-checkbox-label:has(input:disabled) {
    background-color: var(--avifo-gray-100);
    color: var(--avifo-gray-600);
    cursor: not-allowed;
    border-color: var(--avifo-gray-300);
}

/* Form Navigation */
.avifo-form-navigation {
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    padding-top: 1.5rem;
    border-top: 1px solid var(--avifo-gray-200);
}

/* === SUCCESS MESSAGE === */
.avifo-success-screen {
    display: none;
    text-align: center;
    padding: 4rem 2rem;
}

.avifo-success-screen.active {
    display: block;
    animation: avifo-fade-in 0.3s ease;
}

.avifo-success-actions {
    display: inline-flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}

.avifo-success-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    font-size: 2.5rem;
}

.avifo-success-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--avifo-gray-900);
    margin: 0 0 0.75rem 0;
}

.avifo-success-message {
    color: var(--avifo-gray-600);
    font-size: 1.0625rem;
    margin: 0 0 2rem 0;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* === MESSAGES === */
.avifo-message {
    margin: 1.5rem;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    display: none;
}

.avifo-message.show {
    display: block;
}

.avifo-message-success {
    background: #d1fae5;
    color: #065f46;
    border-left: 4px solid var(--avifo-success);
}

.avifo-message-error {
    background: #fee2e2;
    color: #991b1b;
    border-left: 4px solid var(--avifo-error);
}

.avifo-message-warning {
    background: #fef3c7;
    color: #92400e;
    border-left: 4px solid var(--avifo-warning);
}

/* === LOADING STATES === */
.avifo-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: var(--avifo-gray-500);
    gap: 1rem;
}

.avifo-spinner {
    display: inline-block;
    width: 32px;
    height: 32px;
    border: 3px solid var(--avifo-gray-200);
    border-top-color: var(--avifo-primary);
    border-radius: 50%;
    animation: avifo-spin 0.8s linear infinite;
}

/* === ANIMATIONS === */
@keyframes avifo-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes avifo-spin {
    to { transform: rotate(360deg); }
}

/* === RESPONSIVE === */

/* Tablet portrait and below: stack to 1 column */
@media (max-width: 1024px) {
    .avifo-planner-grid {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .avifo-planner-col {
        padding: 1.25rem;
        border-right: none !important;
        border-bottom: 1px solid var(--avifo-gray-200);
    }

    .avifo-planner-col:last-child {
        border-bottom: none;
    }

    /* Calendar full width */
    .avifo-calendar-wrapper { max-width: 100%; }

    /* Footer stacked */
    .avifo-planner-footer { flex-direction: column; gap: 1rem; text-align: center; }
    .avifo-selected-summary { flex-wrap: wrap; justify-content: center; }
    .avifo-btn { width: 100%; justify-content: center; }
}

/* Tablet */
@media (max-width: 900px) {
    .avifo-planner-grid {
        grid-template-columns: 180px 1fr 200px;
    }

    .avifo-booking-summary-card {
        min-width: 220px;
    }
}

/* Mobile landscape / small tablet */
@media (max-width: 768px) {
    .avifo-booking-wrapper {
        padding: 0 0.5rem;
        margin: 1rem auto;
    }

    .avifo-planner-grid {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .avifo-planner-col {
        padding: 1.25rem;
        border-right: none !important;
        border-bottom: 1px solid var(--avifo-gray-200);
    }

    .avifo-planner-col:last-child {
        border-bottom: none;
    }

    /* Duration vertically stacked like tablet */
    .avifo-duration-list {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }
    .avifo-duration-option { width: 100%; }

    /* Calendar full width */
    .avifo-calendar-wrapper {
        max-width: 100%;
    }

    /* Times stacked like tablet */
    .avifo-times-list {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        max-height: none;
        overflow-y: visible;
    }

    /* Footer stack */
    .avifo-planner-footer {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .avifo-selected-summary {
        flex-wrap: wrap;
        justify-content: center;
    }

    .avifo-btn {
        width: 100%;
        justify-content: center;
    }

    /* Form */
    .avifo-form-header {
        flex-direction: column;
        gap: 1.5rem;
    }

    .avifo-booking-summary-card {
        min-width: 100%;
    }

    .avifo-fields-grid {
        grid-template-columns: 1fr;
    }

    .avifo-field-full {
        grid-column: 1;
    }

    .avifo-form-navigation {
        flex-direction: column;
    }
}

/* Mobile portrait */
@media (max-width: 480px) {
    .avifo-booking-title {
        font-size: 1.25rem;
        padding: 1rem;
    }

    .avifo-planner-col {
        padding: 1rem;
    }

    .avifo-duration-option {
        min-width: 80px;
        padding: 0.625rem;
    }

    .avifo-duration-label {
        font-size: 0.875rem;
    }

    /* Keep times stacked on mobile portrait */
    .avifo-times-list {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    .avifo-step-form {
        padding: 1.5rem;
    }
}
