/* Calendly-like Layout */

#appointly-modal-container * {
    box-sizing: border-box;
}

#appointly-modal-container {
    display: flex;
    flex-direction: row;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 8px rgba(0,0,0,0.08), 0 8px 24px rgba(0,0,0,0.1);
    max-width: 1060px;
    margin: 40px auto;
    min-height: 600px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #1a1a1a;
    overflow: hidden;
    line-height: 1.5; /* Ensure consistent line height */
}

/* Sidebar (Left) */
.appointly-sidebar {
    width: 35%;
    border-right: 1px solid #e0e0e0;
    padding: 32px;
    background: #fff;
    display: flex;
    flex-direction: column;
}

.appointly-sidebar-content {
    position: sticky;
    top: 32px;
}

.sidebar-label {
    text-transform: uppercase;
    font-size: 11px;
    font-weight: 700;
    color: #737373;
    margin-bottom: 8px;
    margin-top: 24px;
}

#sidebar-service-name {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 8px 0;
    line-height: 1.2;
}

.sidebar-meta {
    display: flex;
    gap: 16px;
    color: #737373;
    font-size: 14px;
    margin-bottom: 16px;
    font-weight: 600;
}

#sidebar-service-desc {
    font-size: 14px;
    line-height: 1.5;
    color: #4d4d4d;
}

.sidebar-provider-card {
    display: flex;
    align-items: center;
    gap: 10px;
}

#sidebar-provider-img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    background: #eee;
}

#sidebar-provider-name {
    font-weight: 600;
    font-size: 14px;
}

.sidebar-date-display {
    font-size: 16px;
    color: var(--appointly-primary);
    font-weight: 600;
}

/* Main Content (Right) */
.appointly-main {
    width: 65%;
    padding: 32px;
    position: relative;
    background: #fff;
}

.appointly-view {
    display: none;
    animation: fadeIn 0.3s ease;
}

.appointly-view.active {
    display: block;
}

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

.appointly-main h2 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 24px;
    margin-top: 0;
}

/* Back Button */
#appointly-back-btn {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 40px;
    width: auto; /* Allow width to fit text */
    padding: 8px 20px; /* Add padding */
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--appointly-primary);
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 20px;
    transition: all 0.2s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05); /* Subtle shadow for visibility */
}

#appointly-back-btn:hover {
    background: var(--appointly-primary-light);
    border-color: var(--appointly-primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* Lists (Services/Providers) */
.appointly-list-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 400px; /* Limit to approx 4 items */
    overflow-y: auto;
    padding-right: 4px;
}

.appointly-list-item {
    padding: 24px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.appointly-list-item:hover {
    border-color: var(--appointly-primary);
    background-color: rgba(0, 105, 255, 0.03);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.item-title {
    font-weight: 600;
    font-size: 16px;
}

.item-meta {
    font-size: 14px;
    color: #737373;
}

/* Calendar Layout */
.appointly-calendar-layout {
    display: flex;
    gap: 32px;
}

.calendar-column {
    flex: 1;
}

.slots-column {
    flex: 0 0 180px;
    border-left: 1px solid #e0e0e0;
    padding-left: 24px;
    max-height: 400px;
    overflow-y: auto;
}

.slots-column h3 {
    font-size: 16px;
    margin-top: 0;
    margin-bottom: 16px;
}

/* Flatpickr Customization */
.flatpickr-calendar {
    box-shadow: none !important;
    margin: 0 auto;
}

.flatpickr-day.selected {
    background: var(--appointly-primary) !important;
    border-color: var(--appointly-primary) !important;
}

/* Slots */
.appointly-slots-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.slot-btn {
    background: #fff;
    border: 1px solid var(--appointly-primary);
    color: var(--appointly-primary);
    padding: 12px;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.slot-btn:hover {
    background: var(--appointly-primary);
    color: #fff;
}

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

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 6px;
}

.form-group input, .form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    box-sizing: border-box;
}

.form-group input:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--appointly-primary);
    box-shadow: 0 0 0 2px var(--appointly-primary-light);
}

.row {
    display: flex;
    gap: 16px;
}

.row input {
    width: 50%;
}

.appointly-btn-primary {
    background: var(--appointly-primary);
    color: #fff;
    border: none;
    padding: 14px 24px;
    border-radius: 40px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 16px;
}

.appointly-btn-outline {
    background: transparent;
    border: 1px solid #ccc;
    padding: 10px 20px;
    border-radius: 40px;
    cursor: pointer;
    margin-top: 20px;
}

/* Success */
.success-content {
    text-align: center;
    padding-top: 40px;
}

.success-icon {
    width: 60px;
    height: 60px;
    background: #4caf50;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    margin: 0 auto 20px;
}

/* Loader */
#appointly-loader-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--appointly-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    #appointly-modal-container {
        flex-direction: column;
        margin: 0;
        border-radius: 0;
        box-shadow: none;
    }
    
    .appointly-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
        padding: 20px;
        box-sizing: border-box;
    }

    .appointly-sidebar-content {
        position: static;
    }

    .appointly-main {
        width: 100%;
        padding: 20px;
        box-sizing: border-box;
    }

    .appointly-calendar-layout {
        flex-direction: column;
    }

    .slots-column {
        border-left: none;
        border-top: 1px solid #e0e0e0;
        padding-left: 0;
        padding-top: 20px;
        max-height: none;
    }
}

/* Responsive: Stack Layout on Narrow Screens */
@media (max-width: 800px) {
    #appointly-modal-container {
        flex-direction: column;
        margin: 20px auto;
        min-height: auto;
    }
    
    .appointly-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
        padding: 24px;
    }

    .appointly-sidebar-content {
        position: static;
    }

    .appointly-main {
        width: 100%;
        padding: 24px;
    }
    
    .appointly-calendar-layout {
        flex-direction: column;
    }
    
    .slots-column {
        border-left: none;
        padding-left: 0;
        border-top: 1px solid #e0e0e0;
        padding-top: 24px;
        flex: auto;
    }

    .appointly-slots-list {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 10px;
    }
}
