/**
 * Kimfay Feedback Form Styles
 * 
 * Mobile-first responsive CSS for the feedback form
 * Breakpoints:
 * - Mobile: 320px+ (base styles)
 * - Tablet: 768px - 1024px
 * - Desktop: 1025px+
 * 
 * @package Kimfay_Feedback
 * @since 1.0.0
 */

/* ============================================
   BASE STYLES (Mobile First - 320px+)
   ============================================ */

/* Reset and Base */
.kimfay-feedback-wrapper {
    width: 100%;
    padding: 16px;
    box-sizing: border-box;
}

.kimfay-feedback-wrapper *,
.kimfay-feedback-wrapper *::before,
.kimfay-feedback-wrapper *::after {
    box-sizing: border-box;
}

.kimfay-feedback-container {
    max-width: 1200px;
    margin: 0 auto;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 20px;
}

/* Header */
.kimfay-feedback-header {
    margin-bottom: 24px;
    text-align: center;
}

.kimfay-feedback-header h2 {
    font-size: 24px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 12px 0;
    line-height: 1.3;
}

.kimfay-feedback-description {
    font-size: 14px;
    color: #666666;
    margin: 0;
    line-height: 1.5;
}

/* Success Message */
.kimfay-feedback-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 6px;
    padding: 16px;
    margin-bottom: 24px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.kimfay-feedback-success .success-icon {
    font-size: 24px;
    color: #155724;
    flex-shrink: 0;
}

.kimfay-feedback-success .success-content h3 {
    font-size: 18px;
    color: #155724;
    margin: 0 0 8px 0;
}

.kimfay-feedback-success .success-content p {
    font-size: 14px;
    color: #155724;
    margin: 0 0 8px 0;
    line-height: 1.5;
}

.kimfay-feedback-success .success-content p:last-child {
    margin-bottom: 0;
}

/* Error Message */
.kimfay-feedback-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 6px;
    padding: 16px;
    margin-bottom: 24px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.kimfay-feedback-error .error-icon {
    font-size: 24px;
    color: #721c24;
    flex-shrink: 0;
}

.kimfay-feedback-error .error-content h3 {
    font-size: 18px;
    color: #721c24;
    margin: 0 0 8px 0;
}

.kimfay-feedback-error .error-content p {
    font-size: 14px;
    color: #721c24;
    margin: 0;
    line-height: 1.5;
}

/* Form Sections */
.form-section {
    border: none;
    padding: 0;
    margin: 0 0 24px 0;
}

.form-section legend {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 16px;
    padding: 0;
    width: 100%;
}

/* Required Indicator */
.required {
    color: #dc3545;
    font-weight: bold;
}

/* Complaint Type Selection */
.complaint-type-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.complaint-type-option {
    display: flex;
    align-items: flex-start;
    padding: 16px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    /* Touch-friendly minimum height */
    min-height: 60px;
}

.complaint-type-option:hover {
    border-color: #0066cc;
    background-color: #f8f9fa;
}

.complaint-type-option input[type="radio"] {
    /* Touch-friendly size */
    width: 20px;
    height: 20px;
    margin: 2px 12px 0 0;
    flex-shrink: 0;
    cursor: pointer;
}

.complaint-type-option input[type="radio"]:checked + .option-label {
    color: #0066cc;
}

.complaint-type-option input[type="radio"]:checked {
    accent-color: #0066cc;
}

.complaint-type-option:has(input[type="radio"]:checked) {
    border-color: #0066cc;
    background-color: #e7f3ff;
}

.option-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.option-title {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
}

.option-description {
    font-size: 13px;
    color: #666666;
    line-height: 1.4;
}

/* Service Category Selection */
.service-category-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.service-category-option {
    display: flex;
    align-items: center;
    padding: 14px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    /* Touch-friendly minimum height */
    min-height: 48px;
}

.service-category-option:hover {
    border-color: #0066cc;
    background-color: #f8f9fa;
}

.service-category-option input[type="radio"] {
    /* Touch-friendly size */
    width: 20px;
    height: 20px;
    margin: 0 12px 0 0;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: #0066cc;
}

.service-category-option:has(input[type="radio"]:checked) {
    border-color: #0066cc;
    background-color: #e7f3ff;
}

.category-label {
    font-size: 15px;
    color: #1a1a1a;
    font-weight: 500;
}

.no-categories-message {
    padding: 16px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 6px;
    color: #856404;
    font-size: 14px;
    margin: 0;
}

/* Product Selector */
.product-selector-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.product-search-wrapper {
    position: relative;
    width: 100%;
}

.product-search-input {
    width: 100%;
    padding: 12px 40px 12px 12px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    font-size: 15px;
    /* Touch-friendly height */
    min-height: 48px;
    transition: border-color 0.2s ease;
}

.product-search-input:focus {
    outline: none;
    border-color: #0066cc;
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    color: #666666;
    pointer-events: none;
}

.product-category-filter-wrapper {
    width: 100%;
}

.product-category-filter {
    width: 100%;
    padding: 12px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    font-size: 15px;
    background-color: #ffffff;
    /* Touch-friendly height */
    min-height: 48px;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.product-category-filter:focus {
    outline: none;
    border-color: #0066cc;
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

/* Product List */
.product-list-wrapper {
    margin-bottom: 16px;
}

.product-list-loading,
.product-list-error {
    padding: 24px;
    text-align: center;
    background: #f8f9fa;
    border-radius: 6px;
}

.product-list-loading .spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid #dee2e6;
    border-top-color: #0066cc;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.product-list-error .error-text {
    color: #721c24;
    margin-bottom: 12px;
}

.product-list-error .retry-button {
    padding: 10px 20px;
    background: #0066cc;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    /* Touch-friendly size */
    min-height: 44px;
    min-width: 100px;
}

.product-list {
    max-height: 300px;
    overflow-y: auto;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    background: #ffffff;
}

.product-list-item {
    padding: 14px;
    border-bottom: 1px solid #dee2e6;
    cursor: pointer;
    transition: background-color 0.2s ease;
    /* Touch-friendly minimum height */
    min-height: 52px;
    display: flex;
    align-items: center;
}

.product-list-item:last-child {
    border-bottom: none;
}

.product-list-item:hover {
    background-color: #f8f9fa;
}

.product-list-item.selected {
    background-color: #e7f3ff;
    border-left: 4px solid #0066cc;
}

.product-list-item input[type="checkbox"] {
    /* Touch-friendly size */
    width: 20px;
    height: 20px;
    margin-right: 12px;
    cursor: pointer;
    accent-color: #0066cc;
}

.product-name {
    font-size: 15px;
    color: #1a1a1a;
    font-weight: 500;
}

.product-category {
    font-size: 13px;
    color: #666666;
    margin-top: 2px;
}

.no-products-message {
    padding: 24px;
    text-align: center;
    color: #666666;
    font-size: 14px;
}

/* Selected Products Display */
.selected-products-wrapper {
    margin-top: 16px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 6px;
}

.selected-products-wrapper h4 {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 12px 0;
}

.selected-products-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.selected-product-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    /* Touch-friendly minimum height */
    min-height: 44px;
}

.selected-product-name {
    font-size: 14px;
    color: #1a1a1a;
    flex: 1;
}

.remove-product-button {
    background: transparent;
    border: none;
    color: #dc3545;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    /* Touch-friendly size */
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-product-button:hover {
    color: #c82333;
}

/* Form Fields */
.form-row {
    margin-bottom: 20px;
}

.form-row-two-cols,
.form-row-three-cols {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-field {
    display: flex;
    flex-direction: column;
}

.form-field label {
    font-size: 15px;
    font-weight: 500;
    color: #1a1a1a;
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    padding: 12px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    font-size: 15px;
    font-family: inherit;
    /* Touch-friendly height */
    min-height: 48px;
    transition: border-color 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: #0066cc;
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.form-control:invalid:not(:placeholder-shown) {
    border-color: #dc3545;
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
    line-height: 1.5;
}

/* Field Help Text */
.field-help {
    font-size: 13px;
    color: #666666;
    margin-top: 6px;
    line-height: 1.4;
}

/* Field Error Messages */
.field-error {
    display: block;
    font-size: 13px;
    color: #dc3545;
    margin-top: 6px;
    min-height: 0;
}

.field-error:empty {
    display: none;
}

/* Image Upload */
.file-upload-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px;
    border: 2px dashed #dee2e6;
    border-radius: 6px;
    background: #f8f9fa;
    cursor: pointer;
    transition: all 0.2s ease;
    /* Touch-friendly height */
    min-height: 60px;
}

.file-upload-label:hover {
    border-color: #0066cc;
    background-color: #e7f3ff;
}

.file-upload-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.upload-icon {
    font-size: 24px;
}

.upload-text {
    font-size: 15px;
    font-weight: 500;
    color: #0066cc;
}

/* Image Preview */
.image-preview-wrapper {
    margin-top: 16px;
}

.image-preview-wrapper h4 {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 12px 0;
}

.image-preview-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
}

.image-preview-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid #dee2e6;
}

.image-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.remove-image-button {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(220, 53, 69, 0.9);
    color: #ffffff;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    /* Touch-friendly size */
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    padding: 0;
}

.remove-image-button:hover {
    background: rgba(200, 35, 51, 0.9);
}

/* Form Actions */
.form-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 32px;
    margin-bottom: 16px;
}

.submit-button,
.reset-button {
    width: 100%;
    padding: 14px 24px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    /* Touch-friendly height */
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.submit-button {
    background: #0066cc;
    color: #ffffff;
}

.submit-button:hover:not(:disabled) {
    background: #0052a3;
}

.submit-button:disabled {
    background: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

.button-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #ffffff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.reset-button {
    background: #ffffff;
    color: #6c757d;
    border: 2px solid #dee2e6;
}

.reset-button:hover {
    background: #f8f9fa;
    border-color: #6c757d;
}

/* Required Notice */
.required-notice {
    font-size: 13px;
    color: #666666;
    text-align: center;
    margin: 0;
}

/* Screen Reader Only */
.screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ============================================
   TABLET STYLES (768px - 1024px)
   ============================================ */

@media screen and (min-width: 768px) {
    .kimfay-feedback-wrapper {
        padding: 24px;
    }

    .kimfay-feedback-container {
        padding: 32px;
    }

    .kimfay-feedback-header h2 {
        font-size: 28px;
    }

    .kimfay-feedback-description {
        font-size: 15px;
    }

    /* Two-column layout for complaint type options */
    .complaint-type-options {
        flex-direction: row;
        gap: 16px;
    }

    .complaint-type-option {
        flex: 1;
    }

    /* Two-column layout for form rows */
    .form-row-two-cols {
        flex-direction: row;
    }

    .form-row-two-cols .form-field {
        flex: 1;
    }

    /* Three-column layout for order info */
    .form-row-three-cols {
        flex-direction: row;
    }

    .form-row-three-cols .form-field {
        flex: 1;
    }

    /* Product selector controls side by side */
    .product-selector-controls {
        flex-direction: row;
        gap: 16px;
    }

    .product-search-wrapper {
        flex: 2;
    }

    .product-category-filter-wrapper {
        flex: 1;
    }

    /* Image preview grid - more columns */
    .image-preview-list {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 16px;
    }

    /* Form actions side by side */
    .form-actions {
        flex-direction: row;
        justify-content: flex-start;
    }

    .submit-button {
        width: auto;
        min-width: 200px;
    }

    .reset-button {
        width: auto;
        min-width: 150px;
    }

    /* Service categories in two columns */
    .service-category-options {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}

/* ============================================
   DESKTOP STYLES (1025px+)
   ============================================ */

@media screen and (min-width: 1025px) {
    .kimfay-feedback-wrapper {
        padding: 32px;
    }

    .kimfay-feedback-container {
        padding: 40px;
    }

    .kimfay-feedback-header {
        text-align: left;
    }

    .kimfay-feedback-header h2 {
        font-size: 32px;
    }

    .kimfay-feedback-description {
        font-size: 16px;
    }

    /* Larger touch targets not needed on desktop */
    .complaint-type-option,
    .service-category-option {
        min-height: auto;
    }

    .form-control,
    .product-search-input,
    .product-category-filter {
        min-height: 44px;
    }

    .submit-button,
    .reset-button {
        min-height: 48px;
    }

    /* Product list taller on desktop */
    .product-list {
        max-height: 400px;
    }

    /* Image preview grid - even more columns */
    .image-preview-list {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 20px;
    }

    /* Hover effects more prominent on desktop */
    .complaint-type-option:hover,
    .service-category-option:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    }

    .submit-button:hover:not(:disabled) {
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 102, 204, 0.3);
    }

    /* Service categories in three columns on large screens */
    .service-category-options {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ============================================
   ACCESSIBILITY ENHANCEMENTS
   ============================================ */

/* Focus visible for keyboard navigation */
*:focus-visible {
    outline: 3px solid #0066cc;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .complaint-type-option,
    .service-category-option,
    .form-control {
        border-width: 3px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    .kimfay-feedback-container {
        background: #1a1a1a;
        color: #e0e0e0;
    }

    .kimfay-feedback-header h2,
    .form-section legend,
    .form-field label,
    .option-title,
    .category-label {
        color: #ffffff;
    }

    .kimfay-feedback-description,
    .option-description,
    .field-help {
        color: #b0b0b0;
    }

    .form-control,
    .product-search-input,
    .product-category-filter {
        background: #2a2a2a;
        border-color: #444444;
        color: #e0e0e0;
    }

    .complaint-type-option,
    .service-category-option {
        border-color: #444444;
        background: #2a2a2a;
    }

    .complaint-type-option:hover,
    .service-category-option:hover {
        background: #333333;
    }

    .product-list {
        background: #2a2a2a;
        border-color: #444444;
    }

    .product-list-item {
        border-bottom-color: #444444;
    }

    .product-list-item:hover {
        background: #333333;
    }
}

/* Print styles */
@media print {
    .kimfay-feedback-wrapper {
        padding: 0;
    }

    .kimfay-feedback-container {
        box-shadow: none;
    }

    .form-actions,
    .reset-button {
        display: none;
    }
}
