/**
 * Schedule AJAX Styles
 * Loader, empty state, animations
 */

/* ===================================
   Schedule Form - Reduced Gap Override
   =================================== */

/* Force 0.5rem gap on schedule form (high specificity) */
#schedule-filters-form .fields--flex,
#schedule-filters-form.search-form .fields--flex,
form#schedule-filters-form .fields--flex,
form#schedule-filters-form .dropdowns-selectors .fields--flex,
body #schedule-filters-form .fields--flex {
    gap: 0.5rem !important;
    column-gap: 0.5rem !important;
}

/* Fix Select2 fixed widths - make them flex */
#schedule-filters-form .fields--flex .field {
    flex: 1 1 0 !important;
    min-width: 0 !important;
}

#schedule-filters-form .fields--flex .field .select2-container {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
}

#schedule-filters-form .fields--flex .field select,
#schedule-filters-form .fields--flex .field input[type="text"],
#schedule-filters-form .fields--flex .field input[type="submit"],
#schedule-filters-form .fields--flex .field .daterange-input {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
}

/* Submit button styling */
#schedule-filters-form .fields--flex .field--submit {
    flex: 1 1 0 !important;
    min-width: 0 !important;
}

#schedule-filters-form .fields--flex .field--submit input[type="submit"] {
    width: 100% !important;
    box-sizing: border-box !important;
}

/* ===================================
   Container & Loading States
   =================================== */

#schedule-results-container {
    position: relative;
    min-height: 400px;
    transition: opacity 0.3s ease-in-out;
}

#schedule-results-container.is-loading .list--schedule {
    pointer-events: none;
}

/* ===================================
   Loader Overlay
   =================================== */

.schedule-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    animation: fadeIn 0.3s ease-in-out;
}

.loader-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #16B969;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loader-text {
    margin-top: 20px;
    font-size: 16px;
    color: #666;
    font-weight: 500;
}

/* ===================================
   Skeleton Loader
   =================================== */

.item.skeleton-card {
    background: #f7f9fa;
    border: 1px solid #e3e9ed;
    border-radius: 4px;
    padding: 20px;
    min-height: 200px;
    animation: fadeIn 0.3s ease-in-out;
    position: relative;
    overflow: hidden;
}

.skeleton-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.6), 
        transparent
    );
    animation: skeleton-shimmer 1.8s ease-in-out infinite;
}

.skeleton-line {
    height: 14px;
    background: #e3e9ed;
    border-radius: 4px;
    margin-bottom: 10px;
}

.skeleton-line.short {
    width: 40%;
}

.skeleton-line.medium {
    width: 70%;
}

.skeleton-line.tall {
    height: 22px;
    margin-bottom: 15px;
    background: #dae2e6;
}

.skeleton-button {
    height: 42px;
    background: #dae2e6;
    border-radius: 4px;
    margin-top: 20px;
}

@keyframes skeleton-shimmer {
    0% {
        left: -100%;
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        left: 100%;
        opacity: 0;
    }
}

/* ===================================
   Empty State
   =================================== */

.schedule-empty-state {
    text-align: center;
    padding: 40px 20px;
    max-width: 600px;
    margin: 0 auto;
    animation: fadeIn 0.4s ease-in-out;
}

.empty-state-icon {
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.empty-state-icon img {
    max-width: 200px;
    height: auto;
    display: block;
}

.empty-state-title {
    font-size: 32px;
    font-weight: 700;
    color: #333;
    margin-bottom: 12px;
}

.empty-state-message {
    font-size: 18px;
    color: #666;
    margin-bottom: 20px;
    line-height: 1.6;
}

.empty-state-suggestions {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    text-align: left;
}

.empty-state-suggestions p {
    margin-bottom: 10px;
    font-weight: 600;
    color: #333;
}

.empty-state-suggestions-title {
    text-align: left;
    margin-bottom: 12px;
}

.empty-state-suggestions ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.empty-state-suggestions li {
    padding: 8px 0;
    padding-left: 25px;
    position: relative;
    color: #666;
}

.empty-state-suggestions li:before {
    content: "→";
    position: absolute;
    left: 0;
    color: #16B969;
    font-weight: bold;
}

.empty-state-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.empty-state-actions .button {
    /* Use existing button styles from components.css */
    /* No custom transitions - use default from components.css */
}

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

.schedule-error {
    text-align: center;
    padding: 60px 20px;
    animation: fadeIn 0.4s ease-in-out;
}

.error-icon {
    font-size: 60px;
    margin-bottom: 20px;
}

.schedule-error h3 {
    font-size: 28px;
    color: #d32f2f;
    margin-bottom: 15px;
}

.schedule-error p {
    font-size: 16px;
    color: #666;
    margin-bottom: 25px;
}

.schedule-error .button {
    background: #d32f2f;
    color: white;
    padding: 12px 30px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s ease;
}

.schedule-error .button:hover {
    background: #b71c1c;
}

/* ===================================
   Submit Button Loading State
   =================================== */

#schedule-search-submit.is-loading {
    cursor: wait !important;
    pointer-events: none;
    position: relative;
    padding-right: 45px !important;
    background: linear-gradient(90deg, #16B969 0%, #129954 50%, #16B969 100%);
    background-size: 200% 100%;
    animation: button-shimmer 1.5s infinite;
}

#schedule-search-submit.is-loading:after {
    content: '';
    position: absolute;
    right: 12px;
    top: 50%;
    margin-top: -9px;
    width: 18px;
    height: 18px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes button-shimmer {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* For buttons with different background colors */
.button.is-loading:after,
button.is-loading:after {
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
}

/* ===================================
   Disabled Form Inputs During Loading
   =================================== */

select.is-disabled,
input[type="text"].is-disabled,
input[type="checkbox"].is-disabled {
    opacity: 0.6;
    cursor: not-allowed !important;
    pointer-events: none;
}

/* ===================================
   Animations
   =================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

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

@media (max-width: 768px) {
    .empty-state-title {
        font-size: 24px;
    }
    
    .empty-state-message {
        font-size: 16px;
    }
    
    .empty-state-actions {
        flex-direction: column;
    }
    
    .empty-state-actions .button {
        width: 100%;
    }
    
    .loader-spinner {
        width: 40px;
        height: 40px;
    }
    
    .loader-text {
        font-size: 14px;
    }
    
    .item.skeleton-card {
        min-height: 180px;
        padding: 15px;
    }
    
    .skeleton-line {
        height: 12px;
        margin-bottom: 8px;
    }
    
    .skeleton-button {
        height: 38px;
    }
}

/* ===================================
   Pagination Styling
   =================================== */

.wp-pagenavi {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin: 2rem 0;
    padding: 1rem 0;
}

.wp-pagenavi .pages {
    margin-right: 1rem;
    color: #666;
    font-size: 0.9rem;
}

.wp-pagenavi a,
.wp-pagenavi .current {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0.5rem;
    text-decoration: none;
    color: #333;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.wp-pagenavi a:hover {
    background: #f8f9fa;
    border-color: #16B969;
    color: #16B969;
}

.wp-pagenavi .current {
    background: #16B969;
    color: white;
    border-color: #16B969;
    font-weight: 600;
}

.wp-pagenavi .page-icons {
    min-width: auto;
    padding: 0.5rem 0.75rem;
}

.wp-pagenavi .page-icons svg path {
    transition: stroke 0.2s ease;
}

.wp-pagenavi .page-icons:hover svg path {
    stroke: #16B969;
}
