/* --- SD Calculator UI Alignment (Matched to Image) --- */
.calculator-wrapper {
    max-width: 1000px;
    margin: 0 auto;
}

.calc-card {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
    padding: 2rem;
}

.sd-input-label {
    display: block;
    color: #1e293b;
    font-weight: 600;
    margin-bottom: 10px;
    font-size: 1rem;
}

.sd-data-input {
    width: 100%;
    min-height: 120px;
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 15px;
    font-family: 'Courier New', monospace;
    resize: vertical;
    transition: all 0.3s;
    background-color: #f8fafc;
}

.sd-data-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    background-color: #fff;
}

.sd-input-help {
    font-size: 0.85rem;
    color: #64748b;
    margin-top: 8px;
    font-style: italic;
}

/* Sample Data Buttons */
.sd-sample-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 15px 0 25px;
}

.sd-sample-btn {
    padding: 8px 15px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 13px;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.sd-sample-btn:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
    color: #2563eb;
}

/* Type Selection */
.sd-type-section {
    background: #f8fafc;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 25px;
    display: flex;
    justify-content: center;
    gap: 40px;
    border: 1px solid #e2e8f0;
}

.sd-radio-group {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.sd-radio-group input[type="radio"] {
    margin-right: 10px;
    width: 18px;
    height: 18px;
    accent-color: #2563eb;
}

.sd-radio-group label {
    cursor: pointer;
    color: #1e293b;
    font-size: 1rem;
    font-weight: 600;
}

/* Action Buttons */
.sd-button-section {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
}

.sd-btn {
    flex: 1;
    padding: 14px 24px;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sd-btn-calculate {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.sd-btn-calculate:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}

.sd-btn-clear {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
}

.sd-btn-clear:hover {
    background: #e2e8f0;
}

/* Results Section */
.sd-results-section {
    display: none;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #eee;
}

.sd-results-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.sd-results-grid.secondary {
    grid-template-columns: repeat(3, 1fr);
    max-width: 60%;
    margin: 0 auto 30px;
}

.sd-result-card {
    background: #ffffff;
    padding: 15px 10px;
    border-radius: 12px;
    text-align: center;
    border: 1px solid #f1f5f9;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

.sd-result-label {
    font-size: 0.65rem;
    color: #94a3b8;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
}

.sd-result-value {
    font-size: 1.25rem;
    font-weight: 800;
    color: #1e293b;
}

.sd-result-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    box-shadow: 0 10px 15px -3px rgba(118, 75, 162, 0.3);
}

.sd-result-primary .sd-result-label {
    color: rgba(255, 255, 255, 0.8);
}

.sd-result-primary .sd-result-value {
    color: white;
}

/* Confidence Intervals Table (Red Theme) */
.sd-confidence-section {
    background: #fff5f5;
    border: 1px solid #fee2e2;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
}

.sd-confidence-title {
    font-size: 1rem;
    font-weight: 700;
    color: #dc2626;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sd-confidence-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

.sd-confidence-table th,
.sd-confidence-table td {
    padding: 10px;
    text-align: center;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.85rem;
}

.sd-confidence-table th {
    background: #f8fafc;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    font-size: 0.7rem;
}

.sd-confidence-table .confidence-level {
    font-weight: 700;
    color: #dc2626;
}

.sd-error-bar {
    display: inline-block;
    background: linear-gradient(90deg, transparent 30%, #dc2626 30%, #dc2626 70%, transparent 70%);
    height: 3px;
    position: relative;
    margin: 0 5px;
    width: 40px;
}

.sd-error-bar::before,
.sd-error-bar::after {
    content: '';
    position: absolute;
    width: 2px;
    height: 10px;
    background: #dc2626;
    top: -4px;
}

.sd-error-bar::before {
    left: 30%;
}

.sd-error-bar::after {
    right: 30%;
}

/* Formula Section (Blue Theme) */
.sd-formula-section {
    background: #f1f5f9;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
}

.sd-formula-title {
    font-size: 1rem;
    font-weight: 700;
    color: #334155;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sd-formula {
    background: white;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 15px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.sd-formula-step {
    font-size: 0.9rem;
    color: #475569;
    margin-bottom: 8px;
    font-weight: 700;
}

.sd-formula-math {
    font-family: 'Courier New', monospace;
    background: #f8fafc;
    padding: 12px;
    border-radius: 6px;
    margin: 8px 0;
    font-size: 0.85rem;
    color: #1e293b;
    border: 1px solid #f1f5f9;
    line-height: 1.6;
}

.sd-formula-result {
    font-weight: 700;
    color: #2563eb;
    font-size: 1rem;
    margin-top: 5px;
}

/* Chart */
.sd-chart-section {
    margin-top: 25px;
    background: #f8fafc;
    border-radius: 12px;
    padding: 20px;
}

.sd-chart-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #475569;
    margin-bottom: 15px;
}

.sd-chart {
    height: 200px;
    display: flex;
    align-items: flex-end;
    gap: 2px;
    background: white;
    padding: 15px;
    border-radius: 8px;
}

.sd-bar {
    flex: 1;
    background: linear-gradient(180deg, #764ba2 0%, #667eea 100%);
    border-radius: 4px 4px 0 0;
    min-height: 2px;
}

.sd-bar-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    display: none;
    margin-bottom: 8px;
    z-index: 10;
}

.sd-bar:hover .sd-bar-tooltip {
    display: block;
}

.sd-error-msg {
    background: #fef2f2;
    border: 1px solid #fee2e2;
    color: #b91c1c;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: none;
    font-weight: 500;
}

@media (max-width: 600px) {
    .sd-results-grid {
        grid-template-columns: 1fr 1fr;
    }

    .sd-button-section {
        flex-direction: column;
    }
}