/**
 * Supplement Review Form - Professional Black & White Theme
 * Clean, minimal design focused on readability and usability
 * 
 * @package SupplementReviewPlugin
 * @version 2.0.0
 */

/* ============================================================================
   CSS Variables (Black & White Professional Theme)
   ============================================================================ */
:root {
    --rsp-primary-color: #000000 !important;
    --rsp-secondary-color: #333333 !important;
    --rsp-accent-color: #666666 !important;
    --rsp-text-color: #1a1a1a !important;
    --rsp-background-color: #ffffff !important;
    --rsp-border-color: #e0e0e0 !important;
    --rsp-button-hover-color: #333333 !important;
    --rsp-star-color: #000000 !important;
    --rsp-success-color: #2d2d2d !important;
    --rsp-error-color: #000000 !important;
    --rsp-light-gray: #f5f5f5 !important;
    --rsp-medium-gray: #999999 !important;
    --rsp-dark-gray: #4a4a4a !important;
}

/* Force override any inline styles */
.rsp-form-wrapper * {
    box-sizing: border-box;
}

/* ============================================================================
   Form Wrapper & Container
   ============================================================================ */
.rsp-form-wrapper {
    max-width: 1000px;
    margin: 40px auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.rsp-form-container {
    background: var(--rsp-background-color);
    border: 1px solid var(--rsp-border-color);
    padding: 60px;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================================================
   Form Header
   ============================================================================ */
.rsp-form-header {
    text-align: left;
    margin-bottom: 56px;
    padding-bottom: 40px;
    border-bottom: 3px solid var(--rsp-primary-color);
    position: relative;
}

.rsp-form-header::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 80px;
    height: 3px;
    background: var(--rsp-primary-color);
}

.rsp-form-title {
    font-size: 36px;
    font-weight: 700;
    color: var(--rsp-primary-color);
    margin: 0 0 16px 0;
    line-height: 1.2;
    letter-spacing: -1px;
    text-transform: uppercase;
}

.rsp-icon {
    display: none;
}

.rsp-form-description {
    font-size: 16px;
    color: var(--rsp-dark-gray);
    line-height: 1.7;
    margin: 0;
    font-weight: 400;
    max-width: 700px;
}

.required {
    color: var(--rsp-primary-color);
    font-weight: 700;
    font-size: 16px;
}

/* ============================================================================
   Message Container
   ============================================================================ */
.rsp-message-container {
    margin-bottom: 32px;
}

.rsp-message {
    padding: 16px 24px;
    border-radius: 0;
    font-size: 14px;
    font-weight: 500;
    border-left: 3px solid var(--rsp-primary-color);
    background: var(--rsp-light-gray);
    color: var(--rsp-text-color);
}

.rsp-success {
    border-left-color: var(--rsp-primary-color);
}

.rsp-error {
    border-left-color: var(--rsp-primary-color);
}

/* ============================================================================
   Form Sections
   ============================================================================ */
.rsp-section {
    margin-bottom: 56px;
    padding: 48px 0;
    border-bottom: 2px solid var(--rsp-border-color);
    transition: none;
}

.rsp-section:last-of-type {
    border-bottom: none;
}

.rsp-section-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--rsp-primary-color);
    margin: 0 0 32px 0;
    display: flex;
    align-items: center;
    gap: 16px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    position: relative;
    padding-bottom: 16px;
}

.rsp-section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 48px;
    width: 60px;
    height: 2px;
    background: var(--rsp-primary-color);
}

.rsp-section-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--rsp-primary-color);
    color: white;
    border-radius: 0;
    font-size: 18px;
    font-weight: 700;
    flex-shrink: 0;
}

/* ============================================================================
   Form Groups & Inputs
   ============================================================================ */
.rsp-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 0;
}

.rsp-form-group {
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
}

.rsp-col-6 {
    grid-column: span 1;
}

.rsp-col-4 {
    flex: 0 0 calc(33.333% - 16px);
}

.rsp-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--rsp-text-color);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.4;
    min-height: 18px;
}

.rsp-optional {
    color: var(--rsp-medium-gray);
    font-weight: 400;
    font-size: 11px;
    text-transform: none;
}

.rsp-input,
.rsp-select,
.rsp-textarea {
    width: 100%;
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--rsp-text-color);
    background: var(--rsp-background-color);
    border: 1px solid var(--rsp-border-color);
    border-radius: 0;
    transition: all 0.2s ease;
    font-family: inherit;
    box-sizing: border-box;
}

.rsp-select {
    height: 46px;
    appearance: none;
    background-image: url('data:image/svg+xml;charset=UTF-8,%3csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"%3e%3cpolyline points="6 9 12 15 18 9"%3e%3c/polyline%3e%3c/svg%3e');
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

.rsp-input {
    height: 46px;
}

.rsp-input:focus,
.rsp-select:focus,
.rsp-textarea:focus {
    outline: none;
    border-color: var(--rsp-primary-color);
    box-shadow: none;
}

.rsp-input::placeholder,
.rsp-textarea::placeholder {
    color: var(--rsp-medium-gray);
}

.rsp-textarea {
    resize: vertical;
    min-height: 100px;
    line-height: 1.6;
}

.rsp-hint,
.rsp-help-text {
    display: block;
    font-size: 12px;
    color: var(--rsp-medium-gray);
    margin-top: 6px;
    font-style: italic;
}

/* Error States */
.rsp-input.rsp-error,
.rsp-select.rsp-error,
.rsp-textarea.rsp-error {
    border-color: var(--rsp-primary-color);
    background: var(--rsp-light-gray);
}

.rsp-form-group.rsp-error .rsp-label {
    color: var(--rsp-primary-color);
}

/* ============================================================================
   Star Rating
   ============================================================================ */
.rsp-star-rating {
    display: inline-flex;
    gap: 4px;
    margin-top: 4px;
}

.rsp-star {
    font-size: 28px;
    color: var(--rsp-border-color);
    cursor: pointer;
    transition: color 0.2s ease;
    user-select: none;
}

.rsp-star:hover,
.rsp-star.active {
    color: var(--rsp-primary-color);
}

.rsp-rating-text {
    font-size: 12px;
    color: var(--rsp-medium-gray);
    font-weight: 400;
    margin-top: 6px;
}

/* ============================================================================
   File Upload
   ============================================================================ */
.rsp-file-upload {
    position: relative;
}

.rsp-file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.rsp-file-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 24px;
    border: 3px dashed var(--rsp-border-color);
    border-radius: 12px;
    background: rgba(37, 99, 235, 0.02);
    cursor: pointer;
    transition: all 0.3s ease;
}

.rsp-file-label:hover {
    border-color: var(--rsp-primary-color);
    background: rgba(37, 99, 235, 0.05);
}

.rsp-file-icon {
    font-size: 32px;
}

.rsp-file-text {
    font-size: 15px;
    font-weight: 500;
    color: var(--rsp-text-color);
}

.rsp-photo-preview {
    margin-top: 16px;
    position: relative;
    display: inline-block;
}

.rsp-preview-image {
    max-width: 200px;
    max-height: 200px;
    border-radius: 0;
    border: 1px solid var(--rsp-border-color);
}

.rsp-remove-photo {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 24px;
    height: 24px;
    background: var(--rsp-primary-color);
    color: white;
    border: none;
    border-radius: 0;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.rsp-remove-photo:hover {
    background: var(--rsp-secondary-color);
}

/* ============================================================================
   Submit Button
   ============================================================================ */
.rsp-form-footer {
    text-align: center;
    padding-top: 48px;
    margin-top: 24px;
    border-top: 1px solid var(--rsp-border-color);
}

.rsp-submit-btn,
.rsp-form-actions .rsp-submit-btn {
    background: var(--rsp-primary-color);
    color: white;
    font-size: 14px;
    font-weight: 600;
    padding: 16px 48px;
    border: none;
    border-radius: 0;
    cursor: pointer;
    transition: background 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.rsp-submit-btn:hover {
    background: var(--rsp-secondary-color);
}

.rsp-submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.rsp-btn-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.rsp-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.rsp-privacy-notice,
.rsp-privacy-note {
    margin-top: 20px;
    font-size: 12px;
    color: var(--rsp-medium-gray);
    line-height: 1.6;
}

/* ============================================================================
   Responsive Design
   ============================================================================ */
@media (max-width: 768px) {
    .rsp-form-container {
        padding: 30px 20px;
    }
    
    .rsp-form-title {
        font-size: 24px;
    }
    
    .rsp-form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
    
    .rsp-col-6,
    .rsp-col-4 {
        grid-column: span 1;
        width: 100%;
    }
    
    .rsp-section {
        padding: 24px 0;
    }
    
    .rsp-section-title {
        font-size: 16px;
    }
    
    .rsp-submit-btn {
        width: 100%;
        padding: 14px 32px;
    }
}
    }
    
    .rsp-form-title {
        font-size: 28px;
    }
    
    .rsp-form-row {
        grid-template-columns: 1fr;
    }
    
    .rsp-col-6 {
        grid-column: span 1;
    }
    
    .rsp-section {
        padding: 20px;
    }
    
    .rsp-section-title {
        font-size: 20px;
    }
    
    .rsp-submit-btn {
        width: 100%;
        padding: 16px 32px;
    }
}

@media (max-width: 480px) {
    .rsp-form-wrapper {
        padding: 12px;
    }
    
    .rsp-form-container {
        padding: 16px;
        border-radius: 12px;
    }
    
    .rsp-form-title {
        font-size: 24px;
        flex-direction: column;
        gap: 8px;
    }
    
    .rsp-icon {
        font-size: 32px;
    }
    
    .rsp-star {
        font-size: 28px;
    }
}

/* ============================================================================
   Dark Mode Support
   ============================================================================ */
@media (prefers-color-scheme: dark) {
    .rsp-form-container {
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    }
}

/* ============================================================================
   Print Styles
   ============================================================================ */
@media print {
    .rsp-submit-btn,
    .rsp-file-upload {
        display: none;
    }
}

/* ============================================================================
   Comprehensive Form Additions - Version 2.0
   ============================================================================ */

/* Checkbox Groups */
.rsp-checkbox-group {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.rsp-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--rsp-background-color);
    border: 1px solid var(--rsp-border-color);
    border-radius: 0;
    cursor: pointer;
    transition: border-color 0.2s ease;
    font-size: 13px;
}

.rsp-checkbox-label:hover {
    border-color: var(--rsp-primary-color);
}

.rsp-checkbox-label input[type="checkbox"],
.rsp-checkbox-label input[type="radio"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--rsp-primary-color);
}

/* Radio Groups */
.rsp-radio-group {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.rsp-radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--rsp-background-color);
    border: 1px solid var(--rsp-border-color);
    border-radius: 0;
    cursor: pointer;
    transition: border-color 0.2s ease;
    font-size: 13px;
    font-weight: 500;
}

.rsp-radio-label:hover {
    border-color: var(--rsp-primary-color);
}

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

/* Disclosure Box */
.rsp-disclosure-box {
    background: var(--rsp-light-gray);
    border: 1px solid var(--rsp-border-color);
    border-radius: 0;
    padding: 20px;
    margin-top: 12px;
}

.rsp-disclosure-box .rsp-checkbox-label {
    border: none;
    padding: 0;
    background: transparent;
    font-size: 14px;
    margin-bottom: 8px;
    font-weight: 600;
}

.rsp-disclosure-box .rsp-checkbox-label:hover {
    background: transparent;
}

.rsp-disclosure-text {
    margin: 8px 0 0 24px;
    font-size: 13px;
    color: var(--rsp-medium-gray);
    line-height: 1.6;
}

/* Category-Specific Sections */
.category-ratings-group {
    /* No animations */
}

/* Caution Fields (Side Effects, Interactions) */
.rsp-caution-field {
    border: 1px solid var(--rsp-primary-color) !important;
    background: var(--rsp-light-gray) !important;
}

.rsp-caution-field:focus {
    border-color: var(--rsp-primary-color) !important;
    background: var(--rsp-background-color) !important;
}

.rsp-caution-text {
    display: block;
    margin-top: 8px;
    color: var(--rsp-text-color);
    font-weight: 500;
    font-size: 12px;
}

/* Info Box */
.rsp-info-box {
    background: var(--rsp-light-gray);
    border: 1px solid var(--rsp-border-color);
    border-radius: 0;
    padding: 20px;
    margin-top: 16px;
}

.rsp-info-box strong {
    color: var(--rsp-primary-color);
    font-size: 14px;
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
}

.rsp-info-box ul {
    margin: 10px 0 0 20px;
    padding: 0;
}

.rsp-info-box li {
    margin: 6px 0;
    color: var(--rsp-text-color);
    line-height: 1.5;
    font-size: 13px;
}

.rsp-info-box li {
    margin: 6px 0;
    color: #1e40af;
    line-height: 1.5;
}

/* Large Textarea */
.rsp-large-textarea {
    min-height: 180px;
    font-size: 15px;
    line-height: 1.7;
}

/* Character Counter */
.rsp-char-counter {
    display: block;
    text-align: right;
    margin-top: 6px;
    font-size: 12px;
    color: #9ca3af;
}

/* Privacy Note */
.rsp-privacy-note {
    text-align: center;
    font-size: 14px;
    color: #6b7280;
    margin-top: 20px;
    line-height: 1.6;
}

/* Column Layouts */
.rsp-col-4 {
    flex: 0 0 calc(33.333% - 13.333px);
}

@media (max-width: 768px) {
    .rsp-col-4 {
        flex: 0 0 100%;
    }
}

/* Enhanced Star Ratings for Category-Specific */
.category-ratings-group .rsp-star-rating {
    margin-top: 8px;
}

.category-ratings-group .rsp-form-group {
    margin-bottom: 24px;
}

/* Help Text Enhancements */
.rsp-help-text {
    display: block;
    margin-top: 8px;
    font-size: 13px;
    color: #6b7280;
    font-style: italic;
}

/* Error States for Checkboxes and Radios */
.rsp-checkbox-label.rsp-error,
.rsp-radio-label.rsp-error {
    border-color: var(--rsp-error-color);
    background: #fef2f2;
}

/* Loading Spinner Enhancement */
.rsp-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Button Loader */
.rsp-btn-loader {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Section Number Badge Enhancement */
.rsp-section-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--rsp-primary-color), var(--rsp-secondary-color));
    color: white;
    border-radius: 50%;
    font-size: 18px;
    font-weight: 700;
    margin-right: 12px;
}

/* Smooth Transitions */
.rsp-section {
    transition: all 0.3s ease;
}

.rsp-section:hover {
    transform: translateX(4px);
}

/* Focus Visible for Accessibility */
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 3px solid var(--rsp-primary-color);
    outline-offset: 2px;
}

/* Required Field Indicator Enhancement */
.rsp-label .required {
    margin-left: 4px;
    font-size: 18px;
}

/* Photo Preview Enhancement */
.rsp-photo-preview {
    position: relative;
    margin-top: 16px;
}

.rsp-photo-preview img {
    max-width: 300px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.rsp-remove-photo {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--rsp-error-color);
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.rsp-remove-photo:hover {
    background: #dc2626;
    transform: scale(1.1);
}

/* Responsive Grid Improvements */
@media (max-width: 640px) {
    .rsp-checkbox-group {
        grid-template-columns: 1fr;
    }
    
    .rsp-radio-group {
        flex-direction: column;
    }
    
    .rsp-radio-label {
        width: 100%;
    }
}

/* Accessibility: Screen Reader Only */
.rsp-rsp-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}
