/**
 * W8 Price Match - Frontend Styles
 * 
 * Follows a clean, modern design system
 */

/* CSS Variables */
:root {
    --w8-pm-font: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
    --w8-pm-bg: #ffffff;
    --w8-pm-text: #1a1a1a;
    --w8-pm-muted: #6b7280;
    --w8-pm-border: #e5e7eb;
    --w8-pm-accent: #000000;
    --w8-pm-success: #059669;
    --w8-pm-error: #dc2626;
    --w8-pm-radius: 8px;
    --w8-pm-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    --w8-pm-shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* ============================================
   Price Match Link (next to price)
   ============================================ */

.w8-price-match-link-wrap {
    margin: 8px 0 16px 0;
}

.w8-price-match-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--w8-pm-font);
    font-size: 0.875rem;
    color: var(--w8-pm-muted);
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s ease;
}

.w8-price-match-link:hover {
    color: var(--w8-pm-accent);
    text-decoration: underline;
}

.w8-price-match-link:focus {
    outline: 2px solid var(--w8-pm-accent);
    outline-offset: 2px;
}

/* ============================================
   Price Match Button Styles
   ============================================ */

.w8-price-match-button-wrap {
    margin: 16px 0;
}

.w8-price-match-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    font-family: var(--w8-pm-font);
    font-size: 0.9375rem;
    font-weight: 500;
    letter-spacing: 0.3px;
    color: var(--w8-pm-text);
    background: var(--w8-pm-bg);
    border: 1px solid var(--w8-pm-border);
    border-radius: var(--w8-pm-radius);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.w8-price-match-btn:hover {
    background: #f3f4f6;
    border-color: var(--w8-pm-muted);
    transform: translateY(-1px);
    box-shadow: var(--w8-pm-shadow);
}

.w8-price-match-btn:focus {
    outline: 2px solid var(--w8-pm-accent);
    outline-offset: 2px;
}

.w8-price-match-btn svg {
    flex-shrink: 0;
}

/* ============================================
   Archive Page Banner
   ============================================ */

.w8-price-match-banner {
    background: linear-gradient(135deg, #f9fafb 0%, #ffffff 100%);
    border: 1px solid var(--w8-pm-border);
    border-radius: var(--w8-pm-radius);
    padding: 16px 24px;
    margin-bottom: 24px;
    box-shadow: var(--w8-pm-shadow);
}

.w8-price-match-banner-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.w8-price-match-banner-text {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--w8-pm-font);
    font-size: 1rem;
    font-weight: 500;
    color: var(--w8-pm-text);
}

.w8-price-match-banner-text svg {
    color: var(--w8-pm-accent);
}

@media (max-width: 600px) {
    .w8-price-match-banner-content {
        flex-direction: column;
        text-align: center;
    }
    
    .w8-price-match-banner-text {
        justify-content: center;
    }
}

/* ============================================
   Modal Styles
   ============================================ */

.w8-pm-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.w8-pm-modal[aria-hidden="false"] {
    opacity: 1;
    visibility: visible;
}

.w8-pm-modal[aria-hidden="false"] .w8-pm-container {
    transform: translateY(0) scale(1);
}

/* Overlay */
.w8-pm-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    cursor: pointer;
}

/* Container */
.w8-pm-container {
    position: relative;
    width: 100%;
    max-width: 700px;
    max-height: calc(100vh - 40px);
    background: var(--w8-pm-bg);
    border-radius: var(--w8-pm-radius);
    box-shadow: var(--w8-pm-shadow-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: translateY(20px) scale(0.95);
    transition: transform 0.3s ease;
}

/* Header */
.w8-pm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: var(--w8-pm-accent);
    color: #ffffff;
}

.w8-pm-header h2 {
    margin: 0;
    font-family: var(--w8-pm-font);
    font-size: 1.25rem;
    font-weight: 500;
    letter-spacing: 0.3px;
    color: #ffffff !important;
}

.w8-pm-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.w8-pm-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.w8-pm-close:focus {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

/* Body */
.w8-pm-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* Introduction */
.w8-pm-intro {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--w8-pm-border);
}

.w8-pm-intro p {
    font-family: var(--w8-pm-font);
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--w8-pm-text);
    margin: 0 0 12px 0;
}

.w8-pm-intro p:last-child {
    margin-bottom: 0;
}

.w8-pm-intro em {
    color: var(--w8-pm-muted);
}

.w8-pm-phone {
    margin-top: 16px !important;
}

.w8-pm-phone a {
    color: var(--w8-pm-accent);
    text-decoration: none;
}

.w8-pm-phone a:hover {
    text-decoration: underline;
}

/* ============================================
   Form Styles
   ============================================ */

.w8-pm-form {
    font-family: var(--w8-pm-font);
}

.w8-pm-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.w8-pm-form-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.w8-pm-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.w8-pm-field-full {
    grid-column: 1 / -1;
}

.w8-pm-field label {
    font-family: var(--w8-pm-font);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--w8-pm-text);
}

.w8-pm-field .required {
    color: var(--w8-pm-error);
}

.w8-pm-field input,
.w8-pm-field textarea {
    width: 100%;
    padding: 12px 14px;
    font-family: var(--w8-pm-font);
    font-size: 0.9375rem;
    color: var(--w8-pm-text);
    background: var(--w8-pm-bg);
    border: 1px solid var(--w8-pm-border);
    border-radius: var(--w8-pm-radius);
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.w8-pm-field input:hover,
.w8-pm-field textarea:hover {
    border-color: var(--w8-pm-muted);
}

.w8-pm-field input:focus,
.w8-pm-field textarea:focus {
    outline: none;
    border-color: var(--w8-pm-accent);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

.w8-pm-field input::placeholder,
.w8-pm-field textarea::placeholder {
    color: var(--w8-pm-muted);
}

.w8-pm-field textarea {
    resize: vertical;
    min-height: 80px;
}

/* Error states */
.w8-pm-field.has-error input,
.w8-pm-field.has-error textarea {
    border-color: var(--w8-pm-error);
}

.w8-pm-field.has-error input:focus,
.w8-pm-field.has-error textarea:focus {
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.w8-pm-error {
    font-size: 0.8125rem;
    color: var(--w8-pm-error);
    min-height: 18px;
}

/* Form footer */
.w8-pm-form-footer {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--w8-pm-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.w8-pm-recaptcha {
    display: flex;
    justify-content: center;
}

.w8-pm-form-error {
    width: 100%;
    padding: 12px 16px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--w8-pm-radius);
    color: var(--w8-pm-error);
    font-size: 0.875rem;
    text-align: center;
    display: none;
}

.w8-pm-form-error.visible {
    display: block;
}

/* Submit button */
.w8-pm-submit {
    width: 100%;
    max-width: 300px;
    padding: 14px 28px;
    font-family: var(--w8-pm-font);
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: 0.3px;
    color: #ffffff;
    background: var(--w8-pm-accent);
    border: 1px solid var(--w8-pm-accent);
    border-radius: var(--w8-pm-radius);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.w8-pm-submit:hover:not(:disabled) {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.w8-pm-submit:focus {
    outline: 2px solid var(--w8-pm-accent);
    outline-offset: 2px;
}

.w8-pm-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.w8-pm-submit-loading {
    display: none;
    align-items: center;
    gap: 8px;
}

.w8-pm-submit.loading .w8-pm-submit-text {
    display: none;
}

.w8-pm-submit.loading .w8-pm-submit-loading {
    display: flex;
}

.w8-pm-spinner {
    animation: w8-pm-spin 1s linear infinite;
}

@keyframes w8-pm-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ============================================
   Success State
   ============================================ */

.w8-pm-success {
    display: none;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 40px 20px;
}

.w8-pm-success.visible {
    display: flex;
}

.w8-pm-form.hidden {
    display: none;
}

.w8-pm-intro.hidden {
    display: none;
}

.w8-pm-success-icon {
    margin-bottom: 20px;
    animation: w8-pm-success-pop 0.5s ease;
}

@keyframes w8-pm-success-pop {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

.w8-pm-success h3 {
    margin: 0 0 12px 0;
    font-family: var(--w8-pm-font);
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--w8-pm-success);
}

.w8-pm-success p {
    margin: 0 0 24px 0;
    font-family: var(--w8-pm-font);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--w8-pm-text);
    max-width: 400px;
}

.w8-pm-close-success {
    padding: 12px 32px;
}

/* ============================================
   Responsive Styles
   ============================================ */

@media (max-width: 768px) {
    .w8-pm-modal {
        padding: 10px;
    }
    
    .w8-pm-container {
        max-height: calc(100vh - 20px);
    }
    
    .w8-pm-header {
        padding: 16px 20px;
    }
    
    .w8-pm-header h2 {
        font-size: 1.125rem;
    }
    
    .w8-pm-body {
        padding: 20px;
    }
    
    .w8-pm-form-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .w8-pm-form-col {
        gap: 12px;
    }
    
    .w8-pm-submit {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .w8-pm-header {
        padding: 14px 16px;
    }
    
    .w8-pm-header h2 {
        font-size: 1rem;
    }
    
    .w8-pm-close {
        width: 36px;
        height: 36px;
    }
    
    .w8-pm-body {
        padding: 16px;
    }
    
    .w8-pm-intro {
        margin-bottom: 20px;
        padding-bottom: 20px;
    }
    
    .w8-pm-intro p {
        font-size: 0.875rem;
    }
    
    .w8-pm-field input,
    .w8-pm-field textarea {
        padding: 10px 12px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .w8-pm-form-footer {
        margin-top: 20px;
        padding-top: 20px;
    }
}

/* ============================================
   Body scroll lock when modal is open
   ============================================ */

body.w8-pm-modal-open {
    overflow: hidden;
}

/* ============================================
   Print styles - hide modal
   ============================================ */

@media print {
    .w8-pm-modal {
        display: none !important;
    }
}

/* ============================================
   Embedded Form Styles
   ============================================ */

.w8-price-match-embedded-form {
    max-width: 800px;
    margin: 0 auto;
    padding: 24px;
    background: var(--w8-pm-bg);
    border: 1px solid var(--w8-pm-border);
    border-radius: var(--w8-pm-radius);
}

.w8-price-match-embedded-form .w8-pm-intro {
    margin-bottom: 24px;
    padding-bottom: 24px;
}

.w8-price-match-embedded-form .w8-pm-success {
    padding: 40px 20px;
}
