/**
 * Feedback Widget Styles
 * Floating bottom-right widget for contextual feedback collection
 */

/* Main Widget Container */
.feedback-widget {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 9999;
    font-family: inherit;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Collapsed Trigger State */
.feedback-trigger {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    padding: 1rem 1.25rem;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    border: none;
    font-size: 0.875rem;
    font-weight: 500;
    user-select: none;
}

.feedback-trigger:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2), 0 3px 6px rgba(0, 0, 0, 0.15);
    background: hsl(var(--primary) / 0.9);
}

.feedback-trigger:active {
    transform: translateY(0) scale(0.98);
}

.feedback-icon {
    font-size: 1.125rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { 
        opacity: 1; 
        transform: scale(1);
    }
    50% { 
        opacity: 0.8; 
        transform: scale(1.05);
    }
}

.feedback-label {
    font-weight: 500;
    white-space: nowrap;
}

/* Expanded Panel State */
.feedback-panel {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 400px;
    max-width: calc(100vw - 4rem);
    background: hsl(var(--background));
    border: 1px solid hsl(var(--border));
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    opacity: 0;
    visibility: hidden;
    transform: translateY(1rem) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.feedback-widget.expanded .feedback-trigger {
    opacity: 0;
    visibility: hidden;
    transform: scale(0.8);
}

.feedback-widget.expanded .feedback-panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Panel Header */
.feedback-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem;
    border-bottom: 1px solid hsl(var(--border));
    background: hsl(var(--muted) / 0.3);
    border-radius: 12px 12px 0 0;
}

.feedback-title {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: hsl(var(--foreground));
}

.feedback-close {
    background: none;
    border: none;
    color: hsl(var(--muted-foreground));
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
}

.feedback-close:hover {
    background: hsl(var(--muted));
    color: hsl(var(--foreground));
}

/* Panel Content */
.feedback-content {
    padding: 1.25rem;
    overflow-y: auto;
    flex: 1;
}

/* Context Display */
.feedback-context {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: hsl(var(--muted) / 0.3);
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
    border: 1px solid hsl(var(--border));
}

.feedback-context i {
    color: hsl(var(--primary));
}

/* Form Styles */
.feedback-form .form-group {
    margin-bottom: 1.5rem;
}

.feedback-form label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: hsl(var(--foreground));
    font-size: 0.875rem;
}

.feedback-form input,
.feedback-form select,
.feedback-form textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid hsl(var(--border));
    border-radius: 6px;
    background: hsl(var(--background));
    color: hsl(var(--foreground));
    font-size: 0.875rem;
    transition: all 0.2s ease;
    font-family: inherit;
}

.feedback-form input:focus,
.feedback-form select:focus,
.feedback-form textarea:focus {
    outline: none;
    border-color: hsl(var(--primary));
    box-shadow: 0 0 0 3px hsl(var(--primary) / 0.1);
}

.feedback-form textarea {
    resize: vertical;
    min-height: 80px;
}

/* Star Rating */
.rating-group {
    margin-top: 0.5rem;
}

.star-rating {
    display: flex;
    gap: 0.25rem;
}

.star {
    background: none;
    border: none;
    color: hsl(var(--muted-foreground));
    font-size: 1.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0.25rem;
    border-radius: 4px;
}

.star:hover,
.star.active {
    color: #fbbf24; /* Amber star color */
    transform: scale(1.1);
}

.star:hover {
    background: hsl(var(--muted) / 0.5);
}

/* Checkbox Group */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 400 !important;
    margin-bottom: 0 !important;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.checkbox-item:hover {
    background: hsl(var(--muted) / 0.3);
}

.checkbox-item input[type="checkbox"] {
    width: auto;
    margin: 0;
    cursor: pointer;
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    padding-top: 1.5rem;
    border-top: 1px solid hsl(var(--border));
    margin-top: 1.5rem;
}

.btn-primary,
.btn-secondary {
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    border-color: hsl(var(--primary));
}

.btn-primary:hover {
    background: hsl(var(--primary) / 0.9);
    transform: translateY(-1px);
}

.btn-secondary {
    background: hsl(var(--background));
    color: hsl(var(--foreground));
    border-color: hsl(var(--border));
}

.btn-secondary:hover {
    background: hsl(var(--muted));
}

/* Success/Error Messages */
.feedback-success,
.feedback-error {
    text-align: center;
    padding: 2rem 1rem;
}

.feedback-success i {
    font-size: 3rem;
    color: #22c55e;
    margin-bottom: 1rem;
    display: block;
}

.feedback-error i {
    font-size: 3rem;
    color: #ef4444;
    margin-bottom: 1rem;
    display: block;
}

.feedback-success h3,
.feedback-error h3 {
    margin: 0 0 0.5rem 0;
    color: hsl(var(--foreground));
}

.feedback-success p,
.feedback-error p {
    margin: 0 0 1rem 0;
    color: hsl(var(--muted-foreground));
    font-size: 0.875rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .feedback-widget {
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
    }
    
    .feedback-panel {
        width: 100%;
        max-width: none;
        position: fixed;
        bottom: 1rem;
        left: 1rem;
        right: 1rem;
    }
    
    .feedback-trigger {
        width: 100%;
        justify-content: center;
        padding: 1rem;
        border-radius: 12px;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .btn-primary,
    .btn-secondary {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .feedback-content {
        padding: 1rem;
    }
    
    .feedback-header {
        padding: 1rem;
    }
    
    .checkbox-group {
        gap: 0.75rem;
    }
    
    .star {
        font-size: 1.5rem;
        padding: 0.5rem;
    }
}

/* Animation for widget appearance */
@keyframes slideInUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.feedback-widget {
    animation: slideInUp 0.5s ease-out;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .feedback-trigger {
        border: 2px solid hsl(var(--primary-foreground));
    }
    
    .feedback-panel {
        border-width: 2px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .feedback-widget,
    .feedback-trigger,
    .feedback-panel,
    .star,
    .btn-primary,
    .btn-secondary {
        transition: none;
        animation: none;
    }
    
    .feedback-icon {
        animation: none;
    }
}