/**
 * Feedback System Styles
 * 
 * Styles for the feedback button and modal system.
 * Integrates with existing design system and modal patterns.
 */

/* ============= FLOATING FEEDBACK BUTTON ============= */

.feedback-button {
    position: fixed;
    bottom: 1.5rem; /* 24px - better spacing for larger button */
    right: 1.5rem; /* 24px - better spacing for larger button */
    z-index: 999; /* Lower z-index to avoid overlay issues */
    
    /* Green prominent button styling */
    background-color: #4CAF50; /* Green background */
    color: white; /* White icon */
    border: 0.0625rem solid #45a049; /* 1px darker green border */
    border-radius: 50%; /* Circular button */
    padding: 0; /* No padding for icon-only */
    
    /* Typography - larger and more visible */
    font-family: 'Google Sans', Arial, sans-serif;
    font-size: 1.25rem; /* 20px for icon - larger */
    font-weight: 500;
    
    /* Layout - larger but still compact */
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3.5rem; /* 56px - larger circular button */
    height: 3.5rem; /* 56px - larger circular button */
    
    /* Prominent shadow effects */
    box-shadow: 0 0.25rem 0.75rem rgba(76, 175, 80, 0.3); /* 0 4px 12px - green shadow for visibility */
    cursor: pointer;
    transition: all 0.2s ease;
    
    /* Initial state */
    transform: translateY(6.25rem); /* 100px */
    opacity: 0;
}

.feedback-button.visible {
    transform: translateY(0);
    opacity: 1;
}

.feedback-button:hover {
    transform: translateY(-0.0625rem); /* -1px - subtle */
    box-shadow: 0 0.25rem 0.75rem rgba(76, 175, 80, 0.4); /* 0 4px 12px - green shadow */
    background-color: #45a049; /* Darker green on hover */
    color: white; /* Keep white text on hover */
    border-color: #3d8b40; /* Even darker green border on hover */
}

.feedback-button:active,
.feedback-button.clicked {
    transform: translateY(0) scale(0.95);
    box-shadow: 0 0.125rem 0.625rem rgba(76, 175, 80, 0.3); /* 0 2px 10px */
}

.feedback-button:disabled,
.feedback-button.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: translateY(0);
}

.feedback-button-content {
    display: none; /* Hide text content for small button */
}

.feedback-button .material-symbols-rounded {
    font-size: 1.25rem; /* 20px - larger icon to match button */
    flex-shrink: 0;
}

.feedback-button-text {
    flex: 1;
    text-align: left;
    white-space: nowrap;
}

.feedback-token-badge {
    position: absolute;
    top: -0.25rem; /* -4px */
    right: -0.25rem; /* -4px */
    background: #4CAF50; /* Green accent */
    color: white;
    border-radius: 0.5rem; /* 8px */
    padding: 0.125rem 0.25rem; /* 2px 4px - very small */
    font-size: 0.625rem; /* 10px - very small */
    font-weight: 600;
    min-width: 1rem; /* 16px */
    text-align: center;
    line-height: 1;
    box-shadow: 0 0.0625rem 0.25rem rgba(0, 0, 0, 0.3); /* 0 1px 4px */
}

/* ============= FEEDBACK MODAL STYLES ============= */
/* Using payment modal styling pattern for consistency */

#feedback-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(0.25rem); /* 4px */
    animation: fadeIn 0.3s ease;
}

#feedback-modal .modal-content {
    background-color: var(--card-color);
    border-radius: var(--border-radius-lg);
    max-width: 32.5rem; /* 520px - matching payment modal */
    width: 90%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 1.25rem 2.5rem rgba(0, 0, 0, 0.6); /* 0 20px 40px */
    border: 0.0625rem solid var(--border-color); /* 1px */
    animation: slideUp 0.3s ease;
    position: relative;
}

#feedback-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem; /* 20px 24px */
    border-bottom: 0.0625rem solid var(--border-color); /* 1px */
    flex-shrink: 0;
}

#feedback-modal .modal-header h3 {
    font-size: 1.25rem; /* 20px */
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem; /* 8px */
}

#feedback-modal .modal-header h3::before {
    content: 'feedback';
    font-family: 'Material Symbols Rounded';
    font-size: 1.25rem; /* 20px - smaller */
    color: #4CAF50;
}

#feedback-modal .close-modal {
    position: absolute;
    top: 0.75rem; /* 12px */
    right: 0.75rem; /* 12px */
    font-size: 1.25rem; /* 20px */
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1;
    padding: 0.375rem; /* 6px */
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.05);
    width: 2rem; /* 32px */
    height: 2rem; /* 32px */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border: 0.0625rem solid rgba(255, 255, 255, 0.1); /* 1px */
}

#feedback-modal .close-modal:hover {
    color: var(--text-color);
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

#feedback-modal .modal-body {
    padding: 1.5rem; /* 24px */
    overflow-y: auto;
    flex: 1;
}

/* ============= FEEDBACK FORM STYLES ============= */

.feedback-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem; /* 20px */
}

.feedback-intro {
    background-color: rgba(255, 255, 255, 0.03);
    border-radius: var(--border-radius-md);
    border: 0.0625rem solid var(--border-color); /* 1px */
    padding: 1.125rem; /* 18px - matching payment modal details */
    margin-bottom: 1.25rem; /* 20px */
}

.feedback-intro p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.875rem; /* 14px */
    line-height: 1.5;
}

.feedback-intro strong {
    color: #4CAF50;
    font-weight: 600;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem; /* 8px */
}

.form-group label {
    color: var(--primary-color);
    font-weight: 500;
    font-size: 0.875rem; /* 14px */
    display: flex;
    align-items: center;
    gap: 0.25rem; /* 4px */
}

.form-group label::after {
    content: '*';
    color: #ff6b6b;
    font-weight: normal;
    margin-left: 0.125rem; /* 2px */
}

.form-group input,
.form-group select,
.form-group textarea {
    background-color: #2a2a2a; /* Matching Stripe elements */
    border: 0.0625rem solid #444; /* 1px */
    border-radius: var(--border-radius-md);
    padding: 0.75rem 1rem; /* 12px 16px */
    color: var(--text-color);
    font-family: 'Google Sans', Arial, sans-serif;
    font-size: 0.875rem; /* 14px */
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    min-height: 2.5rem; /* 40px - matching Stripe elements */
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea; /* Matching Stripe focus color */
    box-shadow: 0 0 0 0.125rem rgba(102, 126, 234, 0.2); /* 2px */
}

.form-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ffffff'><path d='M7 10l5 5 5-5z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 0.75rem center; /* 12px */
    background-size: 1.25rem; /* 20px */
    padding-right: 2.5rem; /* 40px */
}

.form-group textarea {
    resize: vertical;
    min-height: 7.5rem; /* 120px */
    font-family: inherit;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

/* Character counters */
.char-counter {
    align-self: flex-end;
    font-size: 0.75rem; /* 12px */
    color: rgba(255, 255, 255, 0.6);
    margin-top: 0.25rem; /* 4px */
}

.char-counter.warning {
    color: #ff9800;
}

.char-counter.error {
    color: #ff6b6b;
}

/* ============= FORM ACTIONS ============= */

.form-actions {
    display: flex;
    gap: 0.75rem; /* 12px */
    justify-content: flex-end;
    margin-top: 1.5rem; /* 24px */
    padding-top: 1.25rem; /* 20px */
    border-top: 0.0625rem solid rgba(255, 255, 255, 0.1); /* 1px */
}

.btn {
    padding: 0.75rem 1.5rem; /* 12px 24px */
    border-radius: 0.5rem; /* 8px */
    font-family: 'Google Sans', Arial, sans-serif;
    font-size: 0.875rem; /* 14px */
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    display: flex;
    align-items: center;
    gap: 0.5rem; /* 8px */
    min-height: 2.75rem; /* 44px - Touch-friendly */
}

.btn-secondary {
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    border: 0.0625rem solid rgba(255, 255, 255, 0.2); /* 1px */
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--primary-color);
    border-color: rgba(255, 255, 255, 0.3);
}

.btn-primary {
    background-color: #4CAF50; /* Consistent with existing design system */
    color: white;
    position: relative;
    overflow: hidden;
}

.btn-primary:hover:not(:disabled) {
    background-color: #45a049; /* Consistent hover state */
    transform: translateY(-0.0625rem); /* -1px */
    box-shadow: 0 0.25rem 0.75rem rgba(76, 175, 80, 0.3); /* 0 4px 12px */
}

.btn-primary:disabled,
.btn-primary.disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.btn-primary:hover:not(:disabled) {
    background-color: #45a049; /* Consistent hover state */
    transform: translateY(-0.0625rem); /* -1px */
    box-shadow: 0 0.25rem 0.75rem rgba(76, 175, 80, 0.3); /* 0 4px 12px */
}

.btn-primary:disabled,
.btn-primary.loading {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.btn .spinner {
    width: 1rem; /* 16px */
    height: 1rem; /* 16px */
    border: 0.125rem solid rgba(255, 255, 255, 0.3); /* 2px */
    border-top: 0.125rem solid white; /* 2px */
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

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

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(1.875rem) scale(0.95); /* 30px */
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes slideUpFromBottom {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

/* ============= ERROR MESSAGES ============= */

.error-message {
    background: rgba(244, 67, 54, 0.1);
    border: 0.0625rem solid rgba(244, 67, 54, 0.3); /* 1px */
    border-radius: 0.5rem; /* 8px */
    padding: 0.75rem 1rem; /* 12px 16px */
    margin-top: 1rem; /* 16px */
    color: #ff6b6b;
    font-size: 0.875rem; /* 14px */
    line-height: 1.4;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem; /* 8px */
}

.error-message::before {
    content: 'error';
    font-family: 'Material Symbols Rounded';
    font-size: 1.125rem; /* 18px */
    flex-shrink: 0;
    margin-top: 0.0625rem; /* 1px */
}

/* ============= RESPONSIVE DESIGN ============= */

@media (max-width: 48rem) { /* 768px */
    .feedback-button {
        bottom: 1rem; /* 16px */
        right: 1rem; /* 16px */
        width: 3rem; /* 48px - slightly smaller on mobile but still prominent */
        height: 3rem; /* 48px - slightly smaller on mobile but still prominent */
    }
    
    .feedback-button .material-symbols-rounded {
        font-size: 1.125rem; /* 18px */
    }
    
    .feedback-token-badge {
        padding: 0.0625rem 0.25rem; /* 1px 4px - smaller */
        font-size: 0.5625rem; /* 9px - smaller */
        min-width: 0.875rem; /* 14px */
    }
    
    #feedback-modal .modal-content {
        width: 95%;
        margin: 2% auto;
        max-height: 95vh;
    }
    
    .form-actions {
        flex-direction: column-reverse;
    }
    
    .btn {
        justify-content: center;
    }
}

@media (max-width: 30rem) { /* 480px */
    .feedback-button {
        /* Slightly smaller but still visible */
        bottom: 1rem; /* 16px */
        right: 1rem; /* 16px */
        width: 2.75rem; /* 44px - smaller but still prominent */
        height: 2.75rem; /* 44px - smaller but still prominent */
    }
    
    .feedback-token-badge {
        /* Make badge even smaller on very small screens */
        font-size: 0.5rem; /* 8px */
        padding: 0.0625rem 0.1875rem; /* 1px 3px */
        min-width: 0.75rem; /* 12px */
    }
    
    #feedback-modal .modal-content {
        /* Bottom sheet style on mobile */
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        margin: 0;
        border-radius: 1rem 1rem 0 0; /* 16px rounded top corners */
        max-height: 80vh;
        animation: slideUpFromBottom 0.3s ease;
    }
    
    .feedback-intro {
        margin-bottom: 1rem; /* 16px */
    }
    
    .form-actions {
        padding-top: 1rem; /* 16px */
        gap: 0.5rem; /* 8px */
    }
}

/* ============= ACCESSIBILITY IMPROVEMENTS ============= */

@media (prefers-reduced-motion: reduce) {
    .feedback-button,
    .btn,
    .form-group input,
    .form-group select,
    .form-group textarea {
        transition: none;
    }
    
    .feedback-button.visible {
        transform: none;
    }
    
    .btn .spinner {
        animation: none;
    }
}

/* Focus indicators for keyboard navigation */
.feedback-button:focus-visible {
    outline: 0.125rem solid #4CAF50; /* 2px */
    outline-offset: 0.125rem; /* 2px */
}

.btn:focus-visible,
.form-group input:focus-visible,
.form-group select:focus-visible,
.form-group textarea:focus-visible {
    outline: 0.125rem solid #4CAF50; /* 2px */
    outline-offset: 0.125rem; /* 2px */
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .feedback-button {
        border: 0.125rem solid currentColor; /* 2px */
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        border-width: 0.125rem; /* 2px */
    }
}