/* DCCW Calendar Events Select Styles */
.dccw-events-select-container {
    position: relative;
    margin-bottom: 15px;
}

.dccw-events-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.4;
    background-color: #fff;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.dccw-events-select:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.2);
}

/* Loading state with spinning icon - FIXED */
.dccw-events-select.dccw-loading {
    padding-right: 40px; /* Make room for the icon */
    color: #666;
    background-color: #f9f9f9;
}

/* Loading spinner as pseudo-element */
.dccw-events-select.dccw-loading::after {
    content: "";
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid #ddd;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: dccw-spin 1s linear infinite;
    pointer-events: none;
}

/* Alternative loading icon using SVG background (if pseudo-element doesn't work) */
.dccw-events-select.dccw-loading-alt {
    padding-right: 40px;
    color: #666;
    background-color: #f9f9f9;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23007cba' stroke-width='2'%3E%3Cpath d='M21 12a9 9 0 11-6.219-8.56'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px 16px;
}

/* Only animate the background image, not the entire element */
.dccw-events-select.dccw-loading-alt {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23007cba' stroke-width='2'%3E%3Cpath d='M21 12a9 9 0 11-6.219-8.56'/%3E%3C/svg%3E");
}

/* Keyframe animation for spinner */
@keyframes dccw-spin {
    from { transform: translateY(-50%) rotate(0deg); }
    to { transform: translateY(-50%) rotate(360deg); }
}

.dccw-events-select.dccw-error {
    border-color: #dc3232;
    background-color: #ffeaea;
}

/* Container needs relative positioning for absolute pseudo-element */
.dccw-events-select-container {
    position: relative;
    margin-bottom: 15px;
}

/* Events List Styles */
.dccw-events-list {
    margin: 20px 0;
}

.dccw-event-item {
    padding: 15px;
    margin-bottom: 15px;
    border: 1px solid #e1e1e1;
    border-radius: 6px;
    background: #fff;
    transition: box-shadow 0.3s ease;
}

.dccw-event-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.dccw-event-datetime {
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
    font-weight: 500;
}

.dccw-event-date {
    margin-right: 10px;
}

.dccw-event-time {
    color: #007cba;
}

.dccw-event-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

.dccw-event-location {
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
}

.dccw-event-location::before {
    content: "📍 ";
    margin-right: 4px;
}

.dccw-event-description {
    font-size: 14px;
    color: #555;
    line-height: 1.5;
}

/* Template Variations */
.dccw-template-minimal .dccw-event-item {
    padding: 10px;
    border: none;
    border-left: 3px solid #007cba;
    background: #f9f9f9;
}

.dccw-template-minimal .dccw-event-title {
    font-size: 14px;
    margin-bottom: 4px;
}

.dccw-template-detailed .dccw-event-item {
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.dccw-template-detailed .dccw-event-title {
    font-size: 18px;
    margin-bottom: 12px;
}

/* Error and Empty States */
.dccw-no-events,
.dccw-error {
    padding: 15px;
    text-align: center;
    color: #666;
    font-style: italic;
    border: 1px dashed #ddd;
    border-radius: 4px;
    background: #f9f9f9;
}

.dccw-error {
    color: #dc3232;
    background: #ffeaea;
    border-color: #dc3232;
}

/* Responsive Design */
@media (max-width: 768px) {
    .dccw-events-select {
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .dccw-event-item {
        padding: 12px;
    }
    
    .dccw-event-title {
        font-size: 15px;
    }
}

/* Elementor Form Integration */
.elementor-field-type-select .dccw-events-select {
    height: auto;
    min-height: 40px;
}

.elementor-field-group .dccw-events-select-container {
    margin-bottom: 0;
}

/* Hidden fields for Elementor */
.dccw-event-title,
.dccw-event-date,
.dccw-event-time,
.dccw-event-location {
    display: none !important;
}

/* Loading indicator - Alternative approach using a separate element */
.dccw-loading-spinner {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid #ddd;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: dccw-simple-spin 1s linear infinite;
    pointer-events: none;
    display: none;
}

.dccw-events-select-container.loading .dccw-loading-spinner {
    display: block;
}

.dccw-events-select-container.loading .dccw-events-select {
    padding-right: 40px;
    color: #666;
    background-color: #f9f9f9;
}

@keyframes dccw-simple-spin {
    from { transform: translateY(-50%) rotate(0deg); }
    to { transform: translateY(-50%) rotate(360deg); }
}

/* Error states */
.dccw-events-select-container.error .dccw-events-select {
    border-color: #dc3232;
    background-color: #ffeaea;
}

.dccw-events-select-container.error-permanent .dccw-events-select {
    border-color: #dc3232;
    background-color: #ffebee;
}

.dccw-events-select-container.loading .dccw-events-select {
    opacity: 0.7;
    pointer-events: none;
}

.dccw-retry-option {
    color: #0073aa !important;
    font-style: italic;
}

.dccw-rate-limit-warning {
    color: #d63638;
    font-size: 12px;
    margin-top: 5px;
}