/**
 * Cal.com Embed Styles
 *
 * Styles for inline Cal.com calendar embeds in Smartsheet User Lookup plugin.
 * Designed to match existing plugin styles and provide responsive layout.
 *
 * @package Smartsheet_User_Lookup
 * @since 12.4.0
 */

/* ==========================================================================
   Container Styles
   ========================================================================== */

.calcom-embed-container {
    width: 100%;
    max-width: 100%;
    margin: 20px auto;
    padding: 0;
    position: relative;
    border-radius: 8px;
    overflow: hidden;
/*  background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); */
}

/* Remove shadow for embedded calendars if desired */
.calcom-embed-container.no-shadow {
    box-shadow: none;
}

/* Responsive sizing */
@media (max-width: 768px) {
    .calcom-embed-container {
        margin: 15px 0;
        border-radius: 4px;
    }
}

/* ==========================================================================
   Loading State
   ========================================================================== */

.calcom-loading {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 600px;
    padding: 40px 20px;
    background: #fafafa;
}

.calcom-spinner {
    text-align: center;
}

.calcom-spinner p {
    margin: 20px 0 0;
    color: #666;
    font-size: 16px;
    font-weight: 500;
}

/* Animated spinner */
.calcom-spinner::before {
    content: '';
    display: block;
    width: 40px;
    height: 40px;
    margin: 0 auto;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: calcom-spin 1s linear infinite;
}

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

/* ==========================================================================
   Error State
   ========================================================================== */

.calcom-error-message {
    padding: 40px 20px;
    text-align: center;
    color: #e74c3c;
    background: #fff5f5;
    border: 2px solid #e74c3c;
    border-radius: 8px;
    margin: 20px;
}

.calcom-error-message strong {
    display: block;
    font-size: 18px;
    margin-bottom: 10px;
}

.calcom-error-message p {
    margin: 10px 0 0;
    color: #555;
    font-size: 14px;
}

.calcom-error {
    padding: 20px;
    background: #fff5f5;
    border: 2px solid #e74c3c;
    border-radius: 8px;
    margin: 20px 0;
}

/* ==========================================================================
   Cal.com Embed Overrides
   ========================================================================== */

/* Ensure the Cal.com iframe is responsive */
.calcom-embed-container iframe {
    width: 100% !important;
    min-height: 600px;
    border: none;
    display: block;
}

/* Remove any default margins/padding from Cal.com elements */
.calcom-embed-container [class*='cal-'] {
    box-sizing: border-box;
}

/* ==========================================================================
   Theme Customization
   ========================================================================== */

/* Light theme adjustments */
.calcom-embed-container[data-theme='light'] {
    background: #ffffff;
}

/* Dark theme adjustments */
.calcom-embed-container[data-theme='dark'] {
    background: #1a1a1a;
    color: #ffffff;
}

.calcom-embed-container[data-theme='dark'] .calcom-loading {
    background: #2a2a2a;
}

.calcom-embed-container[data-theme='dark'] .calcom-spinner p {
    color: #cccccc;
}

/* ==========================================================================
   Section Integration Styles
   ========================================================================== */

/* When embedded in user lookup sections */
#step1 .calcom-embed-container,
#virtual .calcom-embed-container,
#digitalUpload .calcom-embed-container,
#preApproved .calcom-embed-container,
#complete .calcom-embed-container {
    margin-top: 30px;
    margin-bottom: 30px;
}

/* Header for Cal.com section */
.calcom-section-header {
    text-align: center;
    margin-bottom: 20px;
    padding: 20px;
}

.calcom-section-header h2 {
    margin: 0 0 10px;
    font-size: 24px;
    color: #333;
}

.calcom-section-header p {
    margin: 0;
    font-size: 16px;
    color: #666;
}

/* Dark theme header */
.calcom-embed-container[data-theme='dark'] .calcom-section-header h2 {
    color: #ffffff;
}

.calcom-embed-container[data-theme='dark'] .calcom-section-header p {
    color: #cccccc;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

/* Tablets */
@media (max-width: 1024px) {
    .calcom-embed-container iframe {
        min-height: 550px;
    }

    .calcom-section-header h2 {
        font-size: 22px;
    }

    .calcom-section-header p {
        font-size: 15px;
    }
}

/* Mobile phones */
@media (max-width: 768px) {
    .calcom-embed-container {
        border-radius: 0;
        margin-left: -15px;
        margin-right: -15px;
        width: calc(100% + 30px);
    }

    .calcom-embed-container iframe {
        min-height: 500px;
    }

    .calcom-loading {
        min-height: 400px;
        padding: 30px 15px;
    }

    .calcom-section-header {
        padding: 15px;
    }

    .calcom-section-header h2 {
        font-size: 20px;
    }

    .calcom-section-header p {
        font-size: 14px;
    }

    .calcom-spinner::before {
        width: 32px;
        height: 32px;
    }

    .calcom-spinner p {
        font-size: 14px;
    }
}

/* Small mobile phones */
@media (max-width: 480px) {
    .calcom-embed-container iframe {
        min-height: 450px;
    }

    .calcom-loading {
        min-height: 350px;
    }
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

/* Focus states for keyboard navigation */
.calcom-embed-container:focus-within {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .calcom-embed-container {
        border: 2px solid currentColor;
    }

    .calcom-loading {
        border: 1px solid currentColor;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .calcom-spinner::before {
        animation: none;
        border: 4px solid #3498db;
    }

    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .calcom-embed-container {
        display: none;
    }
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */

/* Hide embed container */
.calcom-embed-container.hidden {
    display: none !important;
}

/* Full width variant */
.calcom-embed-container.full-width {
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
}

/* Compact variant (smaller height) */
.calcom-embed-container.compact iframe {
    min-height: 400px;
}

/* Bordered variant */
.calcom-embed-container.bordered {
    border: 2px solid #e0e0e0;
}

/* Centered variant */
.calcom-embed-container.centered {
    display: block;
    margin-left: auto;
    margin-right: auto;
}
