/* P-Value & Power exercise — based on existing app style patterns */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    padding: 10px;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 20px;
}

/* ---- Header ---- */
.main-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.main-header h1 {
    font-size: 1.8rem;
    color: #232D4B;
    margin-bottom: 10px;
}

.main-header h2 {
    font-size: 1.4rem;
    color: #E57200;
    margin-bottom: 10px;
}

.main-header h3 {
    font-size: 1.2rem;
    color: #333;
    margin-bottom: 15px;
    font-weight: 500;
}

.attribution {
    font-size: 1rem;
    color: #666;
    margin-top: 10px;
}

.date {
    font-size: 0.9rem;
    color: #888;
    margin-top: 5px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
    flex-wrap: wrap;
}

.page-header h1 {
    font-size: 1.5rem;
    color: #232D4B;
    flex: 1;
    min-width: 200px;
}

.back-link {
    color: #E57200;
    text-decoration: none;
    font-size: 0.95rem;
    padding: 8px 12px;
    border: 1px solid #E57200;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.back-link:hover {
    background-color: #E57200;
    color: white;
}

/* ---- Navigation ---- */
.navigation { margin-top: 20px; }

.intro {
    text-align: center;
    margin-bottom: 30px;
    font-size: 1rem;
    color: #555;
    padding: 0 10px;
}

.exercise-nav {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.exercise-link {
    display: block;
    padding: 20px;
    background-color: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    text-decoration: none;
    color: #333;
    transition: all 0.2s;
    min-height: 80px;
}

.exercise-link:hover {
    background-color: #E57200;
    color: white;
    border-color: #E57200;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.exercise-link h4 { font-size: 1.2rem; margin-bottom: 8px; color: inherit; }
.exercise-link p { font-size: 0.95rem; color: inherit; opacity: 0.9; }

/* ---- Exercise layout ---- */
.exercise-container { width: 100%; }

.info-box {
    background-color: #e3f2fd;
    border-left: 4px solid #2196F3;
    padding: 12px 15px;
    margin-bottom: 15px;
    border-radius: 4px;
}

.info-box p { margin: 0; font-size: 0.95rem; }
.info-box p + p { margin-top: 8px; }

.canvas-container {
    width: 100%;
    margin: 20px 0;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px;
    overflow: hidden;
}

.canvas-container canvas {
    width: 100%;
    display: block;
}

/* ---- Stats / p-value display ---- */
.stats-display {
    background-color: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    margin: 15px 0;
    font-size: 0.95rem;
}

.stats-display p { margin: 5px 0; }
.stats-display strong { color: #232D4B; }

.pvalue-display {
    text-align: center;
    padding: 18px;
    border-radius: 8px;
    font-size: 1.3rem;
    font-weight: 600;
    margin: 15px 0;
    transition: background-color 0.3s;
}

.pvalue-significant {
    background-color: #fbe9e7;
    border: 2px solid #D55E00;
    color: #D55E00;
}

.pvalue-not-significant {
    background-color: #e8f5e9;
    border: 2px solid #388E3C;
    color: #388E3C;
}

.pvalue-pending {
    background-color: #f5f5f5;
    border: 2px solid #bdbdbd;
    color: #757575;
}

/* ---- Buttons ---- */
.buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
    justify-content: center;
}

.btn {
    padding: 12px 24px;
    font-size: 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    min-height: 44px;
    min-width: 120px;
}

.btn-primary { background-color: #E57200; color: white; }
.btn-primary:hover { background-color: #d16500; transform: translateY(-1px); box-shadow: 0 2px 6px rgba(0,0,0,0.2); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { background-color: #ccc; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-secondary { background-color: #6c757d; color: white; }
.btn-secondary:hover { background-color: #5a6268; transform: translateY(-1px); box-shadow: 0 2px 6px rgba(0,0,0,0.2); }
.btn-secondary:active { transform: translateY(0); }

/* ---- Quiz styles ---- */
.quiz-form { max-width: 700px; margin: 0 auto; }

.question-block {
    background-color: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.question-prompt {
    font-weight: 600;
    font-size: 1.05rem;
    margin-bottom: 14px;
    color: #232D4B;
}

.previous-answer {
    font-size: 0.85rem;
    color: #888;
    font-style: italic;
    margin-bottom: 10px;
    padding: 6px 10px;
    background-color: #f0f0f0;
    border-radius: 4px;
}

.options-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.option-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.15s;
}

.option-label:hover { background-color: #e8e8e8; }

.option-label input[type="radio"] {
    margin-top: 4px;
    accent-color: #E57200;
}

.option-label.correct-option {
    background-color: #e8f5e9;
    border: 1px solid #66bb6a;
}

.option-label.incorrect-option {
    background-color: #fce4ec;
    border: 1px solid #ef5350;
}

.feedback {
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: 6px;
    font-size: 0.93rem;
    line-height: 1.5;
}

.feedback-correct {
    background-color: #e8f5e9;
    border-left: 4px solid #66bb6a;
    color: #2e7d32;
}

.feedback-incorrect {
    background-color: #fce4ec;
    border-left: 4px solid #ef5350;
    color: #c62828;
}

.quiz-error {
    color: #c62828;
    text-align: center;
    font-weight: 500;
    margin-top: 10px;
}

/* ---- Secondary outcomes ---- */
.secondary-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin: 20px 0;
}

.outcome-card {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 18px;
    background-color: #f8f9fa;
    transition: border-color 0.3s;
}

.outcome-card.significant {
    border-color: #D55E00;
    background-color: #fff3e0;
}

.outcome-card h4 {
    color: #232D4B;
    margin-bottom: 10px;
    font-size: 1rem;
}

.outcome-card .rates {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.outcome-card .outcome-pvalue {
    font-weight: 600;
    font-size: 1rem;
}

/* ---- Controls (power explorer) ---- */
.controls {
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
}

.control-group {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.control-group label {
    font-weight: 500;
    min-width: 150px;
    font-size: 0.95rem;
}

.control-group input[type="range"] {
    flex: 1;
    min-width: 200px;
    height: 8px;
    border-radius: 5px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 24px; height: 24px; border-radius: 50%;
    background: #E57200; cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.control-group input[type="range"]::-moz-range-thumb {
    width: 24px; height: 24px; border-radius: 50%;
    background: #E57200; cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.control-group span {
    font-weight: 600;
    color: #E57200;
    min-width: 50px;
    text-align: right;
    font-size: 1rem;
}

/* Toggle switch */
.toggle-group {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
}

.toggle-group label { font-weight: 500; font-size: 0.95rem; }

.toggle-switch {
    position: relative;
    width: 50px;
    height: 26px;
    flex-shrink: 0;
}

.toggle-switch input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
    position: absolute;
    inset: 0;
    background-color: #ccc;
    border-radius: 26px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 20px; width: 20px;
    left: 3px; bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s;
}

.toggle-switch input:checked + .toggle-slider { background-color: #E57200; }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(24px); }

/* Parameters display */
.params-display {
    display: flex;
    gap: 30px;
    justify-content: center;
    margin: 18px 0;
    flex-wrap: wrap;
}

.param-box {
    text-align: center;
    padding: 12px 20px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    background: #f8f9fa;
    min-width: 140px;
}

.param-box .param-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #888;
    margin-bottom: 4px;
}

.param-box .param-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: #232D4B;
}

/* Simulation grid (power explorer) */
.sim-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin: 20px 0;
}

.sim-card {
    text-align: center;
    border-radius: 6px;
    padding: 12px 8px;
    border: 2px solid #e0e0e0;
    background: #fafafa;
    transition: all 0.3s;
}

.sim-card.significant {
    border-color: #D55E00;
    background-color: #fff3e0;
}

.sim-card .sim-label {
    font-size: 0.75rem;
    color: #888;
    margin-bottom: 2px;
}

.sim-card .sim-pvalue {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
}

.sim-card.significant .sim-pvalue {
    color: #D55E00;
}

.sim-summary {
    text-align: center;
    font-size: 1.1rem;
    font-weight: 500;
    margin: 15px 0;
    color: #232D4B;
}

/* Legend */
.legend {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin: 10px 0 5px;
    font-size: 0.85rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-swatch {
    width: 14px;
    height: 14px;
    border-radius: 3px;
}

/* ---- Responsive ---- */
@media (min-width: 768px) {
    body { padding: 20px; }
    .container { max-width: 900px; padding: 30px; }
    .main-header h1 { font-size: 2.2rem; }
    .main-header h2 { font-size: 1.8rem; }
    .page-header h1 { font-size: 1.8rem; }
    .secondary-grid { grid-template-columns: 1fr 1fr; }
    .sim-grid { grid-template-columns: repeat(5, 1fr); }
}

@media (orientation: landscape) and (max-height: 500px) {
    .main-header { margin-bottom: 15px; padding-bottom: 10px; }
    .main-header h1 { font-size: 1.5rem; }
}

@media print {
    body { background-color: white; }
    .buttons, .controls { display: none; }
}
