/* Styles for the passage containers */
.passages-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 40px;
}

.passage {
    flex: 1;
    min-width: 300px;
    border: 1px solid #ccc;
    padding: 15px;
    position: relative;
}

.passage-number {
    position: absolute;
    top: -15px;
    left: -15px;
    width: 30px;
    height: 30px;
    background-color: #000;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 18px;
    border: 2px solid #fff;
    box-shadow: 0 0 5px rgba(0,0,0,0.3);
}

.passage-title {
    font-size: 22px;
    margin-top: 10px;
    margin-bottom: 15px;
}

/* Styles for clickable words */
.clickable-word {
    display: inline-block;
    cursor: pointer;
    padding: 0 2px;
    border-radius: 3px;
    transition: background-color 0.2s;
}

.clickable-word:hover {
    background-color: rgba(255, 230, 0, 0.3);
}

.clicked {
    background-color: rgba(255, 230, 0, 0.7);
}

/* Instructions styles */
.instructions {
    background-color: #f5f5f5;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 30px;
}

/* Dice container styles */
.dice-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px;
    background-color: #f9f9f9;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

/* Dice styles */
.dice {
    width: 100px;
    height: 100px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 1s ease;
    margin-bottom: 20px;
    cursor: pointer;
}

.dice-face {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 10px;
    border: 2px solid #000;
    background-color: white;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    align-items: center;
    padding: 10px;
    box-sizing: border-box;
}

/* Dice face positioning */
.dice-face[data-value="1"] {
    transform: translateZ(50px);
}

.dice-face[data-value="2"] {
    transform: rotateX(180deg) translateZ(50px);
}

.dice-face[data-value="3"] {
    transform: rotateY(90deg) translateZ(50px);
}

.dice-face[data-value="4"] {
    transform: rotateY(-90deg) translateZ(50px);
}

.dice-face[data-value="5"] {
    transform: rotateX(90deg) translateZ(50px);
}

.dice-face[data-value="6"] {
    transform: rotateX(-90deg) translateZ(50px);
}

/* Dice dots */
.dot {
    display: block;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: #000;
    position: absolute;
}

/* Dice face 1 - center dot */
.dice-face[data-value="1"] .dot:nth-child(1) {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Dice face 2 - diagonal dots */
.dice-face[data-value="2"] .dot:nth-child(1) {
    top: 25%;
    left: 25%;
    transform: translate(-50%, -50%);
}
.dice-face[data-value="2"] .dot:nth-child(2) {
    bottom: 25%;
    right: 25%;
    transform: translate(50%, 50%);
}

/* Dice face 3 - diagonal dots plus center */
.dice-face[data-value="3"] .dot:nth-child(1) {
    top: 25%;
    left: 25%;
    transform: translate(-50%, -50%);
}
.dice-face[data-value="3"] .dot:nth-child(2) {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}
.dice-face[data-value="3"] .dot:nth-child(3) {
    bottom: 25%;
    right: 25%;
    transform: translate(50%, 50%);
}

/* Dice face 4 - four corner dots */
.dice-face[data-value="4"] .dot:nth-child(1) {
    top: 25%;
    left: 25%;
    transform: translate(-50%, -50%);
}
.dice-face[data-value="4"] .dot:nth-child(2) {
    top: 25%;
    right: 25%;
    transform: translate(50%, -50%);
}
.dice-face[data-value="4"] .dot:nth-child(3) {
    bottom: 25%;
    left: 25%;
    transform: translate(-50%, 50%);
}
.dice-face[data-value="4"] .dot:nth-child(4) {
    bottom: 25%;
    right: 25%;
    transform: translate(50%, 50%);
}

/* Dice face 5 - four corner dots plus center */
.dice-face[data-value="5"] .dot:nth-child(1) {
    top: 25%;
    left: 25%;
    transform: translate(-50%, -50%);
}
.dice-face[data-value="5"] .dot:nth-child(2) {
    top: 25%;
    right: 25%;
    transform: translate(50%, -50%);
}
.dice-face[data-value="5"] .dot:nth-child(3) {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}
.dice-face[data-value="5"] .dot:nth-child(4) {
    bottom: 25%;
    left: 25%;
    transform: translate(-50%, 50%);
}
.dice-face[data-value="5"] .dot:nth-child(5) {
    bottom: 25%;
    right: 25%;
    transform: translate(50%, 50%);
}

/* Dice face 6 - six dots in 2 columns of 3 */
.dice-face[data-value="6"] .dot:nth-child(1) {
    top: 25%;
    left: 25%;
    transform: translate(-50%, -50%);
}
.dice-face[data-value="6"] .dot:nth-child(2) {
    top: 50%;
    left: 25%;
    transform: translate(-50%, -50%);
}
.dice-face[data-value="6"] .dot:nth-child(3) {
    bottom: 25%;
    left: 25%;
    transform: translate(-50%, 50%);
}
.dice-face[data-value="6"] .dot:nth-child(4) {
    top: 25%;
    right: 25%;
    transform: translate(50%, -50%);
}
.dice-face[data-value="6"] .dot:nth-child(5) {
    top: 50%;
    right: 25%;
    transform: translate(50%, -50%);
}
.dice-face[data-value="6"] .dot:nth-child(6) {
    bottom: 25%;
    right: 25%;
    transform: translate(50%, 50%);
}

/* Roll button */
.roll-button {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 10px 20px;
    font-size: 16px;
    border-radius: 5px;
    cursor: pointer;
    margin-bottom: 15px;
    transition: background-color 0.3s;
}

.roll-button:hover {
    background-color: #3e8e41;
}

/* Result text */
.result {
    font-size: 18px;
    font-weight: bold;
    text-align: center;
}

/* Letter count grid styles */
.letter-count-grid {
    margin-top: 20px;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 5px;
    border: 1px solid #ddd;
}

.grid-header {
    margin-bottom: 15px;
}

.grid-header p {
    font-size: 14px;
    margin: 0;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}

.grid-cell {
    border: 1px solid #ccc;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.grid-cell input {
    width: 100%;
    height: 100%;
    padding: 10px;
    text-align: center;
    font-size: 18px;
    border: none;
    background: transparent;
}

/* Make sure the input doesn't break the cell's appearance */
.grid-cell input:focus {
    outline: none;
    background-color: rgba(0, 0, 0, 0.05);
}

/* Statistical measures section styling */
.stats-section {
    margin-top: 25px;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 5px;
    border: 1px solid #ddd;
}

.stats-header {
    margin-bottom: 15px;
}

.stats-header p {
    font-size: 14px;
    font-weight: bold;
    margin: 0;
}

.stats-table table {
    width: 100%;
    border-collapse: collapse;
}

.stats-table th, 
.stats-table td {
    border: 1px solid #ccc;
    padding: 0px;
    text-align: center;
}

.stats-table th {
    background-color: #f2f2f2;
    font-weight: bold;
}

.stats-table input {
    width: 100%;
    padding: 15px;
    text-align: center;
    border: none;
    background: transparent;
}

.stats-table input:focus {
    outline: none;
    background-color: rgba(0, 0, 0, 0.05);
}

/* Standard Deviation Section Styling */
.stddev-section {
    margin-top: 25px;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 5px;
    border: 1px solid #ddd;
    margin-bottom: 30px;
}

.stddev-header h4 {
    margin: 0 0 15px 0;
    font-size: 16px;
}

.stddev-steps {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.step {
    font-size: 14px;
    display: flex;
    align-items: center;
}

.step input[type="checkbox"] {
    margin-right: 5px;
}

.stddev-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 5px;
}

.stddev-grid .grid-cell {
    border: 1px solid #ccc;
    padding: 0;
    height: 35px;
}

.stddev-grid .grid-cell input,
.variance-input input,
.stddev-input input {
    width: 100%;
    height: 100%;
    padding: 5px;
    border: none;
    text-align: center;
    background: transparent;
    box-sizing: border-box;
}

.stddev-grid .grid-cell input:focus,
.variance-input input:focus,
.stddev-input input:focus {
    outline: none;
    background-color: rgba(0, 0, 0, 0.05);
}

.variance-input,
.stddev-input {
    display: flex;
    align-items: center;
    margin-top: 5px;
}

.variance-input label,
.stddev-input label {
    min-width: 200px;
    font-size: 14px;
}

.variance-input input,
.stddev-input input {
    flex: 1;
    height: 35px;
    border: 1px solid #ccc;
}

/* Dot Plot Section Styling */
.dotplot-section {
    margin-top: 25px;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 5px;
    border: 1px solid #ddd;
    margin-bottom: 30px;
}

.dotplot-header h4 {
    margin: 0 0 15px 0;
    font-size: 16px;
    text-align: center;
}

.dotplot-container {
    display: flex;
    flex-direction: column;
    gap: 50px;
}

.dotplot {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dotplot-label {
    display: inline-block;
    padding: 5px 10px;
    border: 1px solid #000;
    font-weight: bold;
    max-width: 150px;
    text-align: center;
}

.number-line {
    position: relative;
    width: 100%;
    height: 120px;
    margin-bottom: 30px;
}

.line {
    position: absolute;
    top: 60px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: #000;
}

.arrow-left {
    position: absolute;
    top: 60px;
    left: 0;
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-right: 12px solid #000;
    transform: translateY(-50%);
}

.arrow-right {
    position: absolute;
    top: 60px;
    right: 0;
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-left: 12px solid #000;
    transform: translateY(-50%);
}

.tick-marks {
    position: absolute;
    top: 60px;
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    box-sizing: border-box;
}

.tick {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
}

.tick-mark {
    height: 10px;
    width: 1px;
    background-color: #000;
    margin-bottom: 5px;
}

.tick:hover .tick-mark {
    background-color: #555;
}

.tick-label {
    font-size: 12px;
    margin-top: 5px;
}

.dot-area {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
}

.position-click-area {
    position: absolute;
    width: 20px;
    height: 60px;
    transform: translateX(-50%);
    cursor: pointer;
}

.position-click-area:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.dot-stack {
    position: absolute;
    bottom: 0;
    width: 12px;
    height: 60px;
    transform: translateX(-50%);
}

.dot {
    position: absolute;
    width: 12px;
    height: 12px;
    background-color: #333;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
}

.dot:hover {
    background-color: #555;
}

/* Add to your harrypotter-shakespeare.css */

.clear-dots-btn {
    background-color: #f44336;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    margin-bottom: 15px;
    margin-left: auto;
    display: block;
}

.clear-dots-btn:hover {
    background-color: #d32f2f;
}

/* Histogram Section Styling */
.histogram-section {
    margin-top: 25px;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 5px;
    border: 1px solid #ddd;
    margin-bottom: 30px;
}

.histogram-header h4 {
    margin: 0 0 15px 0;
    font-size: 16px;
    text-align: center;
}

.histogram-container {
    display: flex;
    flex-direction: column;
    gap: 50px;
}

.histogram-plot {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.histogram-label {
    display: inline-block;
    padding: 5px 10px;
    border: 1px solid #000;
    font-weight: bold;
    max-width: 150px;
    text-align: center;
}

.histogram-builder {
    width: 100%;
}

.histogram-controls {
    margin-bottom: 15px;
    padding: 10px;
    background-color: #f0f0f0;
    border-radius: 5px;
}

.control-group {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
    justify-content: center;
}

.control-group label {
    display: flex;
    align-items: center;
    gap: 5px;
}

.control-group input {
    width: 50px;
    padding: 5px;
    text-align: center;
}

.update-bins-btn {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
}

.update-bins-btn:hover {
    background-color: #3e8e41;
}

.histogram-graph {
    display: flex;
    height: 300px;
    margin-top: 10px;
    margin-bottom: 40px;
    position: relative;
}

.y-axis {
    width: 50px;
    position: relative;
    border-right: 2px solid #000;
}

.y-label {
    position: absolute;
    top: 50%;
    left: -40px;
    transform: rotate(-90deg) translateX(50%);
    font-size: 14px;
    white-space: nowrap;
}

.x-axis {
    position: absolute;
    bottom: -30px;
    left: 50px;
    right: 0;
    height: 30px;
    border-top: 2px solid #000;
}

.x-label {
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 14px;
}

.bins-container {
    flex: 1;
    display: flex;
    align-items: flex-end;
    padding-bottom: 0px;
    position: relative;
    margin-bottom: 0px; /* Space for x-axis labels */
}

.bin {
    flex: 1;
    background-color: #ADD8E6;
    border-right: 1px solid #0078D7;
    border-top: 1px solid #0078D7;
    border-left: 1px solid #0078D7;
    border-bottom: none;
    min-height: 5px;
    position: relative;
    cursor: ns-resize; /* Changed cursor to indicate vertical resizing */
    transition: height 0.1s ease; /* Shorter transition for responsive dragging */
    margin: 0;
    user-select: none; /* Prevent text selection during drag */
}

.bin:first-child {
    border-left: 1px solid #0078D7; /* Add left border to first bin */
}

.bin:hover {
    background-color: #0078D7;
}

.bin-value {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    background-color: rgba(255,255,255,0.8);
    padding: 2px 4px;
    border-radius: 2px;
    display: none;
}

.bin:hover .bin-value {
    display: block;
}

.x-axis-labels {
    position: absolute;
    bottom: -25px;
    left: 0;
    right: 0;
    height: 20px;
}

.x-axis-label {
    position: absolute;
    font-size: 12px;
    transform: translateX(-50%);
}

.y-ticks {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
}

.y-tick {
    position: absolute;
    right: 0;
    width: 5px;
    height: 1px;
    background-color: #000;
}

.y-tick-label {
    position: absolute;
    right: 8px;
    transform: translateY(-50%);
    font-size: 10px;
}

/* Box Plot Section Styling */
.boxplot-section {
    margin-top: 25px;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 5px;
    border: 1px solid #ddd;
    margin-bottom: 30px;
}

.boxplot-header h4 {
    margin: 0 0 15px 0;
    font-size: 16px;
    text-align: center;
}

.five-number-summary {
    margin-bottom: 25px;
}

.five-number-summary table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #ccc;
}

.five-number-summary th, 
.five-number-summary td {
    border: 1px solid #ccc;
    padding: 0px;
    text-align: center;
}

.five-number-summary th {
    background-color: #f2f2f2;
    font-weight: bold;
}

.five-number-summary input {
    width: 100%;
    padding: 15px;
    text-align: center;
    border: none;
    background: transparent;
}

.five-number-summary input:focus {
    outline: none;
    background-color: rgba(0, 0, 0, 0.05);
}

.boxplot-container {
    margin-top: 30px;
}

.boxplot-controls {
    margin-bottom: 15px;
    padding: 10px;
    background-color: #f0f0f0;
    border-radius: 5px;
}

.control-group {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
    justify-content: center;
}

.control-group label {
    display: flex;
    align-items: center;
    gap: 5px;
}

.control-group input {
    width: 50px;
    padding: 5px;
    text-align: center;
}

.update-boxplot-btn {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
}

.update-boxplot-btn:hover {
    background-color: #3e8e41;
}

.boxplots {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.boxplot-row {
    display: flex;
    align-items: center;
    gap: 15px;
}

.boxplot-label {
    display: inline-block;
    min-width: 100px;
    padding: 5px 10px;
    border: 1px solid #000;
    font-weight: bold;
    text-align: center;
}

.boxplot-chart {
    flex: 1;
    height: 60px;
    position: relative;
    
    
}

.boxplot-axis {
    position: absolute;
    top: 30px;
    left: 0;
    right: 0;
    height: 1px;
    background-color: #000;
}

.boxplot-box {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.boxplot-min,
.boxplot-q1,
.boxplot-median,
.boxplot-q3,
.boxplot-max {
    position: absolute;
    top: 15px;
    width: 10px;
    height: 30px;
    cursor: ew-resize;
}

.boxplot-min {
    background-color: #555;
    width: 2px;
}

.boxplot-max {
    background-color: #555;
    width: 2px;
}

.boxplot-q1 {
    background-color: transparent;
}

.boxplot-median {
    background-color: #000;
    width: 2px;
}

.boxplot-q3 {
    background-color: transparent;
}

.boxplot-iqr-box {
    position: absolute;
    top: 15px;
    height: 30px;
    background-color: rgba(173, 216, 230, 0.6); /* Lighter blue with transparency */
    border: 1px solid #0078D7;
}

.boxplot-min-q1-line,
.boxplot-q3-max-line {
    position: absolute;
    top: 30px;
    height: 2px;
    background-color: #000;
}

.boxplot-median-line {
    position: absolute;
    top: 15px;
    height: 30px;
    width: 2px;
    background-color: #000;
    cursor: ew-resize;
    transform: translateX(-50%);
}

/* Harry Potter specific styling */
.hp-min-handle,
.hp-q1-handle,
.hp-median-handle,
.hp-q3-handle,
.hp-max-handle {
    transform: translateX(-50%);
}

/* Shakespeare specific styling */
.shk-min-handle,
.shk-q1-handle,
.shk-median-handle,
.shk-q3-handle,
.shk-max-handle {
    transform: translateX(-50%);
}

/* Add tick marks on the axis */
.boxplot-tick {
    position: absolute;
    top: 25px;
    width: 1px;
    height: 10px;
    background-color: #000;
}

.boxplot-tick-label {
    position: absolute;
    top: 44px;
    transform: translateX(-50%);
    font-size: 10px;
}

/* Handle value tooltip when hovering */
.handle-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0,0,0,0.7);
    color: white;
    padding: 2px 5px;
    border-radius: 3px;
    font-size: 12px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}

.boxplot-min:hover .handle-tooltip,
.boxplot-q1:hover .handle-tooltip,
.boxplot-median:hover .handle-tooltip,
.boxplot-q3:hover .handle-tooltip,
.boxplot-max:hover .handle-tooltip {
    opacity: 1;
}