/**
 * User Feedback Panel Widget Styles
 * Simplified panel for users to submit feedback and view their requests
 * Updated to match wireframe design (flat, teal header)
 */

/* ============================================================================
   CSS Variables
   ============================================================================ */

:root {
    --teal: #14b8a6;
    --teal-dark: #0f766e;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --blue: #3b82f6;
    --green: #10b981;
}

/* ============================================================================
   Floating Action Button (FAB) - Chat bubble icon
   ============================================================================ */

.feedback-panel-fab {
    position: fixed;
    bottom: 96px; /* Position above developer FAB if both are visible */
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--teal);
    color: white;
    font-size: 24px;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    transition: all 0.3s ease;
    display: none; /* Hidden by default, shown by JS if user has permission */
    align-items: center;
    justify-content: center;
}

.feedback-panel-fab:hover {
    transform: scale(1.05);
    background: var(--teal-dark);
}

.feedback-panel-fab:active {
    transform: scale(0.95);
}

/* ============================================================================
   Panel Container
   ============================================================================ */

.feedback-panel-container {
    position: fixed;
    top: 0;
    right: -420px;
    width: 400px;
    height: 100vh;
    background: #ffffff;
    box-shadow: -4px 0 12px rgba(0, 0, 0, 0.1);
    z-index: 2000;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--gray-200);
}

.feedback-panel-container.open {
    right: 0;
}

/* ============================================================================
   Panel Header - Teal theme matching wireframe
   ============================================================================ */

.feedback-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--teal);
    color: white;
    flex-shrink: 0;
}

.feedback-panel-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
}

.feedback-panel-subtitle {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.8);
    margin-top: 2px;
}

.feedback-panel-header h2 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}

.feedback-close-btn {
    background: transparent;
    border: none;
    color: #ffffff !important;
    width: 32px;
    height: 32px;
    cursor: pointer;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    border-radius: 0;
}

.feedback-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* ============================================================================
   Panel Content
   ============================================================================ */

.feedback-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.feedback-panel-content::-webkit-scrollbar {
    width: 6px;
}

.feedback-panel-content::-webkit-scrollbar-track {
    background: var(--gray-100);
}

.feedback-panel-content::-webkit-scrollbar-thumb {
    background: var(--gray-300);
}

.feedback-panel-content::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* ============================================================================
   Section Containers - Page Info & Feedback Form
   ============================================================================ */

.page-info-section {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
}

.page-info-section h3 {
    margin: 0 0 12px 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-900);
}

.feedback-form-section {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
}

.feedback-form-section h3 {
    margin: 0 0 8px 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-900);
}

.section-description {
    margin: 0 0 16px 0;
    font-size: 12px;
    color: var(--gray-600);
    line-height: 1.4;
}

/* ============================================================================
   Current Status Section (Read-Only)
   ============================================================================ */

.current-status {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    padding: 16px;
    margin-bottom: 20px;
}

.status-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--gray-600);
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.status-badge {
    padding: 4px 10px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    background: var(--teal);
    color: white;
    border-radius: 0;
    display: inline-block;
    margin-bottom: 10px;
}

.status-phase {
    font-size: 12px;
    color: var(--gray-700);
    margin-bottom: 8px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--gray-200);
    overflow: hidden;
    margin-bottom: 6px;
}

.progress-fill {
    height: 100%;
    background: var(--teal);
}

.progress-text {
    font-size: 10px;
    color: var(--gray-600);
    font-weight: 600;
}

/* ============================================================================
   Divider
   ============================================================================ */

.divider {
    height: 1px;
    background: var(--gray-300);
    margin: 24px 0;
}

/* ============================================================================
   Form Styles
   ============================================================================ */

.form-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 16px;
}

.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.form-select,
.form-input,
.form-textarea {
    width: 100%;
    padding: 8px 10px;
    font-size: 12px;
    font-family: inherit;
    border: 1px solid var(--gray-300);
    background: white;
    color: var(--gray-900);
    transition: border-color 0.2s;
}

.form-select:focus,
.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--teal);
}

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

.form-hint {
    font-size: 10px;
    color: var(--gray-500);
    margin-top: 4px;
}

/* ============================================================================
   Radio Group
   ============================================================================ */

.radio-group {
    display: flex;
    gap: 16px;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.radio-option input[type="radio"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--teal);
}

.radio-option label {
    font-size: 12px;
    color: var(--gray-700);
    cursor: pointer;
}

/* ============================================================================
   Form Actions (Cancel & Submit Buttons)
   ============================================================================ */

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.cancel-feedback-btn {
    flex: 1;
    padding: 12px;
    font-size: 13px;
    font-weight: 600;
    background: var(--gray-100);
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
    cursor: pointer;
    transition: all 0.2s;
}

.cancel-feedback-btn:hover {
    background: var(--gray-200);
    border-color: var(--gray-400);
}

.cancel-feedback-btn:active {
    transform: scale(0.98);
}

/* ============================================================================
   Submit Button
   ============================================================================ */

.submit-button,
.submit-feedback-btn {
    flex: 1;
    padding: 12px;
    font-size: 13px;
    font-weight: 600;
    background: var(--teal);
    color: white;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
}

.submit-button:hover,
.submit-feedback-btn:hover {
    background: var(--teal-dark);
}

.submit-button:active,
.submit-feedback-btn:active {
    transform: scale(0.98);
}

.submit-feedback-btn:disabled {
    background: var(--gray-300);
    cursor: not-allowed;
    transform: none;
}

/* ============================================================================
   Info Box
   ============================================================================ */

.info-box {
    background: #dbeafe;
    border-left: 3px solid var(--blue);
    padding: 12px;
    font-size: 11px;
    line-height: 1.5;
    color: var(--gray-700);
    margin-top: 16px;
}

.info-box-title {
    font-weight: 600;
    margin-bottom: 4px;
    color: #1e40af;
}

/* ============================================================================
   Success Message
   ============================================================================ */

.success-message {
    background: #d1fae5;
    border: 1px solid var(--green);
    padding: 16px;
    text-align: center;
    display: none;
}

.success-message.show {
    display: block;
    animation: fadeIn 0.3s ease;
}

.success-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.success-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 4px;
}

.success-text {
    font-size: 11px;
    color: var(--gray-700);
}

/* ============================================================================
   Error Message
   ============================================================================ */

.error-message {
    padding: 12px 16px;
    background: #fee2e2;
    border-left: 3px solid #ef4444;
    margin-bottom: 16px;
    display: none;
}

.error-message.show {
    display: block;
    animation: fadeIn 0.3s ease;
}

.error-message p {
    margin: 0;
    font-size: 12px;
    color: #991b1b;
    font-weight: 500;
}

/* ============================================================================
   Project Summary Cards
   ============================================================================ */

.projects-summary {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.project-summary-card {
    background: white;
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

.project-summary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--gray-100);
}

.project-summary-name {
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-900);
}

.project-summary-status {
    padding: 4px 10px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    border-radius: 0;
}

.project-summary-status.planning {
    background: var(--blue);
    color: white;
}

.project-summary-status.in_progress {
    background: var(--teal);
    color: white;
}

.project-summary-status.testing {
    background: #a855f7;
    color: white;
}

.project-summary-status.complete {
    background: var(--green);
    color: white;
}

.project-summary-body {
    padding: 12px;
}

.project-summary-description {
    margin: 0 0 12px 0;
    font-size: 11px;
    color: var(--gray-600);
    line-height: 1.5;
}

.project-summary-meta {
    display: flex;
    gap: 16px;
}

.meta-item {
    display: flex;
    gap: 6px;
    font-size: 11px;
}

.meta-label {
    font-weight: 600;
    color: var(--gray-500);
}

.meta-value {
    color: var(--gray-900);
}

/* ============================================================================
   My Requests Section
   ============================================================================ */

.my-requests-section {
    background: var(--gray-50);
    padding: 16px 20px;
    margin-top: 0;
}

.my-requests-section h3 {
    margin: 0 0 12px 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-900);
}

.requests-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.my-request-card {
    background: white;
    border: 1px solid var(--gray-200);
    padding: 12px;
}

.my-request-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.request-badges {
    display: flex;
    gap: 6px;
}

.my-request-type-badge,
.my-request-priority-badge,
.my-request-status-badge {
    padding: 2px 6px;
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    border-radius: 0;
}

/* Type badges */
.my-request-type-badge.feature_request {
    background: var(--blue);
    color: white;
}

.my-request-type-badge.bug_report {
    background: #ef4444;
    color: white;
}

.my-request-type-badge.improvement {
    background: #eab308;
    color: white;
}

.my-request-type-badge.question {
    background: #a855f7;
    color: white;
}

/* Priority badges */
.my-request-priority-badge.low {
    background: var(--gray-400);
    color: white;
}

.my-request-priority-badge.medium {
    background: #eab308;
    color: white;
}

.my-request-priority-badge.high {
    background: #ef4444;
    color: white;
}

/* Status badges */
.my-request-status-badge.pending {
    background: #eab308;
    color: white;
}

.my-request-status-badge.accepted {
    background: var(--green);
    color: white;
}

.my-request-status-badge.rejected {
    background: #ef4444;
    color: white;
}

.my-request-status-badge.in_progress {
    background: var(--teal);
    color: white;
}

.my-request-title {
    margin: 0 0 4px 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-900);
}

.my-request-description {
    margin: 0 0 8px 0;
    font-size: 11px;
    color: var(--gray-600);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.my-request-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 8px;
    border-top: 1px solid var(--gray-200);
}

.my-request-date {
    font-size: 10px;
    color: var(--gray-500);
}

/* Project Link (for converted requests) */
.my-request-project-link {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding: 8px 10px;
    background: linear-gradient(135deg, #e0f2fe 0%, #f0fdf4 100%);
    border: 1px solid var(--teal);
    border-radius: 0;
    font-size: 11px;
}

.my-request-project-link .project-status-icon {
    color: var(--teal-dark);
    font-weight: bold;
}

.my-request-project-link .project-status-text {
    color: var(--gray-600);
}

.my-request-project-link .project-name {
    color: var(--teal-dark);
}

.my-request-dev-notes {
    margin-top: 8px;
    padding: 8px;
    background: #fffbeb;
    border-left: 3px solid #fbbf24;
}

.my-request-dev-notes strong {
    display: block;
    margin-bottom: 4px;
    font-size: 10px;
    color: #92400e;
}

.dev-notes-text {
    margin: 0;
    font-size: 10px;
    color: #78350f;
    line-height: 1.4;
}

/* ============================================================================
   Loading Spinner
   ============================================================================ */

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--gray-500);
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--teal);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

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

.loading-spinner p {
    margin-top: 12px;
    font-size: 12px;
}

/* ============================================================================
   Empty States
   ============================================================================ */

.empty-state {
    text-align: center;
    padding: 24px 16px;
    color: var(--gray-400);
}

.empty-state-icon {
    font-size: 40px;
    margin-bottom: 8px;
}

.empty-state-text {
    font-size: 12px;
    margin: 0;
}

/* ============================================================================
   File Upload Zone
   ============================================================================ */

.file-upload-zone {
    border: 2px dashed var(--gray-300);
    border-radius: 0;
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
    margin-top: 8px;
}

.file-upload-zone:hover,
.file-upload-zone.drag-over {
    border-color: var(--teal);
    background-color: rgba(20, 184, 166, 0.05);
}

.file-upload-zone.error {
    border-color: #ef4444;
    background-color: rgba(239, 68, 68, 0.05);
}

.upload-icon {
    font-size: 32px;
    display: block;
    margin-bottom: 8px;
}

.upload-text {
    font-weight: 500;
    color: var(--gray-700);
    margin: 0;
    font-size: 14px;
}

.upload-subtext {
    color: var(--gray-500);
    font-size: 13px;
    margin: 4px 0 0 0;
}

.upload-hint {
    color: var(--gray-400);
    font-size: 12px;
    margin: 8px 0 0 0;
}

/* Attached Files List */
.attached-files-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

/* File Card */
.attached-file-card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 0;
    max-width: 200px;
}

.file-thumbnail {
    width: 32px;
    height: 32px;
    border-radius: 0;
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-200);
}

.file-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.file-icon {
    font-size: 18px;
}

.file-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.file-name {
    font-size: 13px;
    color: var(--gray-700);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size {
    font-size: 11px;
    color: var(--gray-400);
}

.file-remove-btn {
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    font-size: 18px;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
}

.file-remove-btn:hover {
    color: #ef4444;
}

/* Upload Progress */
.upload-progress {
    margin-top: 12px;
}

.progress-bar {
    height: 4px;
    background: var(--gray-200);
    border-radius: 0;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--teal);
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 4px;
    display: block;
}

/* Upload Error */
.upload-error {
    color: #ef4444;
    font-size: 12px;
    margin-top: 8px;
    padding: 8px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 0;
}

/* ============================================================================
   Responsive Adjustments
   ============================================================================ */

@media (max-width: 768px) {
    .feedback-panel-container {
        width: 100%;
        right: -100%;
    }

    .feedback-panel-fab {
        bottom: 80px;
    }

    .file-upload-zone {
        padding: 16px;
    }

    .attached-file-card {
        max-width: 100%;
        width: 100%;
    }
}
