/**
 * Modern RFQ Form - Frontend Styles
 *
 * Glassmorphism design with gradient accents
 * Beautiful animations and responsive layout
 *
 * @package Modern_RFQ_Form
 * @since 1.0.0
 */

/* ============================================
   CSS Custom Properties (Variables)
   ============================================ */
:root {
    --mrf-primary: #667eea;
    --mrf-secondary: #764ba2;
    --mrf-success: #10b981;
    --mrf-error: #e74c3c;
    --mrf-text: #333333;
    --mrf-text-light: #666666;
    --mrf-border: #e0e0e0;
    --mrf-bg-light: #f8f9ff;
    --mrf-white: #ffffff;
    --mrf-shadow: rgba(0, 0, 0, 0.15);
    --mrf-shadow-strong: rgba(0, 0, 0, 0.25);
    --mrf-radius: 12px;
    --mrf-radius-sm: 8px;
    --mrf-transition: 0.3s ease;
}

/* ============================================
   RFQ Button Wrapper
   ============================================ */
.mrf-button-wrapper {
    width: 100%;
    margin: 15px 0;
    clear: both;
}

/* ============================================
   RFQ Trigger Button - Base Styles
   ============================================ */
.mrf-trigger-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 16px 24px;
    border-radius: var(--mrf-radius-sm);
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all var(--mrf-transition);
    font-family: inherit;
    line-height: 1.4;
    text-decoration: none;
    text-align: center;
    box-sizing: border-box;
}

/* Gradient Style (Default) */
.mrf-trigger-btn.mrf-btn-style-gradient,
.mrf-trigger-btn:not([class*="mrf-btn-style-"]) {
    background: linear-gradient(135deg, var(--mrf-primary) 0%, var(--mrf-secondary) 100%);
    color: var(--mrf-white);
    border: none;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.mrf-trigger-btn.mrf-btn-style-gradient:hover,
.mrf-trigger-btn:not([class*="mrf-btn-style-"]):hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.45);
}

.mrf-trigger-btn.mrf-btn-style-gradient:active,
.mrf-trigger-btn:not([class*="mrf-btn-style-"]):active {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

/* Solid Style */
.mrf-trigger-btn.mrf-btn-style-solid {
    background: var(--mrf-primary);
    color: var(--mrf-white);
    border: none;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.25);
}

.mrf-trigger-btn.mrf-btn-style-solid:hover {
    background: var(--mrf-secondary);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.35);
}

.mrf-trigger-btn.mrf-btn-style-solid:active {
    transform: translateY(0);
}

/* Outline Style */
.mrf-trigger-btn.mrf-btn-style-outline {
    background: transparent;
    color: var(--mrf-primary);
    border: 2px solid var(--mrf-primary);
    box-shadow: none;
}

.mrf-trigger-btn.mrf-btn-style-outline:hover {
    background: var(--mrf-primary);
    color: var(--mrf-white);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.mrf-trigger-btn.mrf-btn-style-outline:active {
    transform: translateY(0);
}

/* Focus State for All Styles */
.mrf-trigger-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3), 0 4px 15px rgba(102, 126, 234, 0.3);
}

.mrf-trigger-btn.mrf-btn-style-outline:focus {
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

/* Button Icon */
.mrf-btn-icon {
    margin-right: 10px;
    font-size: 16px;
    line-height: 1;
}

/* Button Label */
.mrf-btn-label {
    line-height: 1;
}

/* ============================================
   Modal Overlay
   ============================================ */
.mrf-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: all var(--mrf-transition);
    box-sizing: border-box;
}

.mrf-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ============================================
   Modal Container
   ============================================ */
.mrf-modal {
    position: relative;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    background: var(--mrf-white);
    border-radius: var(--mrf-radius);
    box-shadow: 0 20px 60px var(--mrf-shadow);
    overflow: hidden;
    transform: translateY(30px) scale(0.95);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mrf-modal-overlay.active .mrf-modal {
    transform: translateY(0) scale(1);
}

/* ============================================
   Modal Header
   ============================================ */
.mrf-modal-header {
    position: relative;
    background: linear-gradient(135deg, var(--mrf-primary) 0%, var(--mrf-secondary) 100%);
    padding: 25px 30px;
    color: var(--mrf-white);
}

.mrf-modal-header h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
    letter-spacing: 0.3px;
    color: var(--mrf-white);
}

.mrf-modal-header p {
    margin: 8px 0 0;
    font-size: 14px;
    opacity: 0.9;
}

.mrf-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    color: var(--mrf-white);
    font-size: 20px;
    font-weight: 300;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--mrf-transition);
    line-height: 1;
}

.mrf-close-btn:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: rotate(90deg);
}

.mrf-close-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.4);
}

/* ============================================
   Modal Body (Form Container)
   ============================================ */
.mrf-modal-body {
    padding: 30px;
    max-height: calc(90vh - 100px);
    overflow-y: auto;
}

/* Custom scrollbar */
.mrf-modal-body::-webkit-scrollbar {
    width: 6px;
}

.mrf-modal-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.mrf-modal-body::-webkit-scrollbar-thumb {
    background: var(--mrf-border);
    border-radius: 3px;
}

.mrf-modal-body::-webkit-scrollbar-thumb:hover {
    background: #bbb;
}

/* ============================================
   Form Styles
   ============================================ */
.mrf-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Form Group */
.mrf-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Labels */
.mrf-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--mrf-text);
    display: flex;
    align-items: center;
    gap: 4px;
}

.mrf-required {
    color: var(--mrf-error);
    font-weight: 600;
}

/* Input Fields */
.mrf-input,
.mrf-textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--mrf-border);
    border-radius: var(--mrf-radius-sm);
    font-size: 14px;
    font-family: inherit;
    color: var(--mrf-text);
    background: var(--mrf-white);
    transition: all var(--mrf-transition);
    box-sizing: border-box;
}

.mrf-input::placeholder,
.mrf-textarea::placeholder {
    color: #999;
}

.mrf-input:hover,
.mrf-textarea:hover {
    border-color: #ccc;
}

.mrf-input:focus,
.mrf-textarea:focus {
    outline: none;
    border-color: var(--mrf-primary);
    background: var(--mrf-bg-light);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

/* Textarea specific */
.mrf-textarea {
    min-height: 100px;
    resize: vertical;
    line-height: 1.5;
}

/* Error state */
.mrf-input.mrf-error,
.mrf-textarea.mrf-error {
    border-color: var(--mrf-error);
    background: #fef5f5;
}

.mrf-input.mrf-error:focus,
.mrf-textarea.mrf-error:focus {
    box-shadow: 0 0 0 4px rgba(231, 76, 60, 0.1);
}

/* Error messages */
.mrf-error-message {
    font-size: 12px;
    color: var(--mrf-error);
    display: none;
    align-items: center;
    gap: 5px;
    margin-top: 2px;
}

.mrf-error-message::before {
    content: "!";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background: var(--mrf-error);
    color: var(--mrf-white);
    border-radius: 50%;
    font-size: 10px;
    font-weight: 700;
}

.mrf-form-group.has-error .mrf-error-message {
    display: flex;
}

/* ============================================
   Checkbox Styles
   ============================================ */
.mrf-checkbox-group {
    flex-direction: row;
    align-items: center;
    gap: 10px;
}

.mrf-checkbox {
    width: 20px;
    height: 20px;
    accent-color: var(--mrf-primary);
    cursor: pointer;
    flex-shrink: 0;
}

.mrf-checkbox-label {
    font-size: 14px;
    color: var(--mrf-text-light);
    cursor: pointer;
    user-select: none;
}

/* Custom checkbox styling */
.mrf-checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.mrf-checkbox-wrapper input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.mrf-checkbox-custom {
    width: 20px;
    height: 20px;
    border: 2px solid var(--mrf-border);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--mrf-transition);
    flex-shrink: 0;
}

.mrf-checkbox-wrapper:hover .mrf-checkbox-custom {
    border-color: var(--mrf-primary);
}

.mrf-checkbox-wrapper input[type="checkbox"]:checked + .mrf-checkbox-custom {
    background: linear-gradient(135deg, var(--mrf-primary) 0%, var(--mrf-secondary) 100%);
    border-color: transparent;
}

.mrf-checkbox-custom::after {
    content: "";
    width: 5px;
    height: 10px;
    border: solid var(--mrf-white);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) scale(0);
    transition: transform 0.2s ease;
}

.mrf-checkbox-wrapper input[type="checkbox"]:checked + .mrf-checkbox-custom::after {
    transform: rotate(45deg) scale(1);
}

/* ============================================
   Submit Button
   ============================================ */
.mrf-submit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 16px 24px;
    margin-top: 10px;
    background: linear-gradient(135deg, var(--mrf-primary) 0%, var(--mrf-secondary) 100%);
    color: var(--mrf-white);
    border: none;
    border-radius: var(--mrf-radius-sm);
    font-size: 15px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all var(--mrf-transition);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    font-family: inherit;
}

.mrf-submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.45);
}

.mrf-submit-btn:active:not(:disabled) {
    transform: translateY(0);
}

.mrf-submit-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3), 0 4px 15px rgba(102, 126, 234, 0.3);
}

.mrf-submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Loading Spinner */
.mrf-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--mrf-white);
    border-radius: 50%;
    animation: mrf-spin 0.8s linear infinite;
    display: none;
}

.mrf-submit-btn.loading .mrf-spinner {
    display: block;
}

.mrf-submit-btn.loading .mrf-btn-text {
    display: none;
}

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

/* ============================================
   Success Overlay
   ============================================ */
.mrf-success-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.98);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    box-sizing: border-box;
    opacity: 0;
    visibility: hidden;
    transition: all var(--mrf-transition);
    z-index: 10;
}

.mrf-success-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Success Icon */
.mrf-success-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--mrf-success) 0%, #059669 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 25px;
    transform: scale(0);
    animation: mrf-scale-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    animation-delay: 0.1s;
    box-shadow: 0 10px 30px rgba(16, 185, 129, 0.3);
}

.mrf-success-icon svg {
    width: 40px;
    height: 40px;
    fill: none;
    stroke: var(--mrf-white);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.mrf-success-icon svg path {
    stroke-dasharray: 50;
    stroke-dashoffset: 50;
    animation: mrf-check-draw 0.5s ease forwards;
    animation-delay: 0.4s;
}

@keyframes mrf-scale-in {
    to {
        transform: scale(1);
    }
}

@keyframes mrf-check-draw {
    to {
        stroke-dashoffset: 0;
    }
}

/* Success Text */
.mrf-success-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--mrf-text);
    margin: 0 0 12px;
    text-align: center;
}

.mrf-success-message {
    font-size: 15px;
    color: var(--mrf-text-light);
    text-align: center;
    line-height: 1.6;
    margin: 0 0 25px;
    max-width: 320px;
}

/* Success Close Button */
.mrf-success-close-btn {
    padding: 12px 30px;
    background: var(--mrf-text);
    color: var(--mrf-white);
    border: none;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--mrf-transition);
}

.mrf-success-close-btn:hover {
    background: #555;
    transform: translateY(-2px);
}

/* ============================================
   Product Info Display
   ============================================ */
.mrf-product-info {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: var(--mrf-bg-light);
    border-radius: var(--mrf-radius-sm);
    margin-bottom: 10px;
}

.mrf-product-image {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
    background: var(--mrf-white);
    border: 1px solid var(--mrf-border);
}

.mrf-product-details {
    flex: 1;
    min-width: 0;
}

.mrf-product-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--mrf-text);
    margin: 0 0 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mrf-product-sku {
    font-size: 12px;
    color: var(--mrf-text-light);
    margin: 0;
}

/* ============================================
   Confetti Animation (Optional)
   ============================================ */
.mrf-confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    animation: mrf-confetti-fall 3s ease-out forwards;
    pointer-events: none;
}

@keyframes mrf-confetti-fall {
    0% {
        opacity: 1;
        transform: translateY(-10px) rotate(0deg);
    }
    100% {
        opacity: 0;
        transform: translateY(400px) rotate(720deg);
    }
}

/* ============================================
   Form Error State (Global)
   ============================================ */
.mrf-form-error {
    padding: 12px 15px;
    background: #fef5f5;
    border: 1px solid #fecaca;
    border-radius: var(--mrf-radius-sm);
    color: var(--mrf-error);
    font-size: 14px;
    display: none;
    align-items: center;
    gap: 10px;
}

.mrf-form-error.active {
    display: flex;
}

.mrf-form-error::before {
    content: "!";
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: var(--mrf-error);
    color: var(--mrf-white);
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

/* ============================================
   Responsive Styles
   ============================================ */
@media screen and (max-width: 768px) {
    .mrf-modal-overlay {
        padding: 15px;
        align-items: flex-end;
    }

    .mrf-modal {
        max-width: 100%;
        max-height: 95vh;
        border-radius: var(--mrf-radius) var(--mrf-radius) 0 0;
    }

    .mrf-modal-header {
        padding: 20px 25px;
    }

    .mrf-modal-header h2 {
        font-size: 20px;
        padding-right: 30px;
    }

    .mrf-modal-body {
        padding: 25px;
        max-height: calc(95vh - 90px);
    }

    .mrf-close-btn {
        width: 32px;
        height: 32px;
        font-size: 18px;
        top: 12px;
        right: 12px;
    }

    .mrf-input,
    .mrf-textarea {
        padding: 14px;
        font-size: 16px; /* Prevents iOS zoom */
    }

    .mrf-submit-btn {
        padding: 16px 20px;
        font-size: 14px;
    }

    .mrf-trigger-btn {
        padding: 14px 20px;
        font-size: 13px;
    }
}

@media screen and (max-width: 480px) {
    .mrf-modal-overlay {
        padding: 10px;
    }

    .mrf-modal-header h2 {
        font-size: 18px;
    }

    .mrf-modal-body {
        padding: 20px;
    }

    .mrf-form {
        gap: 16px;
    }

    .mrf-success-icon {
        width: 70px;
        height: 70px;
    }

    .mrf-success-title {
        font-size: 20px;
    }

    .mrf-success-message {
        font-size: 14px;
    }

    .mrf-product-info {
        padding: 12px;
    }

    .mrf-product-image {
        width: 50px;
        height: 50px;
    }
}

/* ============================================
   Accessibility
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    .mrf-modal,
    .mrf-modal-overlay,
    .mrf-success-overlay,
    .mrf-success-icon,
    .mrf-success-icon svg path,
    .mrf-close-btn,
    .mrf-trigger-btn,
    .mrf-submit-btn,
    .mrf-input,
    .mrf-textarea {
        transition: none;
        animation: none;
    }

    .mrf-success-icon {
        transform: scale(1);
    }

    .mrf-success-icon svg path {
        stroke-dashoffset: 0;
    }
}

/* Focus visible for keyboard navigation */
.mrf-input:focus-visible,
.mrf-textarea:focus-visible,
.mrf-submit-btn:focus-visible,
.mrf-trigger-btn:focus-visible,
.mrf-close-btn:focus-visible {
    outline: 2px solid var(--mrf-primary);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .mrf-input,
    .mrf-textarea {
        border-width: 3px;
    }

    .mrf-error-message {
        font-weight: 600;
    }
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
    .mrf-modal-overlay,
    .mrf-trigger-btn {
        display: none !important;
    }
}
