/* xSecret BDSM Test - Frontend Styles */

/* CSS Custom Properties for Theming */
:root {
    --xsb-primary-color: #e91e63;
    --xsb-primary-hover: #c2185b;
    --xsb-bg-primary: #ffffff;
    --xsb-bg-secondary: #f8f9fa;
    --xsb-text-primary: #333333;
    --xsb-text-secondary: #666666;
    --xsb-text-muted: #999999;
    --xsb-border-color: #e0e0e0;
    --xsb-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --xsb-shadow-hover: 0 4px 20px rgba(0, 0, 0, 0.15);
    --xsb-radius: 8px;
    --xsb-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --xsb-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Theme */
[data-theme="dark"] {
    --xsb-bg-primary: #1a1a1a;
    --xsb-bg-secondary: #2d2d2d;
    --xsb-text-primary: #ffffff;
    --xsb-text-secondary: #cccccc;
    --xsb-text-muted: #999999;
    --xsb-border-color: #404040;
    --xsb-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    --xsb-shadow-hover: 0 4px 20px rgba(0, 0, 0, 0.4);
}

/* Auto Theme - Respects system preference */
@media (prefers-color-scheme: dark) {
    [data-theme="auto"] {
        --xsb-bg-primary: #1a1a1a;
        --xsb-bg-secondary: #2d2d2d;
        --xsb-text-primary: #ffffff;
        --xsb-text-secondary: #cccccc;
        --xsb-text-muted: #999999;
        --xsb-border-color: #404040;
        --xsb-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
        --xsb-shadow-hover: 0 4px 20px rgba(0, 0, 0, 0.4);
    }
}

/* Google Fonts */
[data-font-stack="google"] {
    --xsb-font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Custom Background Color */
.xsb-test-container[data-use-custom-background="1"] {
    background: var(--xsb-custom-bg-color) !important;
}

/* Rounded Corners */
[data-rounded-corners="0"] {
    --xsb-radius: 0px;
}

/* Container */
.xsb-test-container {
    font-family: var(--xsb-font-family);
    color: var(--xsb-text-primary);
    background: var(--xsb-bg-primary);
    min-height: 100vh;
    padding: 0;
    margin: 0;
    width: 100%;
    box-sizing: border-box;
    position: relative;
    overflow-x: hidden;
}

.xsb-test-container * {
    box-sizing: border-box;
}

/* Screens - Base styling and display logic */
.xsb-screen {
    display: none;
    min-height: 100vh;
    padding: 15px;
    box-sizing: border-box;
}

.xsb-screen.active {
    display: block;
}

/* Centered screens (welcome, results, loading, error) */
.xsb-welcome.active,
.xsb-results.active,
.xsb-loading.active,
.xsb-error.active {
    display: flex !important;
    align-items: flex-start;
    justify-content: center;
    padding-top: 40px;
    min-height: 100vh;
}

/* Test screen should start from top */
.xsb-test.active {
    display: block !important;
    padding-top: 15px;
    min-height: 100vh;
    position: relative;
}

/* Cards */
.xsb-card {
    background: var(--xsb-bg-primary);
    border-radius: var(--xsb-radius);
    box-shadow: var(--xsb-shadow);
    padding: 40px;
    max-width: 600px;
    width: 100%;
    margin: 0 auto;
    transition: var(--xsb-transition);
}

.xsb-card:hover {
    box-shadow: var(--xsb-shadow-hover);
}

/* Typography */
.xsb-card h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0 0 20px 0;
    text-align: center;
    color: var(--xsb-text-primary);
}

.xsb-card h2 {
    font-size: 1.8rem;
    font-weight: 600;
    margin: 0 0 15px 0;
    color: var(--xsb-text-primary);
    line-height: 1.3;
}

.xsb-card h3 {
    font-size: 1.4rem;
    font-weight: 600;
    margin: 30px 0 15px 0;
    color: var(--xsb-text-primary);
}

.xsb-description {
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--xsb-text-secondary);
    text-align: center;
    margin: 0 0 30px 0;
}

.xsb-disclaimer {
    font-size: 0.9rem;
    color: var(--xsb-text-muted);
    text-align: center;
    margin: 30px 0 0 0;
    font-style: italic;
}

/* Center start test button */
.xsb-welcome .xsb-button {
    display: block;
    margin: 30px auto;
}

/* Features */
.xsb-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.xsb-feature {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 500;
    color: var(--xsb-text-secondary);
}

.xsb-icon {
    font-size: 1.2rem;
}

/* Buttons */
.xsb-button {
    background: var(--xsb-primary-color);
    color: white;
    border: none;
    border-radius: var(--xsb-radius);
    padding: 14px 28px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--xsb-transition);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 120px;
    font-family: inherit;
}

.xsb-button:hover {
    background: var(--xsb-primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(233, 30, 99, 0.3);
}

.xsb-button:active {
    transform: translateY(0);
}

.xsb-button:disabled {
    background: var(--xsb-text-muted);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.xsb-button-secondary {
    background: var(--xsb-bg-secondary);
    color: var(--xsb-text-primary);
    border: 2px solid var(--xsb-border-color);
}

.xsb-button-secondary:hover {
    background: var(--xsb-border-color);
    transform: translateY(-2px);
    box-shadow: var(--xsb-shadow);
}

/* Progress Bar */
.xsb-progress-container {
    position: relative;
    width: 100%;
    background: var(--xsb-bg-primary);
    padding: 10px 15px;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--xsb-border-color);
    box-shadow: var(--xsb-shadow);
    border-radius: var(--xsb-radius);
}

.xsb-progress-bar {
    width: 100%;
    height: 6px;
    background: var(--xsb-border-color);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 10px;
}

.xsb-progress-fill {
    height: 100%;
    background: var(--xsb-primary-color);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.xsb-progress-text {
    text-align: center;
    font-size: 0.9rem;
    color: var(--xsb-text-secondary);
    font-weight: 500;
}

/* Question Container */
.xsb-question-container {
    padding-top: 0;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
}

/* Question container spacing */
.xsb-question-container {
    padding-top: 0;
}

/* Test screen layout adjustments */
.xsb-test {
    align-items: flex-start !important;
    justify-content: flex-start !important;
}

.xsb-question-set-card {
    max-width: 1000px;
}

/* Category Description */
.xsb-category-description {
    color: var(--xsb-text-secondary);
    font-size: 1rem;
    line-height: 1.5;
    margin: 0 0 30px 0;
    text-align: center;
}

/* Questions List */
.xsb-questions-list {
    display: flex;
    flex-direction: column;
    gap: 30px;
    margin: 30px 0;
}

/* Individual Question */
.xsb-question-item {
    padding: 25px;
    background: var(--xsb-bg-secondary);
    border-radius: var(--xsb-radius);
    border-left: 4px solid var(--xsb-primary-color);
    transition: var(--xsb-transition);
}

.xsb-question-item:hover {
    box-shadow: var(--xsb-shadow);
}

.xsb-question-item.answered {
    border-left-color: #28a745;
    background: rgba(40, 167, 69, 0.05);
}

.xsb-question-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--xsb-text-primary);
    margin: 0 0 10px 0;
    line-height: 1.4;
}

.xsb-question-help {
    color: var(--xsb-text-secondary);
    font-size: 0.9rem;
    line-height: 1.4;
    margin: 0 0 20px 0;
    font-style: italic;
}

/* Likert Scale for Multiple Questions */
.xsb-question-item .xsb-likert-scale {
    margin: 20px 0 0 0;
}

.xsb-question-item .xsb-scale-labels {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-size: 0.85rem;
}

.xsb-question-item .xsb-scale-options {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin: 15px 0;
}

.xsb-question-item .xsb-scale-option {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    padding: 12px 8px;
    border-radius: var(--xsb-radius);
    transition: var(--xsb-transition);
    border: 2px solid transparent;
}

.xsb-question-item .xsb-scale-option:hover {
    background: var(--xsb-bg-primary);
    border-color: var(--xsb-primary-color);
}

.xsb-question-item .xsb-scale-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--xsb-border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    transition: var(--xsb-transition);
    background: var(--xsb-bg-primary);
    color: var(--xsb-text-primary);
}

.xsb-question-item .xsb-scale-option input[type="radio"]:checked + .xsb-scale-number {
    background: var(--xsb-primary-color);
    color: white;
    border-color: var(--xsb-primary-color);
    transform: scale(1.1);
}

.xsb-question-help {
    color: var(--xsb-text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 0 0 30px 0;
    font-style: italic;
}

/* Likert Scale */
.xsb-likert-scale {
    margin: 40px 0;
}

.xsb-scale-labels {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

.xsb-scale-label {
    font-size: 0.9rem;
    color: var(--xsb-text-secondary);
    font-weight: 500;
}

.xsb-scale-options {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin: 20px 0;
}

.xsb-scale-option {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    padding: 15px 10px;
    border-radius: var(--xsb-radius);
    transition: var(--xsb-transition);
    border: 2px solid transparent;
}

.xsb-scale-option:hover {
    background: var(--xsb-bg-secondary);
    border-color: var(--xsb-primary-color);
}

.xsb-scale-option input[type="radio"] {
    display: none;
}

.xsb-scale-option input[type="radio"]:checked + .xsb-scale-number {
    background: var(--xsb-primary-color);
    color: white;
    transform: scale(1.1);
}

.xsb-scale-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--xsb-border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.1rem;
    transition: var(--xsb-transition);
    background: var(--xsb-bg-primary);
    color: var(--xsb-text-primary);
}

/* Question Actions */
.xsb-question-actions {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-top: 40px;
}

.xsb-navigation {
    text-align: center;
    margin-top: 20px;
}

/* Results */
.xsb-results .xsb-card {
    max-width: 1000px;
}

.xsb-results-content {
    margin: 30px 0;
}

.xsb-trait-result {
    margin: 25px 0;
    padding: 20px;
    background: var(--xsb-bg-secondary);
    border-radius: var(--xsb-radius);
    border-left: 4px solid var(--xsb-primary-color);
}

.xsb-trait-name {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--xsb-text-primary);
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.xsb-trait-score {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--xsb-primary-color);
}

.xsb-trait-bar {
    width: 100%;
    height: 10px;
    background: var(--xsb-border-color);
    border-radius: 5px;
    overflow: hidden;
    margin: 10px 0;
}

.xsb-trait-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--xsb-primary-color), var(--xsb-primary-hover));
    border-radius: 5px;
    transition: width 1s ease-out;
}

/* Product Recommendations */
.xsb-product-recommendation {
    text-align: center;
    margin: 40px 0;
    padding: 30px 0;
    border-top: 1px solid var(--xsb-border-color);
}

.xsb-product-recommendation h3 {
    font-size: 1.4rem;
    font-weight: 600;
    margin: 0 0 15px 0;
    color: var(--xsb-text-primary);
}

.xsb-recommendation-intro {
    font-size: 1rem;
    color: var(--xsb-text-secondary);
    margin: 0 0 30px 0;
}

.xsb-product-card {
    display: flex;
    gap: 20px;
    align-items: center;
    background: var(--xsb-bg-secondary);
    border-radius: var(--xsb-radius);
    padding: 20px;
    margin: 20px 0;
    text-align: left;
    box-shadow: var(--xsb-shadow);
    transition: var(--xsb-transition);
    position: relative;
    overflow: hidden;
}

.xsb-product-card:hover {
    box-shadow: var(--xsb-shadow-hover);
}

.xsb-product-card.has-discount {
    border: 2px solid var(--xsb-primary-color);
    background: linear-gradient(135deg, var(--xsb-bg-secondary) 0%, var(--xsb-bg-primary) 100%);
    position: relative;
}

.xsb-product-card.has-discount:hover {
    transform: translateY(-2px);
    box-shadow: var(--xsb-shadow-hover);
}

.xsb-product-image {
    flex-shrink: 0;
    width: 120px;
    height: 120px;
    border-radius: var(--xsb-radius);
    overflow: hidden;
}

.xsb-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.xsb-product-info {
    flex: 1;
}

.xsb-product-name {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0 0 10px 0;
    color: var(--xsb-text-primary);
}

.xsb-product-description {
    font-size: 0.95rem;
    color: var(--xsb-text-secondary);
    margin: 0 0 15px 0;
    line-height: 1.4;
}

.xsb-product-details {
    display: flex;
    align-items: center;
    gap: 15px;
    margin: 15px 0;
}

.xsb-product-price {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--xsb-primary-color);
}

.xsb-stock-status {
    display: none;
}

.xsb-product-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.xsb-product-actions .xsb-button {
    margin: 0;
}

/* Discount Badge */
.xsb-discount-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: var(--xsb-primary-color);
    color: white;
    padding: 6px 10px;
    border-radius: var(--xsb-radius);
    font-weight: 600;
    box-shadow: var(--xsb-shadow);
    z-index: 2;
    font-size: 0.85rem;
}

.xsb-discount-percentage {
    display: inline;
    font-size: 0.85rem;
    line-height: 1;
}

.xsb-discount-text {
    display: none;
}

/* Pricing Styles */
.xsb-product-pricing {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.xsb-price-original {
    font-size: 0.9rem;
    color: var(--xsb-text-muted);
    text-decoration: line-through;
    opacity: 0.7;
}

.xsb-price-discounted {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--xsb-primary-color);
}

.xsb-savings {
    display: none;
}

/* Discount CTA Button */
.xsb-button.discount-cta {
    background: var(--xsb-primary-color);
    border: none;
    font-weight: 600;
    position: relative;
    overflow: hidden;
}

.xsb-button.discount-cta:hover {
    background: var(--xsb-primary-hover);
    transform: translateY(-2px);
}

.xsb-button.discount-cta::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;
}

.xsb-button.discount-cta:hover::before {
    left: 100%;
}

/* Share Results Section */
.xsb-share-section {
    text-align: center;
    margin: 40px 0;
    padding: 30px 0;
    border-top: 1px solid var(--xsb-border-color);
}

.xsb-share-section h3 {
    font-size: 1.4rem;
    font-weight: 600;
    margin: 0 0 15px 0;
    color: var(--xsb-text-primary);
}

.xsb-share-section .description {
    font-size: 1rem;
    color: var(--xsb-text-secondary);
    margin: 0 0 20px 0;
}

.xsb-share-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 20px 0;
}

.xsb-share-link-input {
    width: 100%;
    max-width: 500px;
    padding: 10px 15px;
    border: 1px solid var(--xsb-border-color);
    border-radius: var(--xsb-radius);
    background: var(--xsb-bg-secondary);
    color: var(--xsb-text-primary);
    font-family: monospace;
    font-size: 0.9rem;
    text-align: center;
    margin-top: 15px;
}

.xsb-share-link-input:focus {
    outline: 2px solid var(--xsb-primary-color);
    outline-offset: 2px;
}

/* Shared Results Notice */
.xsb-shared-notice {
    background: var(--xsb-bg-secondary);
    padding: 10px 15px;
    border-radius: var(--xsb-radius);
    color: var(--xsb-text-secondary);
    font-style: italic;
    margin: 0 0 30px 0;
    text-align: center;
    border-left: 4px solid var(--xsb-primary-color);
}

.xsb-restart-section {
    text-align: center;
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid var(--xsb-border-color);
}

/* Loading */
.xsb-loading .xsb-card {
    text-align: center;
    color: var(--xsb-text-secondary);
}

.xsb-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--xsb-border-color);
    border-top: 4px solid var(--xsb-primary-color);
    border-radius: 50%;
    animation: xsb-spin 1s linear infinite;
    margin: 0 auto 20px auto;
    display: block;
}

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

/* Error */
.xsb-error .xsb-card {
    text-align: center;
    border-left: 4px solid #f44336;
}

.xsb-error h2 {
    color: #f44336;
}

/* Responsive Design */
@media (max-width: 768px) {
    .xsb-test-container {
        padding: 0;
        width: 100vw;
        margin: 0;
        margin-left: calc(-50vw + 50%);
        overflow-x: hidden;
    }
    
    .xsb-screen {
        padding: 10px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .xsb-card {
        padding: 20px 15px;
        margin: 8px 0;
        width: 100%;
        box-sizing: border-box;
    }
    
    .xsb-card h1 {
        font-size: 1.8rem;
    }
    
    .xsb-card h2 {
        font-size: 1.4rem;
    }
    
    .xsb-features {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .xsb-question-container {
        max-width: 100%;
        padding-top: 0;
        width: 100%;
        box-sizing: border-box;
    }
    
    .xsb-question-set-card,
    .xsb-results .xsb-card {
        max-width: 100%;
        width: 100%;
        box-sizing: border-box;
    }
    
    .xsb-questions-list {
        gap: 15px;
    }
    
    .xsb-question-item {
        padding: 15px 10px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .xsb-question-item .xsb-scale-options {
        gap: 2px;
        padding: 0 5px;
        flex-wrap: nowrap;
        justify-content: space-between;
    }
    
    .xsb-question-item .xsb-scale-option {
        padding: 4px 2px;
        flex: 1;
        min-width: 0;
    }
    
    .xsb-question-item .xsb-scale-number {
        width: 28px;
        height: 28px;
        font-size: 0.75rem;
        margin: 0 auto;
    }
    
    .xsb-question-actions {
        text-align: center;
        margin-top: 30px;
        display: flex;
        justify-content: center;
    }
    
    .xsb-question-actions .xsb-button {
        width: 100%;
        max-width: 300px;
    }
    
    .xsb-progress-container {
        padding: 12px 15px;
    }
    
    .xsb-product-card {
        flex-direction: column;
        text-align: center;
    }
    
    .xsb-product-image {
        width: 100px;
        height: 100px;
    }
    
    .xsb-product-actions {
        justify-content: center;
    }
    
    .xsb-discount-badge {
        position: static;
        margin-bottom: 10px;
        border-radius: var(--xsb-radius);
        text-align: center;
        background: var(--xsb-primary-color);
    }
    
    .xsb-product-pricing {
        align-items: center;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .xsb-test-container {
        padding: 0;
        width: 100vw;
        margin: 0;
        margin-left: calc(-50vw + 50%);
        overflow-x: hidden;
    }
    
    .xsb-screen {
        padding: 8px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .xsb-card {
        padding: 15px 10px;
        margin: 5px 0;
        width: 100%;
        box-sizing: border-box;
    }
    
    .xsb-card h1 {
        font-size: 1.6rem;
    }
    
    .xsb-questions-list {
        gap: 12px;
    }
    
    .xsb-question-item {
        padding: 12px 8px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .xsb-question-title {
        font-size: 0.95rem;
        line-height: 1.3;
    }
    
    .xsb-question-item .xsb-scale-options {
        flex-wrap: nowrap;
        justify-content: space-between;
        gap: 1px;
        padding: 0 3px;
        width: 100%;
    }
    
    .xsb-question-item .xsb-scale-option {
        flex: 1;
        min-width: 0;
        padding: 3px 1px;
    }
    
    .xsb-question-item .xsb-scale-number {
        width: 26px;
        height: 26px;
        font-size: 0.7rem;
        margin: 0 auto;
    }
    
    .xsb-question-actions {
        text-align: center;
        margin-top: 25px;
        display: flex;
        justify-content: center;
    }
    
    .xsb-question-actions .xsb-button {
        width: 100%;
        max-width: 280px;
    }
}


/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

.xsb-scale-option:focus-within {
    outline: 2px solid var(--xsb-primary-color);
    outline-offset: 2px;
}

.xsb-button:focus {
    outline: 2px solid var(--xsb-primary-color);
    outline-offset: 2px;
}
