/* ChoiceMate AI Public Styles - Apple-inspired Design */

/* ============================================
   BRAND COLORS & TOKENS
   ============================================ */
:root {
    --cm-primary: #1f1f1f;      /* premium black */
    --cm-secondary: #ff847c;    /* accent coral */
    --cm-black: #1f1f1f;        /* zwart */
    --cm-light-gray: #f6f4f6;   /* lichtgrijs */
    --cm-white: #ffffff;        /* wit */
    
    /* Apple-inspired colors */
    --cm-gray-50: #fafafa;
    --cm-gray-100: #f4f4f5;
    --cm-gray-200: #e4e4e7;
    --cm-gray-300: #d4d4d8;
    --cm-gray-400: #a1a1aa;
    --cm-gray-500: #71717a;
    --cm-gray-600: #52525b;
    --cm-gray-700: #3f3f46;
    --cm-gray-800: #27272a;
    --cm-gray-900: #18181b;
    
    /* Typography */
    --cm-font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', 'Poppins', sans-serif;
    --cm-heading-weight: 600;
    --cm-text-weight: 400;
    --cm-text-light: 300;
    
    /* Layout */
    --cm-border-radius: 16px;
    --cm-button-radius: 12px;
    --cm-spacing: 24px;
    --cm-spacing-sm: 16px;
    --cm-spacing-lg: 32px;
    
    /* Shadows */
    --cm-shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --cm-shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --cm-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --cm-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --cm-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

/* ============================================
   BASE STYLES
   ============================================ */
.choicemate-widget-container,
.choicemate-widget-overlay,
.choicemate-widget-modal,
.choicemate-alternative-finder {
    font-family: var(--cm-font-family);
}

.choicemate-widget-trigger *,
.choicemate-widget-overlay * {
    box-sizing: border-box;
}

/* ============================================
   WIDGET CONTAINER & MODAL
   ============================================ */
#choicemate-widget-root {
    position: relative;
    z-index: 1000;
}

.choicemate-widget-container {
    position: relative;
    z-index: 9999;
}

/* Modal Overlay - Apple Style with Backdrop Blur */
.choicemate-widget-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
    padding: var(--cm-spacing);
}

.choicemate-widget-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Modal Content - Apple-style with enhanced shadows */
.choicemate-widget-modal {
    background: var(--cm-white);
    border-radius: var(--cm-border-radius);
    width: 100%;
    max-width: 720px;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: var(--cm-shadow-xl);
    transform: scale(0.95) translateY(20px);
    transition: all 0.25s ease;
    position: relative;
    border: 1px solid var(--cm-gray-200);
}

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

/* ============================================
   MODAL HEADER
   ============================================ */
.choicemate-widget-header {
    background: var(--cm-gray-50);
    padding: var(--cm-spacing) var(--cm-spacing-lg);
    border-bottom: 1px solid var(--cm-gray-200);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.header-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.header-title {
    font-size: 1.375rem;
    font-weight: var(--cm-heading-weight);
    color: var(--cm-gray-900);
    margin: 0;
    letter-spacing: -0.025em;
}

.back-btn,
.close-btn {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--cm-gray-600);
    cursor: pointer;
    padding: 10px;
    border-radius: var(--cm-button-radius);
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

.back-btn:hover,
.close-btn:hover {
    background-color: var(--cm-gray-200);
    color: var(--cm-gray-900);
    transform: scale(1.05);
}

/* Progress Bar - Apple Style */
.progress-bar {
    width: 100%;
    height: 8px;
    background-color: var(--cm-gray-200);
    border-radius: 4px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--cm-primary) 0%, var(--cm-gray-700) 100%);
    border-radius: 4px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(31, 31, 31, 0.4);
}

/* ============================================
   MODAL CONTENT
   ============================================ */
.choicemate-widget-content {
    padding: var(--cm-spacing-lg);
    max-height: 70vh;
    overflow-y: auto;
    background: var(--cm-white);
    scrollbar-width: thin;
    scrollbar-color: var(--cm-gray-400) var(--cm-gray-100);
}

.choicemate-widget-content::-webkit-scrollbar {
    width: 6px;
}

.choicemate-widget-content::-webkit-scrollbar-track {
    background: var(--cm-gray-100);
    border-radius: 3px;
}

.choicemate-widget-content::-webkit-scrollbar-thumb {
    background: var(--cm-gray-400);
    border-radius: 3px;
}

.choicemate-widget-content::-webkit-scrollbar-thumb:hover {
    background: var(--cm-gray-500);
}

/* Loading State - Apple Style */
.choicemate-loading {
    text-align: center;
    padding: 80px var(--cm-spacing);
    color: var(--cm-gray-600);
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--cm-gray-200);
    border-top: 4px solid var(--cm-primary);
    border-radius: 50%;
    animation: spin 1.2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    margin: 0 auto 20px;
    box-shadow: var(--cm-shadow-md);
}

.choicemate-loading p {
    font-weight: 500;
    color: var(--cm-gray-700);
    margin: 0;
}

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

/* ============================================
   QUESTIONS
   ============================================ */
.choicemate-question {
    padding: 30px 0;
}

.question-title {
    font-size: 1.375rem;
    font-weight: var(--cm-heading-weight);
    color: var(--cm-gray-900);
    margin: 0 0 32px 0;
    line-height: 1.3;
    letter-spacing: -0.025em;
}

.question-options {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Question Options - Apple Style Buttons */
.option-btn {
    position: relative;
    background: var(--cm-white);
    border: 2px solid var(--cm-gray-200);
    color: var(--cm-gray-900);
    font-weight: var(--cm-text-weight);
    padding: 20px 28px;
    border-radius: 14px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: left;
    width: 100%;
    font-family: var(--cm-font-family);
    box-shadow: var(--cm-shadow-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.option-btn:hover {
    background: var(--cm-primary) !important;
    border-color: var(--cm-primary) !important;
    color: var(--cm-white) !important;
    font-weight: 600;
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(31, 31, 31, 0.3);
}

.option-btn.selected {
    background: var(--cm-primary) !important;
    border-color: var(--cm-primary) !important;
    color: var(--cm-white) !important;
    font-weight: 600;
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(31, 31, 31, 0.3);
}

.option-btn:focus {
    outline: none;
    border-color: var(--cm-primary);
    background-color: var(--cm-primary);
    color: var(--cm-white);
}

.option-btn .option-text {
    flex: 1;
}

.option-btn .option-check {
    font-size: 1.125rem;
    font-weight: 700;
    opacity: 0.9;
}

/* ============================================
   RECOMMENDATIONS
   ============================================ */
.choicemate-recommendations {
    padding: 24px 0;
}

.recommendations-header {
    margin-bottom: var(--cm-spacing-lg);
}

.recommendations-header h4 {
    font-size: 1.5rem;
    font-weight: var(--cm-heading-weight);
    color: var(--cm-black);
    margin: 0 0 16px 0;
}

.answer-summary {
    background: var(--cm-light-gray);
    padding: 20px;
    border-radius: var(--cm-button-radius);
    margin-bottom: 28px;
}

.answer-summary h5 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--cm-black);
    margin: 0 0 8px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.answer-summary ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.answer-summary li {
    font-size: 0.9rem;
    color: var(--cm-black);
    margin-bottom: 4px;
}

/* Recommendations Footer */
.recommendations-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
}

.recommendations-footer .footer-text {
    font-size: 0.75rem;
    color: var(--cm-gray-500);
    margin: 6px 0 0 0;
}

/* ============================================
   PRODUCT GRID
   ============================================ */
.products-grid {
    display: grid;
    gap: 24px;
    grid-template-columns: 1fr;
}

@media (min-width: 600px) {
    .products-grid {
        grid-template-columns: 1fr;
    }
}

/* Product Cards - Apple Style */
.product-card {
    background: var(--cm-white);
    border: 1px solid var(--cm-gray-200);
    border-radius: var(--cm-border-radius);
    padding: var(--cm-spacing-lg);
    transition: all 0.2s ease;
    position: relative;
    box-shadow: var(--cm-shadow-sm);
    display: flex;
    flex-direction: row;
    gap: 20px;
}

.product-card:hover {
    box-shadow: var(--cm-shadow-lg);
    transform: translateY(-2px);
    border-color: var(--cm-gray-300);
}

.product-rank {
    position: absolute;
    top: 16px;
    right: 16px;
    background: linear-gradient(135deg, var(--cm-primary) 0%, var(--cm-gray-700) 100%);
    color: var(--cm-white);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 700;
    box-shadow: var(--cm-shadow-md);
    border: 2px solid var(--cm-white);
}

.product-image {
    text-align: center;
    margin: 0;
    order: 1;
}

.product-image img {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: var(--cm-button-radius);
    border: 1px solid var(--cm-gray-200);
}

.product-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
    order: 2;
}

.product-name {
    font-size: 1.125rem;
    font-weight: var(--cm-heading-weight);
    color: var(--cm-black);
    margin: 0;
    line-height: 1.3;
}

.product-price {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--cm-primary);
    margin: 0;
}

/* Product Match Reasons */
.product-match-reasons {
    margin: 0;
}

.match-reasons-header {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--cm-gray-600);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.match-reasons-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.match-reason {
    display: inline-block;
    background: var(--cm-gray-100);
    color: var(--cm-gray-700);
    font-size: 0.75rem;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid var(--cm-gray-200);
    transition: all 0.2s ease;
    position: relative;
}

.match-reason:hover {
    background: var(--cm-gray-200);
    border-color: var(--cm-gray-300);
}

.match-reason:before {
    content: none;
}

/* Product Actions */
.product-actions {
    display: flex;
    gap: 12px;
    margin: 0;
    order: 3;
}

.choicemate-btn {
    padding: 12px 20px;
    border-radius: var(--cm-button-radius);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    font-family: var(--cm-font-family);
}

.choicemate-btn.add-to-cart,
.choicemate-btn.primary {
    background: linear-gradient(135deg, var(--cm-primary) 0%, var(--cm-gray-700) 100%);
    color: var(--cm-white);
    border: none;
    box-shadow: var(--cm-shadow-md);
    font-weight: 600;
}

.choicemate-btn.add-to-cart:hover,
.choicemate-btn.primary:hover {
    background: linear-gradient(135deg, var(--cm-gray-700) 0%, var(--cm-gray-800) 100%);
    transform: translateY(-2px);
    box-shadow: var(--cm-shadow-lg);
}

.choicemate-btn.secondary {
    background: var(--cm-white);
    color: var(--cm-primary);
    border: 2px solid var(--cm-gray-200);
    box-shadow: var(--cm-shadow-sm);
}

.choicemate-btn.secondary:hover {
    background: var(--cm-gray-50);
    color: var(--cm-primary);
    border-color: var(--cm-gray-400);
    transform: translateY(-1px);
    box-shadow: var(--cm-shadow-md);
}

/* ============================================
   ALTERNATIVE FINDER
   ============================================ */
.choicemate-alternative-finder {
    margin: 20px 0;
    padding: var(--cm-spacing);
    background: var(--cm-white);
    border-radius: var(--cm-border-radius);
    border: 1px solid var(--cm-light-gray);
    box-shadow: 0 2px 8px rgba(31, 31, 31, 0.05);
}

.choicemate-alternative-finder h4 {
    margin: 0 0 12px 0;
    font-size: 1.125rem;
    color: var(--cm-black);
    font-weight: var(--cm-heading-weight);
}

.choicemate-alternative-finder p {
    margin: 0 0 16px 0;
    color: var(--cm-black);
    font-size: 0.95rem;
    line-height: 1.5;
}

.choicemate-alternative-btn {
    background: linear-gradient(135deg, var(--cm-primary) 0%, var(--cm-gray-700) 100%);
    color: var(--cm-white);
    border: none;
    padding: 14px 24px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: var(--cm-font-family);
    box-shadow: var(--cm-shadow-md);
}

.choicemate-alternative-btn:hover {
    background: linear-gradient(135deg, var(--cm-gray-700) 0%, var(--cm-gray-800) 100%);
    transform: translateY(-2px);
    box-shadow: var(--cm-shadow-lg);
}

/* ============================================
   LOADING STATES
   ============================================ */
.choicemate-initial-loading {
    background: linear-gradient(135deg, var(--cm-primary) 0%, var(--cm-gray-700) 100%);
    border-radius: var(--cm-border-radius);
    padding: var(--cm-spacing);
    margin: 20px 0;
    box-shadow: 0 8px 32px rgba(31, 31, 31, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.loading-trigger {
    display: flex;
    align-items: center;
    gap: 20px;
    max-width: 600px;
    margin: 0 auto;
}

.trigger-icon {
    font-size: 3em;
    background: rgba(255, 255, 255, 0.2);
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.trigger-content {
    flex: 1;
    color: var(--cm-white);
}

.trigger-content h3 {
    margin: 0 0 8px 0;
    font-size: 1.4em;
    font-weight: var(--cm-heading-weight);
}

.trigger-content p {
    margin: 0;
    opacity: 0.9;
    font-size: 1em;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 768px) {
    .choicemate-widget-modal {
        width: 95%;
        max-height: 95vh;
    }
    
    .choicemate-widget-content {
        padding: 16px;
    }
    
    .option-btn {
        padding: 14px 16px;
        font-size: 0.9rem;
    }
    
    .product-image img {
        width: 100px;
        height: 100px;
    }
    
    .loading-trigger {
        flex-direction: column;
        text-align: center;
        gap: 16px;
    }
}

@media (max-width: 480px) {
    .choicemate-widget-modal {
        width: 98%;
        margin: 1vh auto;
    }
    
    .header-title {
        font-size: 1.25rem;
    }
    
    .question-title {
        font-size: 1.125rem;
    }
}

/* ============================================
   ERROR & EMPTY STATES
   ============================================ */
.choicemate-error,
.choicemate-no-results {
    text-align: center;
    padding: 40px 20px;
}

.choicemate-error h4,
.choicemate-no-results h4 {
    color: var(--cm-black);
    font-weight: var(--cm-heading-weight);
    margin-bottom: 12px;
}

.choicemate-no-js {
    background: var(--cm-white);
    border: 1px solid var(--cm-light-gray);
    border-radius: var(--cm-button-radius);
    padding: 20px;
    text-align: center;
    margin: 20px 0;
}


/* ============================================
   DARK MODE SUPPORT
   ============================================ */
@media (prefers-color-scheme: dark) {
    .product-match-reasons {
        background: rgba(255, 132, 124, 0.15);
    }
    
    .match-reasons-header {
        color: var(--cm-primary);
    }
    
    .match-reason {
        color: var(--cm-black);
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    .choicemate-widget-trigger,
    .choicemate-widget-overlay {
        display: none !important;
    }
}
