/* Main Styles for Sum to JetForm Plugin */
:root {
    --stj-primary: #2271b1;
    --stj-primary-hover: #135e96;
    --stj-border: #dcdcde;
    --stj-background: #f6f7f7;
    --stj-text: #3c434a;
    --stj-light-bg: #f0f0f1;
}

/* Common styles */
.stj-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    color: var(--stj-text);
}

/* Date Filter Styles */
.stj-date-filter {
    max-width: 600px;
    margin: 20px auto;
    padding: 20px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.stj-date-inputs {
    display: flex;
    gap: 15px;
    align-items: flex-end; /* Better alignment */
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.stj-date-input {
    flex: 1 0 200px; /* Minimum width of 200px */
    position: relative; /* Added for positioning the loading indicator */
}

.stj-date-input label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.stj-datepicker {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    display: block !important;
    box-sizing: border-box;
}

/* Loading state styles */
.stj-datepicker.stj-loading {
    background-color: #f7f7f7;
    cursor: not-allowed;
}

.stj-loading-indicator {
    position: absolute;
    right: 10px;
    top: 50%; 
    transform: translateY(-50%);
    animation: stj-spin 1s linear infinite;
    color: var(--stj-primary);
}

@keyframes stj-spin {
    0% { transform: translateY(-50%) rotate(0deg); }
    100% { transform: translateY(-50%) rotate(360deg); }
}

.stj-date-actions {
    flex: 0 0 auto; /* Don't grow, don't shrink */
    margin-bottom: 5px;
}

.stj-reset-dates {
    background-color: #dc3232;
    color: white;
    border-color: #b32d2e;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    height: 36px; /* Match input height */
    border-style: solid;
    border-width: 1px;
    transition: background-color 0.3s ease;
}

.stj-reset-dates:hover {
    background-color: #cc2929;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .stj-date-input {
        min-width: 100%;
    }
    
    .stj-date-actions {
        width: 100%;
        margin-top: 10px;
    }
    
    .stj-reset-dates {
        width: 100%;
    }
}



/* Admin Interface Styles */
#smp-repeaters {
    margin: 20px 0;
    max-width: 1200px;
}

.smp-repeater-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
    padding: 20px;
    background: var(--stj-light-bg);
    border-radius: 6px;
    border: 1px solid var(--stj-border);
    transition: all 0.2s ease;
}

.smp-repeater-row:hover {
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
}

.smp-input-group {
    display: flex;
    flex-direction: column;
}

.smp-input-group label {
    margin-bottom: 5px;
    font-weight: 500;
    font-size: 13px;
}

.smp-input-group input[type="text"] {
    padding: 8px 12px;
    border: 1px solid var(--stj-border);
    border-radius: 4px;
    font-size: 14px;
}

.smp-actions {
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
}

.smp-remove {
    background-color: #dc3232 !important;
    color: white !important;
    border-color: #b32d2e !important;
}

.smp-remove:hover {
    background-color: #cc2929 !important;
}

button#smp-add-mapping {
    background-color: var(--stj-primary);
    color: white;
    border-color: var(--stj-primary);
    padding: 8px 15px;
    margin-bottom: 20px;
}

button#smp-add-mapping:hover {
    background-color: var(--stj-primary-hover);
}

/* JetForm field highlight for debugging */
.jet-form-builder__field.has-stj-value {
    border-left: 3px solid var(--stj-primary);
    background-color: rgba(34, 113, 177, 0.05);
}