/* Standard Deviation Calculator — style.css v1.0 */

.sdc-wrap {
    max-width: 660px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #1a1a1a;
}

/* Header */
.sdc-header { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.sdc-icon   {
    width: 46px; height: 46px; border-radius: 12px;
    background: linear-gradient(135deg,#2563EB,#1e40af);
    color: #fff; font-size: 22px; font-weight: 700; font-family: serif;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.sdc-title  {
    font-size: 22px !important; font-weight: 600 !important;
    margin: 0 0 3px !important; padding: 0 !important;
    border: none !important; color: #1a1a1a !important;
}
.sdc-sub { font-size: 13px; color: #666; margin: 0; }

/* Section label */
.sdc-section-lbl {
    font-size: 11px; font-weight: 700; color: #999;
    text-transform: uppercase; letter-spacing: .6px; margin-bottom: 10px;
    display: flex; align-items: center; justify-content: space-between;
}

/* Textarea */
.sdc-input-section { margin-bottom: 4px; }
.sdc-section-lbl:first-child { margin-bottom: 8px; }
.sdc-textarea {
    width: 100%; box-sizing: border-box;
    min-height: 100px; padding: 12px 14px;
    border: 1.5px solid #d0d0d0; border-radius: 10px;
    font-size: 14px; color: #1a1a1a; background: #fff;
    outline: none; resize: vertical; font-family: inherit;
    transition: border-color .15s; line-height: 1.6;
}
.sdc-textarea:focus { border-color: #2563EB; box-shadow: 0 0 0 3px rgba(37,99,235,.1); }

/* Controls row */
.sdc-input-controls {
    display: flex; gap: 10px; align-items: stretch; margin-top: 10px;
}

/* Sample/Population toggle */
.sdc-type-toggle {
    display: flex; border: 1.5px solid #d0d0d0; border-radius: 9px; overflow: hidden; flex: 1;
}
.sdc-tbtn {
    flex: 1; padding: 10px 12px; border: none; border-right: 1px solid #d0d0d0;
    background: #fff; color: #555; cursor: pointer;
    transition: background .13s; text-align: center;
    display: flex; flex-direction: column; align-items: center; gap: 1px;
}
.sdc-tbtn:last-child { border-right: none; }
.sdc-tbtn strong { font-size: 13px; }
.sdc-tbtn span   { font-size: 11px; color: #999; }
.sdc-tbtn:hover:not(.act) { background: #eff6ff; }
.sdc-tbtn.act { background: #dbeafe; color: #1e40af; }
.sdc-tbtn.act span { color: #3b82f6; }

/* Calculate button */
.sdc-calc-btn {
    padding: 10px 20px; background: linear-gradient(135deg,#2563EB,#1e40af);
    color: #fff; border: none; border-radius: 9px;
    font-size: 14px; font-weight: 600; cursor: pointer;
    transition: opacity .13s; white-space: nowrap;
}
.sdc-calc-btn:hover { opacity: .9; }

/* Sample data buttons */
.sdc-sample-btns { display: flex; align-items: center; gap: 7px; margin-top: 8px; flex-wrap: wrap; }
.sdc-sample-lbl  { font-size: 12px; color: #888; }
.sdc-sample-btn  {
    padding: 4px 10px; font-size: 12px;
    border: 1px solid #d0d0d0; border-radius: 6px;
    background: #fff; color: #555; cursor: pointer;
    transition: background .13s;
}
.sdc-sample-btn:hover { background: #eff6ff; border-color: #93c5fd; color: #1e40af; }

/* Primary result cards */
.sdc-primary-cards {
    display: grid; grid-template-columns: repeat(3,1fr);
    gap: 10px; margin-top: 20px;
    animation: sdc-in .22s ease;
}
@media (max-width: 480px) { .sdc-primary-cards { grid-template-columns: 1fr 1fr; } }
@keyframes sdc-in { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:translateY(0); } }

.sdc-primary-card {
    border-radius: 12px; padding: 14px 12px;
    text-align: center; border: 1px solid;
}
.sdc-card-sd       { background: #1e40af; color: #fff; border-color: #1e40af; }
.sdc-card-variance { background: #dbeafe; border-color: #93c5fd; }
.sdc-card-mean     { background: #dcfce7; border-color: #86efac; }
.sdc-card-sd .sdc-primary-val { color: #fff; }
.sdc-card-variance .sdc-primary-val { color: #1e40af; }
.sdc-card-mean .sdc-primary-val { color: #166534; }

.sdc-primary-val { font-size: 22px; font-weight: 700; margin-bottom: 4px; font-family: monospace; }
.sdc-primary-lbl { font-size: 11px; opacity: .8; }
.sdc-card-sd .sdc-primary-lbl { opacity: .75; }

/* Stats grid */
.sdc-stats-grid-inner {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 1px; background: #e8e8e8;
    border: 1px solid #e8e8e8; border-radius: 10px; overflow: hidden;
    margin-bottom: 14px;
}
.sdc-stat-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 9px 14px; background: #fff; font-size: 13px;
}
.sdc-stat-lbl { color: #555; }
.sdc-stat-val { font-weight: 600; color: #1a1a1a; font-family: monospace; }
.sdc-stat-row:hover { background: #f8faff; }

/* Confidence intervals */
.sdc-ci-table {
    width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 14px;
}
.sdc-ci-table th {
    padding: 7px 10px; text-align: left; color: #888;
    font-size: 11px; text-transform: uppercase; letter-spacing: .4px;
    border-bottom: 1px solid #e8e8e8; background: #fafafa; font-weight: 600;
}
.sdc-ci-table th:last-child { text-align: right; }
.sdc-ci-table td { padding: 8px 10px; border-bottom: 1px solid #f0f0f0; font-size: 13px; }
.sdc-ci-table td:last-child { text-align: right; font-family: monospace; font-weight: 600; }
.sdc-ci-table tr:last-child td { border-bottom: none; }

/* Distribution bar chart */
.sdc-dist-wrap { background: #fafafa; border: 1px solid #e8e8e8; border-radius: 10px; padding: 14px 16px; margin-bottom: 14px; }
.sdc-dist-chart { display: flex; align-items: flex-end; gap: 3px; height: 80px; margin-bottom: 6px; }
.sdc-dist-bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; }
.sdc-dist-bar {
    width: 100%; border-radius: 3px 3px 0 0;
    background: linear-gradient(180deg,#2563EB,#1e40af);
    min-height: 3px; transition: height .4s ease;
}
.sdc-dist-bar.highlight { background: linear-gradient(180deg,#f59e0b,#d97706); }
.sdc-dist-label { font-size: 9px; color: #888; margin-top: 3px; text-align: center; white-space: nowrap; overflow: hidden; max-width: 40px; text-overflow: ellipsis; }

.sdc-dist-legend { display: flex; gap: 14px; font-size: 12px; color: #888; flex-wrap: wrap; }
.sdc-dist-legend-item { display: flex; align-items: center; gap: 5px; }
.sdc-legend-dot { width: 10px; height: 10px; border-radius: 2px; }
.sdc-legend-dot-blue   { background: #2563EB; }
.sdc-legend-dot-orange { background: #f59e0b; }

/* Steps toggle */
.sdc-toggle-steps {
    font-size: 11px; padding: 3px 8px; border: 1px solid #d0d0d0;
    border-radius: 6px; background: #fff; color: #555; cursor: pointer;
    text-transform: none; letter-spacing: 0; font-weight: 500;
}
.sdc-toggle-steps:hover { background: #eff6ff; }

/* Steps */
.sdc-steps-block { background: #fafafa; border: 1px solid #e8e8e8; border-radius: 10px; overflow: hidden; margin-bottom: 14px; }
.sdc-step { display: flex; gap: 12px; padding: 11px 16px; border-bottom: 1px solid #f0f0f0; font-size: 13px; }
.sdc-step:last-child { border-bottom: none; }
.sdc-step-num {
    width: 22px; height: 22px; border-radius: 50%;
    background: #2563EB; color: #fff; font-size: 11px; font-weight: 700;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 2px;
}
.sdc-step-body { flex: 1; }
.sdc-step-title  { font-weight: 600; color: #1a1a1a; margin-bottom: 3px; }
.sdc-step-detail { color: #555; line-height: 1.6; font-family: monospace; font-size: 12px; }

/* Deviation table */
table.sdc-dev-table {
    width: 100%; border-collapse: collapse; font-size: 12px; margin-bottom: 14px;
}
table.sdc-dev-table th {
    padding: 7px 8px; text-align: right; color: #888;
    font-size: 11px; text-transform: uppercase; letter-spacing: .3px;
    border-bottom: 1px solid #e8e8e8; background: #fafafa;
}
table.sdc-dev-table th:first-child { text-align: center; }
table.sdc-dev-table th:nth-child(2) { text-align: right; }
table.sdc-dev-table td { padding: 6px 8px; border-bottom: 1px solid #f5f5f5; text-align: right; font-family: monospace; }
table.sdc-dev-table td:first-child { text-align: center; color: #888; font-family: inherit; }
table.sdc-dev-table tfoot td { background: #f0f6ff; font-weight: 700; border-top: 1px solid #e8e8e8; }
table.sdc-dev-table tr:hover td { background: #f8faff; }

/* Error */
.sdc-error-box { background: #fee2e2; border: 1px solid #fca5a5; border-radius: 9px; padding: 12px 16px; margin-top: 14px; font-size: 13px; color: #991b1b; }
