/* ClinBI ROI Calculator Styles */

/* CSS Variables for ClinBI Color Palette */
:root {
    --primary-blue: #0059FF;
    --primary-blue-hover: #0047CC;
    --primary-blue-light: #E6F0FF;
    --success-green: #10B981;
    --success-green-light: #D1FAE5;
    --purple: #8B5CF6;
    --purple-light: #EDE9FE;
    --text-dark: #111827;
    --text-gray: #6B7280;
    --text-light: #9CA3AF;
    --background-light: #F9FAFB;
    --background-white: #FFFFFF;
    --border-gray: #E5E7EB;
    --border-light: #F3F4F6;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Base Styles */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text-dark);
    background-color: transparent;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* Vertical Layout */
.vertical-layout {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0;
    background-color: transparent;
}

.input-panel {
    background-color: transparent;
    border-bottom: none;
    margin-bottom: 1rem;
}

.input-content {
    padding: 1rem;
}

.results-panel {
    background-color: transparent;
    border-radius: 0;
    box-shadow: none;
    margin-bottom: 1rem;
}

.results-content {
    padding: 1rem;
}

/* Header */
.header-section {
    margin-bottom: 1rem;
    text-align: center;
}

.calculator-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
}

.calculator-subtitle {
    font-size: 1rem;
    color: var(--text-gray);
    margin-bottom: 0;
}

/* User Type Selection */
.user-type-section {
    margin-bottom: 2rem;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 1rem;
}

.user-type-buttons {
    display: flex;
    flex-direction: row;
    gap: 1rem;
}

.user-type-btn {
    display: flex;
    align-items: center;
    padding: 1rem;
    border: 2px solid var(--border-gray);
    border-radius: 0.75rem;
    background-color: var(--background-white);
    color: var(--text-dark);
    transition: all 0.2s ease;
    text-align: left;
    width: 100%;
}

.user-type-btn:hover {
    border-color: var(--primary-blue);
    box-shadow: var(--shadow-md);
}

.user-type-btn.active {
    border-color: var(--primary-blue);
    background-color: var(--primary-blue-light);
    color: var(--primary-blue);
}

.user-type-icon {
    font-size: 1.5rem;
    margin-right: 1rem;
    color: var(--text-gray);
    font-weight: 600;
    transition: color 0.2s ease;
}

.user-type-btn.active .user-type-icon {
    color: var(--primary-blue);
}

.user-type-btn:hover .user-type-icon {
    color: var(--primary-blue);
}

.user-type-text {
    flex: 1;
}

.user-type-text strong {
    display: block;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.user-type-text small {
    color: var(--text-gray);
    font-size: 0.875rem;
}

/* Input Sections */
.input-section {
    margin-bottom: 1rem;
}

.dso-indicator {
    color: var(--text-gray);
    font-weight: 400;
    font-size: 0.875rem;
}

.dso-only .dso-indicator {
    color: var(--primary-blue);
}

/* DSO Practice Count Section */
.dso-only {
    margin-bottom: 1rem;
}

.dso-only .input-group {
    margin-bottom: 0;
}

.input-group {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    position: relative;
}

.range-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 0 0 auto;
}

.form-label {
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 0;
    display: inline-block;
    flex: 1;
    min-width: 280px;
}

.form-control {
    border: 1px solid var(--border-gray);
    border-radius: 0.5rem;
    padding: 0.75rem;
    font-size: 1rem;
    transition: all 0.2s ease;
    background-color: var(--background-white);
}

.form-control:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    outline: none;
}

.form-range {
    width: 400px;
    margin: 0;
    flex: 0 0 auto;
    -webkit-appearance: none;
    background: transparent;
}

/* Webkit track */
.form-range::-webkit-slider-track {
    width: 100%;
    height: 8px;
    background: #d1d5db;
    border-radius: 4px;
}

.form-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    background-color: var(--primary-blue);
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    cursor: pointer;
}

/* Firefox track */
.form-range::-moz-range-track {
    width: 100%;
    height: 8px;
    background: #d1d5db;
    border-radius: 4px;
    border: none;
}

.form-range::-moz-range-thumb {
    background-color: var(--primary-blue);
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.range-labels {
    display: flex;
    justify-content: center;
    font-size: 0.75rem;
    color: var(--text-gray);
    margin-top: 0.125rem;
    width: 400px;
}

/* Submit Section */
.submit-section {
    margin-top: 2rem;
    text-align: center;
}

.btn-submit {
    background-color: var(--primary-blue);
    color: white;
    border: none;
    padding: 1rem 2rem;
    font-size: 1.125rem;
    font-weight: 600;
    border-radius: 0.75rem;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-md);
    width: 100%;
}

.btn-submit:hover {
    background-color: var(--primary-blue-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

.btn-submit:disabled {
    background-color: var(--text-light);
    color: var(--background-white);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-submit:disabled:hover {
    background-color: var(--text-light);
    transform: none;
    box-shadow: none;
}

.btn-submit.calculation-complete {
    background-color: var(--text-light) !important;
    color: var(--background-white) !important;
    opacity: 1;
    cursor: not-allowed;
}

.btn-submit:not(.calculation-complete) {
    background-color: var(--primary-blue) !important;
    color: var(--background-white) !important;
}

/* Results panel always visible but values hidden initially */
.results-panel {
    display: block;
}

/* Initially hide actual values and charts */
.metric-value,
.pillar-value,
.sub-item span:last-child,
.chart-container,
.chart-footnote,
.insights-section {
    opacity: 0.3;
    color: #ccc;
}

.metric-value::after,
.pillar-value::after,
.sub-item span:last-child::after {
    content: "–";
}

/* Show values after calculation */
.results-calculated .metric-value,
.results-calculated .pillar-value,
.results-calculated .sub-item span:last-child,
.results-calculated .chart-container,
.results-calculated .chart-footnote,
.results-calculated .insights-section {
    opacity: 1;
    color: inherit;
}

.results-calculated .metric-value::after,
.results-calculated .pillar-value::after,
.results-calculated .sub-item span:last-child::after {
    content: "";
}

/* Headline Results */
.headline-results {
    margin-bottom: 1rem;
}

.metric-card {
    background-color: var(--background-white);
    border-radius: 0.75rem;
    padding: 1rem;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-light);
    margin-bottom: 0.75rem;
    transition: transform 0.2s ease;
}

.metric-card:hover {
    transform: translateY(-2px);
}

.metric-card.primary {
    border-left: 4px solid var(--primary-blue);
}

.metric-card.success {
    border-left: 4px solid var(--success-green);
}

.metric-card.purple {
    border-left: 4px solid var(--purple);
}

.metric-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.metric-card.primary .metric-icon {
    color: var(--primary-blue);
}

.metric-card.success .metric-icon {
    color: var(--success-green);
}

.metric-card.purple .metric-icon {
    color: var(--purple);
}

.metric-value {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.metric-card.primary .metric-value {
    color: var(--primary-blue);
}

.metric-card.success .metric-value {
    color: var(--success-green);
}

.metric-card.purple .metric-value {
    color: var(--purple);
}

.metric-label {
    font-size: 0.75rem;
    color: var(--text-gray);
    font-weight: 500;
}

/* Breakdown Section */
.breakdown-section {
    margin-bottom: 1rem;
}

.breakdown-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 1rem;
    text-align: center;
}

.pillar-card {
    background-color: var(--background-white);
    border-radius: 0.5rem;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-light);
    height: 100%;
}

.pillar-header {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

.pillar-icon {
    font-size: 1.5rem;
    margin-right: 0.75rem;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pillar-icon.time {
    background-color: var(--primary-blue-light);
    color: var(--primary-blue);
    font-weight: 600;
}

.pillar-icon.cost {
    background-color: var(--success-green-light);
    color: var(--success-green);
    font-weight: 600;
}

.pillar-icon.revenue {
    background-color: var(--purple-light);
    color: var(--purple);
    font-weight: 600;
}

.pillar-header h4 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0;
}

.pillar-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-blue);
    margin-bottom: 0.5rem;
}

.pillar-description {
    font-size: 0.875rem;
    color: var(--text-gray);
    margin-bottom: 1rem;
}

.sub-breakdown {
    border-top: 1px solid var(--border-light);
    padding-top: 1rem;
}

.sub-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    font-size: 0.875rem;
}

.sub-item span:first-child {
    color: var(--text-gray);
}

.sub-item span:last-child {
    font-weight: 600;
    color: var(--text-dark);
}

/* Chart Section */
.chart-section {
    margin-bottom: 1rem;
}

.chart-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 1rem;
    text-align: center;
}

.chart-container {
    background-color: var(--background-white);
    border-radius: 0.75rem;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-light);
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chart-container canvas {
    max-width: 100%;
    max-height: 100%;
}

.chart-footnote {
    font-size: 0.75rem;
    color: var(--text-gray);
    margin-top: 0.5rem;
    margin-bottom: 0;
    text-align: center;
    font-style: italic;
}

/* Call to Action */
.cta-section {
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-blue-hover));
    border-radius: 0.75rem;
    padding: 1.5rem 1rem;
    text-align: center;
    color: white;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.cta-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.cta-description {
    font-size: 1rem;
    margin-bottom: 1.5rem;
    opacity: 0.9;
}

.btn-cta {
    background-color: white;
    color: var(--primary-blue);
    border: none;
    padding: 1rem 2rem;
    font-size: 1.125rem;
    font-weight: 600;
    border-radius: 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-md);
    text-decoration: none;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.btn-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;
}

.btn-cta:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    color: var(--primary-blue-hover);
    background-color: #f8faff;
}

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

.btn-cta:active {
    transform: translateY(0);
    transition: all 0.1s ease;
}

.btn-cta:focus {
    outline: 2px solid var(--primary-blue);
    outline-offset: 2px;
}

.cta-icon {
    font-size: 1.25rem;
}

/* Disclaimer */
.disclaimer-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-light);
}

.disclaimer-text {
    font-size: 0.75rem;
    color: var(--text-gray);
    line-height: 1.4;
    margin: 0;
    text-align: center;
}

/* Responsive Design */
@media (max-width: 991.98px) {
    .input-panel,
    .results-panel {
        max-height: none;
    }
    
    .input-content,
    .results-content {
        padding: 1.5rem;
    }
    
    .calculator-title {
        font-size: 1.75rem;
    }
    
    .user-type-buttons {
        flex-direction: column;
    }
    
    .metric-card {
        margin-bottom: 1rem;
    }
    
    .cta-section {
        padding: 2rem 1.5rem;
    }
    
    .cta-title {
        font-size: 1.5rem;
    }
    
    .input-group {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .form-label {
        min-width: auto;
        margin-bottom: 0.25rem;
        text-align: left;
    }
    
    .form-range {
        width: 100%;
    }
    
    .range-labels {
        width: 100%;
    }
}

@media (max-width: 575.98px) {
    .input-content,
    .results-content {
        padding: 1rem;
    }
    
    .calculator-title {
        font-size: 1.5rem;
    }
    
    .metric-value {
        font-size: 1.5rem;
    }
    
    .pillar-value {
        font-size: 1.25rem;
    }
    
    .input-group {
        gap: 0.25rem;
    }
    
    .form-label {
        font-size: 0.9rem;
    }
}

/* Animation for smooth transitions */
.metric-card,
.pillar-card {
    transition: all 0.3s ease;
}

/* Enhanced Loading state styles */
.calculating {
    position: relative;
}

.calculating::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(0, 89, 255, 0.1), rgba(255, 255, 255, 0.95));
    backdrop-filter: blur(4px);
    z-index: 9999;
    animation: fadeIn 0.3s ease-in-out;
}

.loading-spinner {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10001;
}

.spinner-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.spinner-ring {
    width: 80px;
    height: 80px;
    border: 6px solid var(--border-light);
    border-top: 6px solid var(--primary-blue);
    border-radius: 50%;
    animation: smoothSpin 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94) infinite;
    box-shadow: 0 4px 20px rgba(0, 89, 255, 0.2);
}

.spinner-dots {
    display: flex;
    gap: 8px;
    margin-top: 1rem;
}

.spinner-dot {
    width: 12px;
    height: 12px;
    background-color: var(--primary-blue);
    border-radius: 50%;
    animation: dotPulse 1.4s ease-in-out infinite;
    opacity: 0.3;
}

.spinner-dot:nth-child(1) { animation-delay: 0s; }
.spinner-dot:nth-child(2) { animation-delay: 0.2s; }
.spinner-dot:nth-child(3) { animation-delay: 0.4s; }

.loading-text {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary-blue);
    text-align: center;
    animation: textPulse 2s ease-in-out infinite;
}

.loading-subtitle {
    font-size: 0.875rem;
    color: var(--text-gray);
    text-align: center;
    margin-top: 0.5rem;
    opacity: 0.8;
}

/* Enhanced animations */
@keyframes smoothSpin {
    0% { 
        transform: translate(-50%, -50%) rotate(0deg);
        border-top-color: var(--primary-blue);
    }
    25% {
        border-top-color: var(--success-green);
    }
    50% { 
        transform: translate(-50%, -50%) rotate(180deg);
        border-top-color: var(--purple);
    }
    75% {
        border-top-color: var(--primary-blue);
    }
    100% { 
        transform: translate(-50%, -50%) rotate(360deg);
        border-top-color: var(--primary-blue);
    }
}

@keyframes dotPulse {
    0%, 20% {
        opacity: 0.3;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.3);
    }
    80%, 100% {
        opacity: 0.3;
        transform: scale(1);
    }
}

@keyframes textPulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Progress bar animation */
.loading-progress {
    width: 200px;
    height: 4px;
    background-color: var(--border-light);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 1rem;
}

.loading-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-blue), var(--success-green), var(--purple));
    background-size: 200% 100%;
    animation: progressSlide 2s ease-in-out infinite;
    border-radius: 2px;
}

@keyframes progressSlide {
    0% {
        transform: translateX(-100%);
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        transform: translateX(100%);
        background-position: 0% 50%;
    }
}

/* AI Insights Section */
.insights-section {
    margin-bottom: 1rem;
}

.insights-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 1.5rem;
    text-align: center;
}

.insights-container {
    background-color: var(--background-white);
    border-radius: 0.5rem;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-light);
    border-left: 4px solid var(--primary-blue);
}

.insights-loading {
    text-align: center;
    padding: 2rem 0;
}

.insights-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-light);
    border-top: 3px solid var(--primary-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

.insights-content {
    line-height: 1.6;
}

.insights-content .insight-point {
    margin-bottom: 1rem;
    padding-left: 1rem;
    border-left: 2px solid var(--primary-blue-light);
}

.insights-content .insight-point strong {
    color: var(--text-dark);
    font-weight: 600;
}

.insights-content p {
    margin-bottom: 0.75rem;
    color: var(--text-dark);
    font-weight: normal;
}

.insights-content strong {
    color: var(--text-dark);
    font-weight: 600;
}

.insights-content {
    color: var(--text-dark);
    font-weight: normal;
}

/* Custom scrollbar for webkit browsers */
.input-panel::-webkit-scrollbar,
.results-panel::-webkit-scrollbar {
    width: 6px;
}

.input-panel::-webkit-scrollbar-track,
.results-panel::-webkit-scrollbar-track {
    background: var(--background-light);
}

.input-panel::-webkit-scrollbar-thumb,
.results-panel::-webkit-scrollbar-thumb {
    background: var(--border-gray);
    border-radius: 3px;
}

.input-panel::-webkit-scrollbar-thumb:hover,
.results-panel::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}
