/**
 * Society Arts Feedback Widget Styles
 * Brand Colors: Brown #3E2318, Beige #EAE4DA, Orange #C73314
 * Typography: Familjen Grotesk, Libre Baskerville
 * Position: Top right, dropdown panel
 */

/* Widget Container */
#sa-feedback-widget {
    --sa-brown: #3E2318;
    --sa-beige: #EAE4DA;
    --sa-beige-light: #F5F2ED;
    --sa-orange: #C73314;
    --sa-orange-hover: #a82910;
    --sa-text-muted: #6B5C52;
    --sa-shadow: 0 4px 20px rgba(62, 35, 24, 0.15);
    --sa-shadow-hover: 0 6px 24px rgba(62, 35, 24, 0.2);
    --sa-transition: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    
    position: fixed;
    right: 20px;
    top: 10px;
    z-index: 999999;
    font-family: 'Familjen Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
/* The Tab (Always Visible) */
.sa-feedback-tab {
    background: var(--sa-brown);
    color: var(--sa-beige);
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    transition: all var(--sa-transition);
    box-shadow: var(--sa-shadow);
    border: none;
    outline: none;
}

.sa-feedback-tab:hover {
    box-shadow: var(--sa-shadow-hover);
    transform: translateY(-1px);
}

.sa-feedback-tab:focus-visible {
    outline: 2px solid var(--sa-orange);
    outline-offset: 2px;
}

.sa-feedback-tab-icon {
    width: 20px;
    height: 20px;
}

.sa-feedback-tab-text {
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.3px;
}

/* The Panel */
.sa-feedback-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    width: 340px;
    background: var(--sa-beige);
    border-radius: 12px;
    box-shadow: var(--sa-shadow-hover);
    padding: 24px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--sa-transition);
}

/* Open State */
#sa-feedback-widget.sa-feedback-open .sa-feedback-panel {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

/* Close Button */
.sa-feedback-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--sa-text-muted);
    padding: 4px;
    border-radius: 4px;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sa-feedback-close:hover {
    color: var(--sa-brown);
    background: rgba(62, 35, 24, 0.08);
}

.sa-feedback-close svg {
    width: 18px;
    height: 18px;
}

/* Header */
.sa-feedback-header {
    margin-bottom: 20px;
    padding-right: 24px;
}

.sa-feedback-header h3 {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: 18px;
    font-weight: 500;
    color: var(--sa-brown);
    margin: 0 0 6px 0;
    line-height: 1.3;
}

.sa-feedback-header p {
    font-size: 13px;
    color: var(--sa-text-muted);
    margin: 0;
    line-height: 1.4;
}

/* Category Buttons */
.sa-feedback-categories {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.sa-feedback-category {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 8px;
    background: white;
    border: 1.5px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
}

.sa-feedback-category:hover {
    border-color: var(--sa-brown);
}

.sa-feedback-category-selected {
    border-color: var(--sa-orange);
    background: rgba(199, 51, 20, 0.05);
}

.sa-category-icon {
    font-size: 18px;
    line-height: 1;
}

.sa-feedback-category span:last-child {
    font-size: 12px;
    font-weight: 500;
    color: var(--sa-brown);
}

/* Input Container */
.sa-feedback-input-container {
    position: relative;
    margin-bottom: 16px;
}

.sa-feedback-textarea {
    width: 100%;
    padding: 12px;
    padding-right: 44px;
    border: 1.5px solid rgba(62, 35, 24, 0.15);
    border-radius: 8px;
    background: white;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    color: var(--sa-brown);
    resize: vertical;
    min-height: 100px;
    transition: border-color 0.15s ease;
    box-sizing: border-box;
}

.sa-feedback-textarea::placeholder {
    color: var(--sa-text-muted);
}

.sa-feedback-textarea:focus {
    outline: none;
    border-color: var(--sa-brown);
}

.sa-feedback-textarea-error {
    animation: shake 0.3s ease;
    border-color: var(--sa-orange) !important;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

/* Microphone Button */
.sa-feedback-mic {
    position: absolute;
    right: 8px;
    bottom: 8px;
    width: 32px;
    height: 32px;
    background: var(--sa-beige-light);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    color: var(--sa-text-muted);
    padding: 6px;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sa-feedback-mic:hover {
    background: var(--sa-beige);
    color: var(--sa-brown);
}

.sa-mic-icon {
    width: 18px;
    height: 18px;
}

.sa-mic-recording-indicator {
    display: none;
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    background: #e53935;
    border-radius: 50%;
    animation: pulse 1s ease infinite;
}

.sa-feedback-mic-recording {
    background: rgba(229, 57, 53, 0.1);
    color: #e53935;
}

.sa-feedback-mic-recording .sa-mic-recording-indicator {
    display: block;
}

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

/* Submit Button */
.sa-feedback-submit {
    width: 100%;
    padding: 12px 20px;
    background: var(--sa-orange);
    color: white;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.sa-feedback-submit:hover:not(:disabled) {
    background: var(--sa-orange-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(199, 51, 20, 0.3);
}

.sa-feedback-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Success State */
.sa-feedback-success {
    position: absolute;
    inset: 0;
    background: var(--sa-beige);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.sa-feedback-success svg {
    width: 48px;
    height: 48px;
    color: #43a047;
    stroke-width: 2.5;
}

.sa-feedback-success span {
    font-size: 16px;
    font-weight: 500;
    color: var(--sa-brown);
}

.sa-feedback-success-visible {
    opacity: 1;
    visibility: visible;
}

.sa-feedback-submitted .sa-feedback-header,
.sa-feedback-submitted .sa-feedback-categories,
.sa-feedback-submitted .sa-feedback-input-container,
.sa-feedback-submitted .sa-feedback-submit {
    opacity: 0;
    visibility: hidden;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    #sa-feedback-widget {
        right: 10px;
        top: 8px;
    }
    
    .sa-feedback-panel {
        width: calc(100vw - 30px);
        max-width: 340px;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    #sa-feedback-widget,
    #sa-feedback-widget * {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}

/* Print - Hide Widget */
@media print {
    #sa-feedback-widget {
        display: none !important;
    }
}
