/**
 * RFQ Plugin Beautiful Frontend Styles
 * Modern, smooth design with Finnish language support
 */

/* CSS Variables for easy customization */
:root {
    --rfq-primary: #2DD4BF;
    --rfq-primary-dark: #14B8A6;
    --rfq-accent: #84CC16;
    --rfq-accent-dark: #65A30D;
    --rfq-success: #10B981;
    --rfq-error: #EF4444;
    --rfq-warning: #F59E0B;
    --rfq-text: #1F2937;
    --rfq-text-light: #6B7280;
    --rfq-white: #FFFFFF;
    --rfq-background: #F8FAFC;
    --rfq-border: #E2E8F0;
    --rfq-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --rfq-shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --rfq-radius: 12px;
    --rfq-radius-lg: 16px;
    --rfq-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base Styles */
.rfq-form-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Inter', sans-serif;
    max-width: 900px;
    margin: 2rem auto;
    padding: 0;
    background: linear-gradient(135deg, var(--rfq-background) 0%, #ffffff 100%);
    border-radius: var(--rfq-radius-lg);
    box-shadow: var(--rfq-shadow-lg);
    overflow: hidden;
    position: relative;
}

.rfq-form-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--rfq-primary) 0%, var(--rfq-accent) 100%);
}

/* Header */
.rfq-header {
    background: linear-gradient(135deg, var(--rfq-primary) 0%, var(--rfq-primary-dark) 100%);
    color: var(--rfq-white);
    padding: 3rem 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.rfq-header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    position: relative;
    z-index: 2;
}

.rfq-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(180deg); }
}

.rfq-form-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: relative;
    z-index: 1;
    flex: 1;
    text-align: left;
}

.rfq-instructions {
    font-size: 1.1rem;
    opacity: 0.9;
    margin: 0;
    position: relative;
    z-index: 1;
    text-align: center;
}

/* Language Switcher */
.rfq-language-switcher {
    position: relative;
    z-index: 2;
}

.rfq-language-select {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--rfq-radius);
    color: var(--rfq-white);
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--rfq-transition);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    min-width: 120px;
}

.rfq-language-select:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
}

.rfq-language-select:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.7);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.2);
}

.rfq-language-select option {
    background: var(--rfq-primary);
    color: var(--rfq-white);
    padding: 0.5rem;
}

/* Progress Indicator */
.rfq-progress {
    display: flex;
    justify-content: space-between;
    padding: 2rem;
    background: var(--rfq-white);
    position: relative;
}

.rfq-progress::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 2rem;
    right: 2rem;
    height: 2px;
    background: var(--rfq-border);
    z-index: 1;
}

.rfq-progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 2;
    cursor: pointer;
    transition: var(--rfq-transition);
}

.rfq-progress-step:hover {
    transform: translateY(-2px);
}

.step-number {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: var(--rfq-border);
    color: var(--rfq-text-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.1rem;
    transition: var(--rfq-transition);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.step-label {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--rfq-text-light);
    transition: var(--rfq-transition);
}

.rfq-progress-step.active .step-number {
    background: linear-gradient(135deg, var(--rfq-primary) 0%, var(--rfq-primary-dark) 100%);
    color: var(--rfq-white);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(45, 212, 191, 0.3);
}

.rfq-progress-step.active .step-label {
    color: var(--rfq-primary);
    font-weight: 600;
}

.rfq-progress-step.completed .step-number {
    background: var(--rfq-success);
    color: var(--rfq-white);
}

.rfq-progress-step.completed .step-label {
    color: var(--rfq-success);
}

/* Steps */
.rfq-step {
    display: none;
    padding: 2rem;
    background: var(--rfq-white);
    min-height: 400px;
}

.rfq-step.active {
    display: block;
    animation: slideIn 0.5s ease-out;
}

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

.rfq-step-title {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--rfq-text);
    margin: 0 0 1.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.rfq-step-icon {
    font-size: 2rem;
}

/* QR Scanner */
.rfq-scanner-section {
    background: var(--rfq-background);
    border-radius: var(--rfq-radius);
    padding: 2rem;
    margin: 1.5rem 0;
}

.rfq-scanner-controls {
    text-align: center;
    margin-bottom: 2rem;
}

#rfq-qr-reader {
    border-radius: var(--rfq-radius);
    overflow: hidden;
    box-shadow: var(--rfq-shadow);
    background: var(--rfq-white);
}

.rfq-scanner-help {
    background: var(--rfq-white);
    border-radius: var(--rfq-radius);
    padding: 1.5rem;
    margin-top: 1.5rem;
    border-left: 4px solid var(--rfq-primary);
}

.rfq-scanner-help h4 {
    color: var(--rfq-text);
    margin: 0 0 1rem 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.rfq-scanner-help ul {
    margin: 0;
    padding-left: 1.5rem;
    color: var(--rfq-text-light);
}

.rfq-scanner-help li {
    margin-bottom: 0.5rem;
}

/* Product Items */
.rfq-products-list {
    display: grid;
    gap: 1rem;
    margin: 1.5rem 0;
}

.rfq-product-item {
    background: var(--rfq-white);
    border: 2px solid var(--rfq-border);
    border-radius: var(--rfq-radius);
    padding: 1.5rem;
    transition: var(--rfq-transition);
    position: relative;
    overflow: hidden;
}

.rfq-product-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--rfq-primary);
    transform: scaleY(0);
    transition: var(--rfq-transition);
}

.rfq-product-item:hover {
    border-color: var(--rfq-primary);
    box-shadow: 0 8px 25px rgba(45, 212, 191, 0.15);
    transform: translateY(-2px);
}

.rfq-product-item:hover::before {
    transform: scaleY(1);
}

.rfq-product-info h4 {
    color: var(--rfq-text);
    margin: 0 0 0.5rem 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.rfq-product-info p {
    color: var(--rfq-text-light);
    margin: 0;
}

.rfq-product-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1rem;
}

.rfq-quantity {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--rfq-text);
    min-width: 2rem;
    text-align: center;
}

/* Buttons */
.rfq-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--rfq-radius);
    font-weight: 600;
    font-size: 1rem;
    text-decoration: none;
    cursor: pointer;
    transition: var(--rfq-transition);
    position: relative;
    overflow: hidden;
}

.rfq-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.rfq-btn:hover::before {
    left: 100%;
}

.rfq-btn-primary {
    background: linear-gradient(135deg, var(--rfq-primary) 0%, var(--rfq-primary-dark) 100%);
    color: var(--rfq-white);
    box-shadow: 0 4px 12px rgba(45, 212, 191, 0.3);
}

.rfq-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(45, 212, 191, 0.4);
}

.rfq-btn-secondary {
    background: var(--rfq-white);
    color: var(--rfq-text);
    border: 2px solid var(--rfq-border);
}

.rfq-btn-secondary:hover {
    border-color: var(--rfq-primary);
    color: var(--rfq-primary);
    transform: translateY(-2px);
}

.rfq-btn-large {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

/* Quantity Controls */
.rfq-qty-plus,
.rfq-qty-minus {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    border: 2px solid var(--rfq-primary);
    background: var(--rfq-white);
    color: var(--rfq-primary);
    font-weight: 600;
    cursor: pointer;
    transition: var(--rfq-transition);
}

.rfq-qty-plus:hover,
.rfq-qty-minus:hover {
    background: var(--rfq-primary);
    color: var(--rfq-white);
    transform: scale(1.1);
}

.rfq-remove-product {
    background: var(--rfq-error);
    color: var(--rfq-white);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--rfq-radius);
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--rfq-transition);
}

.rfq-remove-product:hover {
    background: #DC2626;
    transform: translateY(-1px);
}

/* Form Elements */
.rfq-form-group {
    margin-bottom: 1.5rem;
}

.rfq-form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--rfq-text);
}

.rfq-form-input,
.rfq-form-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--rfq-border);
    border-radius: var(--rfq-radius);
    font-size: 1rem;
    transition: var(--rfq-transition);
    background: var(--rfq-white);
    color: var(--rfq-text);
}

.rfq-form-input:focus,
.rfq-form-textarea:focus {
    outline: none;
    border-color: var(--rfq-primary);
    box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.1);
}

/* Step Actions */
.rfq-step-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--rfq-border);
}

/* Messages */
.rfq-message {
    padding: 1rem 1.5rem;
    border-radius: var(--rfq-radius);
    margin: 1rem 0;
    font-weight: 500;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.rfq-message.success {
    background: #ECFDF5;
    color: var(--rfq-success);
    border: 1px solid #A7F3D0;
}

.rfq-message.error {
    background: #FEF2F2;
    color: var(--rfq-error);
    border: 1px solid #FECACA;
}

.rfq-message.warning {
    background: #FFFBEB;
    color: var(--rfq-warning);
    border: 1px solid #FDE68A;
}

/* Mobile Responsive - Enhanced for mobile use */
@media (max-width: 768px) {
    .rfq-form-wrapper {
        margin: 0.5rem;
        border-radius: var(--rfq-radius);
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
    
    .rfq-header {
        padding: 1.5rem 1rem;
    }
    
    .rfq-header-top {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
        margin-bottom: 1rem;
    }
    
    .rfq-form-title {
        font-size: 1.8rem;
        line-height: 1.2;
        text-align: center;
        flex: none;
    }
    
    .rfq-language-switcher {
        order: -1;
        align-self: flex-end;
    }
    
    .rfq-language-select {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
        min-width: 100px;
    }
    
    .rfq-instructions {
        font-size: 1rem;
    }
    
    .rfq-progress {
        padding: 1rem 0.5rem;
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 0.5rem;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    
    .rfq-progress::-webkit-scrollbar {
        display: none;
    }
    
    .rfq-progress-step {
        min-width: 80px;
        flex-shrink: 0;
    }
    
    .step-number {
        width: 2.5rem;
        height: 2.5rem;
        font-size: 1rem;
    }
    
    .step-label {
        font-size: 0.8rem;
        text-align: center;
        white-space: nowrap;
    }
    
    .rfq-step {
        padding: 1rem;
        min-height: auto;
    }
    
    .rfq-step-title {
        font-size: 1.4rem;
        text-align: center;
        margin-bottom: 1rem;
    }
    
    .rfq-step-actions {
        flex-direction: column;
        gap: 0.75rem;
        position: sticky;
        bottom: 0;
        background: var(--rfq-white);
        padding: 1rem;
        margin: 1rem -1rem -1rem -1rem;
        border-top: 1px solid var(--rfq-border);
    }
    
    .rfq-btn {
        width: 100%;
        justify-content: center;
        padding: 1rem 1.5rem;
        font-size: 1.1rem;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        min-height: 48px;
    }
    
    .rfq-btn-large {
        padding: 1.25rem 2rem;
        font-size: 1.2rem;
        min-height: 52px;
    }
    
    .rfq-product-controls {
        flex-wrap: wrap;
        gap: 0.5rem;
        justify-content: space-between;
    }
    
    .rfq-quantity-controls {
        width: 100%;
        justify-content: center;
    }
    
    .rfq-qty-plus,
    .rfq-qty-minus {
        width: 3rem;
        height: 3rem;
        font-size: 1.2rem;
        touch-action: manipulation;
        min-height: 48px;
        min-width: 48px;
    }
    
    .rfq-quantity {
        font-size: 1.3rem;
        min-width: 3rem;
    }
    
    .rfq-form-grid {
        display: block;
    }
    
    .rfq-form-group {
        margin-bottom: 1.25rem;
    }
    
    .rfq-form-input,
    .rfq-form-textarea {
        padding: 1rem;
        font-size: 1.1rem;
        border-radius: var(--rfq-radius);
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        min-height: 48px;
    }
    
    .rfq-form-input:focus,
    .rfq-form-textarea:focus {
        transform: none;
        box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.2);
    }
    
    .rfq-scanner-section {
        padding: 1rem;
        margin: 1rem 0;
    }
    
    #rfq-qr-reader {
        max-width: 100%;
        margin: 0 auto;
    }
    
    .rfq-scanner-help {
        padding: 1rem;
        margin-top: 1rem;
    }
    
    .rfq-scanner-help ul {
        padding-left: 1.25rem;
    }
    
    .rfq-scanner-help li {
        margin-bottom: 0.75rem;
        line-height: 1.4;
    }
    
    .rfq-product-item {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .rfq-product-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        margin-bottom: 0.75rem;
    }
    
    .rfq-product-name {
        font-size: 1.1rem;
        line-height: 1.3;
        margin: 0;
        flex: 1;
        padding-right: 1rem;
    }
    
    .rfq-remove-product {
        padding: 0.5rem;
        min-width: 2.5rem;
        height: 2.5rem;
        border-radius: 50%;
        font-size: 1.2rem;
        touch-action: manipulation;
        min-height: 48px;
        min-width: 48px;
    }
    
    .rfq-messages {
        position: fixed;
        top: 1rem;
        left: 1rem;
        right: 1rem;
        z-index: 9999;
        pointer-events: none;
    }
    
    .rfq-message {
        pointer-events: auto;
        margin-bottom: 0.5rem;
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    }
    
    .rfq-loading-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.7);
        z-index: 10000;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .rfq-loading-content {
        background: var(--rfq-white);
        padding: 2rem;
        border-radius: var(--rfq-radius);
        text-align: center;
        max-width: 280px;
        margin: 1rem;
    }
}

/* Extra small mobile devices */
@media (max-width: 480px) {
    .rfq-form-wrapper {
        margin: 0;
        border-radius: 0;
        min-height: 100vh;
    }
    
    .rfq-header {
        padding: 1rem;
    }
    
    .rfq-form-title {
        font-size: 1.6rem;
    }
    
    .rfq-progress {
        padding: 0.75rem 0.25rem;
    }
    
    .rfq-progress-step {
        min-width: 70px;
    }
    
    .step-number {
        width: 2rem;
        height: 2rem;
        font-size: 0.9rem;
    }
    
    .step-label {
        font-size: 0.7rem;
    }
    
    .rfq-step {
        padding: 0.75rem;
    }
    
    .rfq-step-title {
        font-size: 1.2rem;
    }
    
    .rfq-btn {
        padding: 0.875rem 1.25rem;
        font-size: 1rem;
    }
    
    .rfq-btn-large {
        padding: 1rem 1.5rem;
        font-size: 1.1rem;
    }
}

/* Landscape mobile orientation */
@media (max-width: 768px) and (orientation: landscape) {
    .rfq-form-wrapper {
        margin: 0.25rem;
    }
    
    .rfq-header {
        padding: 1rem;
    }
    
    .rfq-form-title {
        font-size: 1.5rem;
    }
    
    .rfq-step {
        padding: 0.75rem;
    }
    
    .rfq-step-actions {
        position: relative;
        flex-direction: row;
        margin: 1rem 0 0 0;
        padding: 1rem 0 0 0;
    }
    
    .rfq-btn {
        width: auto;
        flex: 1;
        margin: 0 0.25rem;
    }
}

/* Touch-friendly improvements */
@media (pointer: coarse) {
    .rfq-btn,
    .rfq-qty-plus,
    .rfq-qty-minus,
    .rfq-remove-product {
        min-height: 48px;
        min-width: 48px;
    }
    
    .rfq-form-input,
    .rfq-form-textarea {
        min-height: 48px;
    }
    
    .rfq-progress-step {
        padding: 0.5rem;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .rfq-form-wrapper {
        box-shadow: 0 8px 32px rgba(0,0,0,0.12);
    }
    
    .rfq-btn {
        box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --rfq-text: #F8FAFC;
        --rfq-text-light: #CBD5E1;
        --rfq-background: #1E293B;
        --rfq-white: #334155;
        --rfq-border: #475569;
    }
}

/* Accessibility */
.rfq-btn:focus,
.rfq-form-input:focus,
.rfq-form-textarea:focus {
    outline: 2px solid var(--rfq-primary);
    outline-offset: 2px;
}

/* Loading states */
.rfq-loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.rfq-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2rem;
    height: 2rem;
    margin: -1rem 0 0 -1rem;
    border: 2px solid var(--rfq-border);
    border-top: 2px solid var(--rfq-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}