/* Enhanced Feedback Popup Styles */
.feedback-popup {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 320px;
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
    z-index: 1035; /* Below navbar (1050), dropdowns (1000+), and modals (1055) */
    max-width: calc(100% - 48px);
    overflow: hidden;
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(228, 229, 230, 0.8);
}

.feedback-popup.show {
    opacity: 1;
    transform: translateY(0);
}

/* Ensure feedback popup doesn't block main page interactions when hidden */
.feedback-popup:not(.show) {
    pointer-events: none;
}

.feedback-popup.show {
    pointer-events: auto;
}

.feedback-popup-content {
    padding: 0;
}

.feedback-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #387a29;
    color: white;
    padding: 10px 14px;
}

.feedback-popup-header h5 {
    margin: 0;
    font-weight: 600;
    font-size: 1rem;
}

.feedback-popup-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0;
    opacity: 0.8;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
}

.feedback-popup-close:hover {
    opacity: 1;
    background-color: rgba(255, 255, 255, 0.1);
}

.feedback-popup-body {
    padding: 14px;
}

.feedback-popup-body p {
    font-size: 0.9rem;
    margin-bottom: 12px;
    color: #555;
}

.btn-feedback {
    background-color: #387a29;
    color: white;
    font-weight: 600;
    transition: background-color 0.2s;
}

.btn-feedback:hover, 
.btn-feedback:focus {
    background-color: #2d6321;
    color: white;
}

.btn-no-thanks {
    font-weight: 600;
    transition: all 0.2s;
    color: #777;
    border-color: #ddd;
}

.btn-no-thanks:hover,
.btn-no-thanks:focus {
    background-color: #f8f9fa;
    color: #555;
}

#feedback-message {
    resize: none;
    border-color: #dee2e6;
    font-size: 0.9rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    background-color: rgba(255, 255, 255, 0.8);
    height: 70px;
}

#feedback-message:focus {
    border-color: #387a29;
    box-shadow: 0 0 0 0.25rem rgba(56, 122, 41, 0.25);
    background-color: rgba(255, 255, 255, 0.95);
}

.feedback-note-container {
    position: relative; /* Anchor for absolute children */
    min-height: 2.5em; /* Set height based on expected content */
    margin-top: 8px;
}

.feedback-note {
    font-size: 0.75rem;
    text-align: center;
    margin: 0;
    padding: 0 5px; /* Add slight padding if needed */
    /* Styles for absolute positioning */
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    transition: opacity 0.3s ease-in-out;
    opacity: 1; /* Default is visible */
}

#privacy-message-default {
    color: #6c757d;
    opacity: 1;
}

#privacy-message-warning {
    color: #cc8800;
    font-weight: 500;
    opacity: 0; /* Start hidden */
}

/* Star Rating */
.star-rating {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.star-rating-label {
    font-size: 0.9rem;
    margin-right: 8px;
    color: #555;
}

.rating {
    display: flex;
    flex-direction: row-reverse; /* Reverse the order of the stars visually */
    gap: 3px;
}

.rating input {
    display: none;
}

.rating label {
    font-size: 1.5rem;
    color: #ccc;
    cursor: pointer;
    transition: color 0.2s;
}

/* When a star is checked or hovered, also highlight all previous stars */
.rating input:checked ~ label,
.rating label:hover,
.rating label:hover ~ label,
.rating input:not(:checked) ~ label:hover,
.rating input:not(:checked) ~ label:hover ~ label {
    color: #FFD700;
}

/* Default Checkbox Styling (Desktop) */
.form-switch-like .checkbox-element {
    min-width: 1em; /* Reset potentially inherited width */
    width: 1em;
    height: 1em;
    margin-top: 0.25em;
    margin-right: 0.5em;
    vertical-align: top;
    appearance: checkbox;
    -webkit-appearance: checkbox;
    -moz-appearance: checkbox;
    border: 1px solid #adb5bd;
    border-radius: 0.25em;
    background-color: #fff;
    transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out;
}

.form-switch-like .checkbox-element:checked {
    background-color: #387a29;
    border-color: #387a29;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e"); /* Simple dot for desktop */
    background-repeat: no-repeat;
    background-position: center center;
    background-size: 50% 50%;
}

.form-switch-like .form-check-label {
    cursor: pointer;
}

/* Mobile Toggle Switch Styling - Aggressive Reset & Re-apply */
@media (max-width: 576px) {
    .form-switch-like {
        padding-left: 0; 
        display: flex;
        align-items: center;
        min-height: 24px; 
        gap: 0.75em; 
    }

    .form-switch-like .form-check-label {
        order: 1; 
        flex-grow: 1; 
        flex-shrink: 1; 
        margin: 0; 
        font-size: 0.8rem; /* Match other labels if needed */
        line-height: 1.3;
    }
    
    /* --- Start Mobile Toggle Reset & Styles --- */
    .form-switch-like .checkbox-element {
        order: 2; /* Switch comes after label */
        /* Reset properties */
        all: unset; /* Drastic reset - start fresh */
        display: inline-block; /* Needed after 'all: unset' */
        box-sizing: content-box; /* Ensure padding/border are outside width/height */
        
        /* Apply specific dimensions */
        width: 40px; 
        height: 20px; 
        min-width: 40px;
        
        /* Track styling */
        background-color: #ccc; 
        border-radius: 999px; 
        position: relative;
        transition: background-color 0.3s;
        cursor: pointer;
        flex-shrink: 0;
        align-self: center; 
    }
    
    /* Handle styling */
    .form-switch-like .checkbox-element::before {
        /* Reset inherited properties if any */
        all: unset;
        box-sizing: content-box;
        display: block; /* Needed after 'all: unset' */
        
        /* Apply handle styles */
        content: '';
        position: absolute;
        width: 18px;  
        height: 18px; 
        border-radius: 50%;
        background-color: white;
        top: 1px;
        left: 1px;
        transition: transform 0.3s ease;
    }

    /* Checked state: Track */
    .form-switch-like .checkbox-element:checked {
        background-color: #387a29; 
        border-color: transparent; /* Ensure no border interference */
        background-image: none !important; /* Remove default checkmark image */
    }

    /* Checked state: Handle */
    .form-switch-like .checkbox-element:checked::before {
        transform: translateX(20px); 
    }
    /* --- End Mobile Toggle Reset & Styles --- */
}

/* Share Permission Checkbox styling adjustments */
.feedback-permission,
.opt-out-option {
    display: flex;
    align-items: flex-start;
    margin-top: 12px;
}

.feedback-permission label,
.opt-out-option label {
    font-size: 0.8rem;
    color: #555;
    line-height: 1.3;
    flex: 1;
}

.opt-out-option {
    opacity: 0.85;
    margin-top: 8px;
}

/* Success message styling */
#feedback-success {
    animation: fadeIn 0.5s ease-in-out;
}

#feedback-success .custom-green {
    color: #387a29;
}

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

/* Responsive styles */
@media (max-width: 576px) {
    .feedback-popup {
        bottom: 16px;
        left: 16px;
        right: 16px;
        width: auto;
        max-width: none;
    }
    
    .feedback-popup-body {
        padding: 10px;
    }
    
    .feedback-popup-header {
        padding: 8px 10px;
    }
}