/* ===================================================================
   BV TOOLS SHARED DESIGN SYSTEM
   Unified styling for all Beyond Volatility calculator tools
   Version: 1.0.0
   =================================================================== */

/* ===================================================================
   CSS VARIABLES - TOOL DESIGN TOKENS
   =================================================================== */
:root {
    /* Primary Colors */
    --bv-tool-primary: #3b82f6;
    --bv-tool-primary-dark: #2563eb;
    --bv-tool-secondary: #8b5cf6;
    --bv-tool-success: #10b981;
    --bv-tool-warning: #f59e0b;
    --bv-tool-error: #ef4444;

    /* Backgrounds */
    --bv-tool-bg: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    --bv-tool-card-bg: rgba(255, 255, 255, 0.95);
    --bv-tool-glass-bg: rgba(255, 255, 255, 0.7);

    /* Text Colors */
    --bv-tool-text: #1f2937;
    --bv-tool-text-muted: #64748b;
    --bv-tool-text-light: #94a3b8;

    /* Borders & Shadows */
    --bv-tool-border: #e2e8f0;
    --bv-tool-border-focus: var(--bv-tool-primary);
    --bv-tool-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --bv-tool-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --bv-tool-shadow-glow: 0 0 20px rgba(59, 130, 246, 0.15);

    /* Spacing */
    --bv-tool-radius: 12px;
    --bv-tool-radius-lg: 16px;
    --bv-tool-radius-xl: 24px;

    /* Transitions */
    --bv-tool-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===================================================================
   TOOL PAGE CONTAINER
   =================================================================== */
.bv-tool-page {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bv-tool-bg);
    min-height: 100vh;
    padding-bottom: 4rem;
}

.bv-tool-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

@media (min-width: 640px) {
    .bv-tool-container {
        padding: 0 1.5rem;
    }
}

@media (min-width: 1024px) {
    .bv-tool-container {
        padding: 0 2rem;
    }
}

/* ===================================================================
   TOOL HERO HEADER (LIGHT GRADIENT - CONSISTENT)
   =================================================================== */
.bv-tool-hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 3rem 1rem 2rem;
    margin-bottom: 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.bv-tool-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(255, 255, 255, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 50%, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

.bv-tool-hero-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
    margin: 0 auto;
}

.bv-tool-title {
    font-size: clamp(1.75rem, 5vw, 2.75rem);
    font-weight: 800;
    color: white;
    margin: 0 0 0.75rem;
    line-height: 1.2;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.bv-tool-subtitle {
    font-size: clamp(1rem, 2.5vw, 1.125rem);
    color: rgba(255, 255, 255, 0.9);
    margin: 0 0 1.5rem;
    line-height: 1.6;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Tool Stats Row */
.bv-tool-stats {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.bv-tool-stat {
    text-align: center;
    padding: 0.75rem 1.25rem;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: var(--bv-tool-radius);
    border: 1px solid rgba(255, 255, 255, 0.2);
    min-width: 90px;
}

.bv-tool-stat-number {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    line-height: 1.2;
}

.bv-tool-stat-label {
    display: block;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.8);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.25rem;
}

/* ===================================================================
   TOOL CARDS & SECTIONS (GLASSMORPHISM)
   =================================================================== */
.bv-tool-card {
    background: var(--bv-tool-card-bg);
    backdrop-filter: blur(10px);
    border-radius: var(--bv-tool-radius-lg);
    border: 1px solid var(--bv-tool-border);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--bv-tool-shadow);
    transition: var(--bv-tool-transition);
}

.bv-tool-card:hover {
    box-shadow: var(--bv-tool-shadow-lg);
    border-color: rgba(59, 130, 246, 0.3);
}

.bv-tool-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.bv-tool-card-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bv-tool-primary), var(--bv-tool-secondary));
    border-radius: var(--bv-tool-radius);
    color: white;
    font-size: 1.25rem;
}

.bv-tool-card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--bv-tool-text);
    margin: 0;
}

.bv-tool-card-description {
    font-size: 0.875rem;
    color: var(--bv-tool-text-muted);
    line-height: 1.6;
    margin: 0;
}

/* ===================================================================
   FORM ELEMENTS - UNIFIED STYLING
   =================================================================== */

/* Form Groups */
.bv-form-group {
    margin-bottom: 1.25rem;
}

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

.bv-form-hint {
    font-size: 0.75rem;
    color: var(--bv-tool-text-light);
    margin-top: 0.25rem;
}

/* Text Inputs */
.bv-input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    color: var(--bv-tool-text);
    background: white;
    border: 2px solid var(--bv-tool-border);
    border-radius: var(--bv-tool-radius);
    transition: var(--bv-tool-transition);
}

.bv-input:hover {
    border-color: #cbd5e1;
}

.bv-input:focus {
    outline: none;
    border-color: var(--bv-tool-border-focus);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.bv-input::placeholder {
    color: var(--bv-tool-text-light);
}

/* Select Dropdowns */
.bv-select {
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    font-size: 1rem;
    color: var(--bv-tool-text);
    background: white;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.75rem center;
    background-repeat: no-repeat;
    background-size: 1.25rem;
    border: 2px solid var(--bv-tool-border);
    border-radius: var(--bv-tool-radius);
    cursor: pointer;
    appearance: none;
    transition: var(--bv-tool-transition);
}

.bv-select:hover {
    border-color: #cbd5e1;
}

.bv-select:focus {
    outline: none;
    border-color: var(--bv-tool-border-focus);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Range Sliders */
.bv-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.2), rgba(139, 92, 246, 0.2));
    border-radius: 4px;
    cursor: pointer;
}

.bv-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    background: linear-gradient(135deg, var(--bv-tool-primary), var(--bv-tool-secondary));
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
    cursor: pointer;
    transition: var(--bv-tool-transition);
}

.bv-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.5);
}

.bv-slider::-moz-range-thumb {
    width: 22px;
    height: 22px;
    background: linear-gradient(135deg, var(--bv-tool-primary), var(--bv-tool-secondary));
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
    cursor: pointer;
}

/* ===================================================================
   BUTTONS - UNIFIED STYLING
   =================================================================== */
.bv-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--bv-tool-radius);
    border: none;
    cursor: pointer;
    transition: var(--bv-tool-transition);
    text-decoration: none;
}

.bv-btn-primary {
    background: linear-gradient(135deg, var(--bv-tool-primary), var(--bv-tool-secondary));
    color: white;
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.3);
}

.bv-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.bv-btn-primary:active {
    transform: translateY(0);
}

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

.bv-btn-secondary:hover {
    border-color: var(--bv-tool-primary);
    color: var(--bv-tool-primary);
}

.bv-btn-success {
    background: linear-gradient(135deg, var(--bv-tool-success), #059669);
    color: white;
}

.bv-btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.bv-btn-lg {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

.bv-btn-block {
    width: 100%;
}

.bv-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ===================================================================
   LOADING STATES
   =================================================================== */
.bv-loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(59, 130, 246, 0.2);
    border-top-color: var(--bv-tool-primary);
    border-radius: 50%;
    animation: bv-spin 0.8s linear infinite;
}

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

.bv-loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

.bv-loading-card {
    background: white;
    padding: 2rem;
    border-radius: var(--bv-tool-radius-lg);
    box-shadow: var(--bv-tool-shadow-lg);
    text-align: center;
}

.bv-loading-text {
    margin-top: 1rem;
    color: var(--bv-tool-text-muted);
    font-weight: 500;
}

/* ===================================================================
   RESULTS & OUTPUT DISPLAY
   =================================================================== */
.bv-results-section {
    margin-top: 2rem;
    animation: bv-fadeInUp 0.5s ease-out;
}

@keyframes bv-fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.bv-result-card {
    background: white;
    border-radius: var(--bv-tool-radius-lg);
    border: 2px solid var(--bv-tool-border);
    padding: 1.5rem;
    transition: var(--bv-tool-transition);
}

.bv-result-card:hover {
    border-color: rgba(59, 130, 246, 0.3);
    box-shadow: var(--bv-tool-shadow-lg);
}

.bv-result-card.bv-winner {
    border-color: var(--bv-tool-success);
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    animation: bv-winner-pulse 2s ease-in-out infinite;
}

@keyframes bv-winner-pulse {
    0%, 100% { box-shadow: 0 0 20px rgba(16, 185, 129, 0.2); }
    50% { box-shadow: 0 0 30px rgba(16, 185, 129, 0.4); }
}

.bv-result-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--bv-tool-primary), var(--bv-tool-secondary));
    color: white;
    font-weight: 700;
    font-size: 0.875rem;
    border-radius: 50%;
}

/* ===================================================================
   PROGRESS INDICATORS
   =================================================================== */
.bv-progress-bar {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}

.bv-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--bv-tool-primary), var(--bv-tool-secondary));
    border-radius: 4px;
    transition: width 0.5s ease;
    position: relative;
}

.bv-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: bv-shimmer 2s infinite;
}

@keyframes bv-shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Step Progress */
.bv-step-progress {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
    position: relative;
}

.bv-step-progress::before {
    content: '';
    position: absolute;
    top: 16px;
    left: 0;
    right: 0;
    height: 2px;
    background: #e2e8f0;
    z-index: 0;
}

.bv-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
}

.bv-step-number {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 50%;
    font-weight: 600;
    color: var(--bv-tool-text-muted);
    transition: var(--bv-tool-transition);
}

.bv-step.active .bv-step-number {
    background: linear-gradient(135deg, var(--bv-tool-primary), var(--bv-tool-secondary));
    border-color: var(--bv-tool-primary);
    color: white;
}

.bv-step.completed .bv-step-number {
    background: var(--bv-tool-success);
    border-color: var(--bv-tool-success);
    color: white;
}

.bv-step-label {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--bv-tool-text-muted);
    text-align: center;
}

/* ===================================================================
   TOOL FOOTER / DISCLAIMER
   =================================================================== */
.bv-tool-footer {
    margin-top: 3rem;
}

.bv-tool-disclaimer {
    background: var(--bv-tool-card-bg);
    border-radius: var(--bv-tool-radius-lg);
    padding: 1.5rem;
    text-align: center;
}

.bv-tool-disclaimer-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--bv-tool-text);
    margin: 0 0 0.75rem;
}

.bv-tool-disclaimer-text {
    font-size: 0.875rem;
    color: var(--bv-tool-text-muted);
    line-height: 1.6;
    margin: 0;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

/* ===================================================================
   RESPONSIVE ADJUSTMENTS
   =================================================================== */
@media (max-width: 640px) {
    .bv-tool-hero {
        padding: 2rem 1rem 1.5rem;
    }

    .bv-tool-stats {
        gap: 0.75rem;
    }

    .bv-tool-stat {
        padding: 0.5rem 0.75rem;
        min-width: 70px;
    }

    .bv-tool-stat-number {
        font-size: 1.25rem;
    }

    .bv-tool-card {
        padding: 1rem;
    }

    .bv-btn {
        padding: 0.75rem 1.25rem;
        font-size: 0.875rem;
    }

    .bv-btn-lg {
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }
}

/* ===================================================================
   DARK MODE SUPPORT
   =================================================================== */
[data-neve-theme="dark"] {
    --bv-tool-bg: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    --bv-tool-card-bg: rgba(31, 41, 55, 0.9);
    --bv-tool-glass-bg: rgba(31, 41, 55, 0.7);
    --bv-tool-text: #f9fafb;
    --bv-tool-text-muted: #9ca3af;
    --bv-tool-text-light: #6b7280;
    --bv-tool-border: #374151;
}

[data-neve-theme="dark"] .bv-tool-page {
    background: var(--bv-tool-bg);
}

[data-neve-theme="dark"] .bv-tool-card {
    background: var(--bv-tool-card-bg);
    border-color: var(--bv-tool-border);
}

[data-neve-theme="dark"] .bv-input,
[data-neve-theme="dark"] .bv-select {
    background: #374151;
    border-color: #4b5563;
    color: var(--bv-tool-text);
}

[data-neve-theme="dark"] .bv-input:focus,
[data-neve-theme="dark"] .bv-select:focus {
    border-color: var(--bv-tool-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

[data-neve-theme="dark"] .bv-btn-secondary {
    background: #374151;
    border-color: #4b5563;
    color: var(--bv-tool-text);
}

[data-neve-theme="dark"] .bv-result-card {
    background: #1f2937;
    border-color: #374151;
}

[data-neve-theme="dark"] .bv-result-card.bv-winner {
    background: linear-gradient(135deg, #064e3b 0%, #065f46 100%);
}

[data-neve-theme="dark"] .bv-loading-overlay {
    background: rgba(17, 24, 39, 0.9);
}

[data-neve-theme="dark"] .bv-loading-card {
    background: #1f2937;
}

[data-neve-theme="dark"] .bv-progress-bar {
    background: #374151;
}

[data-neve-theme="dark"] .bv-slider {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.3), rgba(139, 92, 246, 0.3));
}

[data-neve-theme="dark"] .bv-tool-disclaimer {
    background: var(--bv-tool-card-bg);
}

/* ===================================================================
   REDUCED MOTION SUPPORT
   =================================================================== */
@media (prefers-reduced-motion: reduce) {
    .bv-loading-spinner,
    .bv-progress-fill::after,
    .bv-result-card.bv-winner {
        animation: none;
    }

    .bv-btn,
    .bv-input,
    .bv-select,
    .bv-slider::-webkit-slider-thumb,
    .bv-tool-card,
    .bv-result-card {
        transition: none;
    }
}

/* ===================================================================
   FOCUS STATES FOR ACCESSIBILITY
   =================================================================== */
.bv-btn:focus-visible,
.bv-input:focus-visible,
.bv-select:focus-visible {
    outline: 2px solid var(--bv-tool-primary);
    outline-offset: 2px;
}

.bv-slider:focus-visible {
    outline: 2px solid var(--bv-tool-primary);
    outline-offset: 4px;
}
