/**
 * Simple Feedback Widget CSS - Exact Design Match
 * Styled to match the provided UI designs exactly
 */

/* Main feedback widget container */
.feedback-widget {
    background: #F7F7F7;
    border: 0.5px solid #828282;
    border-radius: 8px;
    box-shadow: 0px 2px 4px 0px #0000001A;
    position: relative;
    transition: all 0.3s ease;
    margin: 20px auto 10px;
}

/* Desktop: max width and center alignment */
@media (min-width: 769px) {
    .feedback-widget {
        max-width: 600px;
        margin: 20px auto 10px;
    }
}

/* Main feedback section */
.feedback-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
}

/* Feedback question text */
.feedback-question {
    display: flex;
    gap: 18px;
}

.feedback-question span,
.feedback-form-header span {
    font-size: 14px;
    font-weight: 400;
    color: #606060;
    line-height: 20px;
}

/* Feedback buttons container */
.feedback-buttons {
    display: flex;
    align-items: center;
    gap: 20px;
    
}

/* Individual feedback buttons */
.feedback-btn {
    width: 25px;
    height: 25px;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0;
}

/* Thumbs up button */
.feedback-thumbs-up {
    background: #e8f5e8;
    color: #28a745;
}

.feedback-thumbs-up:hover:not(.active) {
    background: #d4edda;
    transform: scale(1.05);
}

.feedback-thumbs-up:active:not(.active) {
    transform: scale(0.95);
}

.feedback-thumbs-up.active {
    background: #28a745;
    color: white;
    transform: scale(1.1);
}

/* Thumbs down button */
.feedback-thumbs-down {
    background: #fdeaea;
    color: #dc3545;
}

.feedback-thumbs-down:hover:not(.active) {
    background: #f8d7da;
}

.feedback-thumbs-down.active {
    background: #dc3545;
    color: white;
}

/* Close button */
.feedback-close {
    color: #606060;
}

/* Form container */
.feedback-form-container {
    border-top: 0.5px solid #828282;
    padding: 12px;
}

/* Form header */
.feedback-form-header {
    margin-bottom: 16px;
}

/* Form content */
.feedback-form-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Feedback options */
.feedback-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-start;
}

.feedback-option-btn {
    flex: 1 1 calc(50% - 4px); /* Prefer 2 per row */
    min-width: 120px; /* Minimum width to trigger wrap */
    word-wrap: break-word; /* Break long words */
    overflow-wrap: break-word; /* Modern browsers */
    hyphens: auto; /* Add hyphens for long words */
}

/* Desktop: 4 buttons in single row by default, wrap on overflow */
@media (min-width: 769px) {
    .feedback-options {
        gap: 12px;
    }
    
    .feedback-option-btn {
        flex: 0 1 auto; /* Auto width, shrink if needed, wrap if overflow */
        min-width: 100px; /* Minimum width to trigger wrap when content is too long */
        max-width: none;
    }
}

/* Feedback option buttons */
.feedback-option-btn {
    padding: 6px 8px;
    border: 0.5px solid #717171;
    border-radius: 6px;
    background: white;
    color: #4d4d4d;
    font-size: 13px;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    line-height: 18px;
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: normal; /* Allow text wrapping */
    box-sizing: border-box;
}

/* Selected state */
.feedback-option-btn.feedback-selected {
    background: white;
    border-color: #e91e63;
    border-width: 1px;
    color: #333;
}

.feedback-option-btn.feedback-selected:hover {
    background: #fff;
    border-color: #e91e63;
}

.feedback-details textarea {
    width: 100%;
    min-height: 68px;
    padding: 8px 12px;
    border: 0.5px solid #717171;
    color: #828282;
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    line-height: 20px;
    resize: vertical;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.feedback-details .character-count {
    display: block;
    text-align: right;
    font-size: 12px;
    color: #6c757d;
}

.feedback-details .character-count.over-limit {
    color: #dc3545;
}

.feedback-details textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.feedback-details textarea::placeholder {
    color: #6c757d;
}

/* Form actions */
.feedback-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Action buttons */
.feedback-cancel,
.feedback-submit {
    padding: 4px 24px;
    border: none;
    border-radius: 36px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 80px;
}

/* Cancel button */
.feedback-cancel {
    background: #fff;
    color: #686868;
    border: 1px solid #dee2e6;
    border: 0.5px solid #717171;
    line-height: 24px;
}

.feedback-cancel:hover {
    background: #e9ecef;
    color: #495057;
}

/* Submit button */
.feedback-submit {
    background: #e91e63;
    color: white;
    background: #FF008C;
}

.feedback-submit:hover:not(.disabled) {
    background: #c2185b;
    border-color: #c2185b;
}

.feedback-submit.disabled {
    background: #dee2e6;
    color: #686868;
    cursor: not-allowed;
    background: #BFBFBF;
}

/* Thanks message */
.feedback-thanks {
    padding: 12px;
}

.feedback-thanks span {
    font-size: 14px;
    font-weight: 400;
    color: #606060;
    line-height: 20px;
}

/* Responsive design */
@media (max-width: 768px) {

    .feedback-buttons {
        gap: 6px;
    }
    
    .feedback-main {
        flex-direction: row;
        align-items: center;
    }
    
    .feedback-options {
        gap: 6px;
    }
    
    .feedback-option-btn {
        flex: 1 1 calc(50% - 3px); /* Prefer 2 per row with smaller gap */
        min-width: 100px; /* Minimum width to trigger wrap on mobile */
        font-size: 12px; /* Slightly smaller font for mobile */
        padding: 8px 6px; /* Adjust padding for mobile */
        line-height: 16px; /* Tighter line height for mobile */
    }
    
    .feedback-form-actions {
        gap: 8px;
    }
    
    .feedback-cancel,
    .feedback-submit {
        width: auto;
    }

    .feedback-form-container {
        padding: 6px 4px;
    }
}

/* Animation for smooth transitions */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.feedback-form-container {
    animation: slideDown 0.3s ease-out;
}

.feedback-thanks {
    animation: fadeIn 0.3s ease-out;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .feedback-widget {
        border-color: #000;
    }
    
    .feedback-thumbs-up {
        background: #fff;
        border: 2px solid #28a745;
    }
    
    .feedback-thumbs-down {
        background: #fff;
        border: 2px solid #dc3545;
    }
    
    .feedback-option-btn {
        border-color: #000;
    }
    
    .feedback-option-btn.feedback-selected {
        border-color: #000;
        background: #f0f0f0;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .feedback-widget,
    .feedback-btn,
    .feedback-cancel,
    .feedback-submit,
    .feedback-option-btn {
        transition: none;
    }
    
    .feedback-form-container,
    .feedback-thanks {
        animation: none;
    }
}
