/* style.css */

/* CSS Variables for easy theming */
:root {
    --bg-color: #f0f2f5;
    --card-bg-color: #ffffff;
    --text-color: #333;
    --primary-color: #007bff;
    --wait-color: #dc3545; /* Red */
    --ready-color: #28a745; /* Green */
    --border-radius: 12px;
    --shadow: 0 4px 12px rgba(0,0,0,0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 1rem;
}

.container {
    width: 90%;
    max-width: 700px;
    background-color: var(--card-bg-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 2rem;
    text-align: center;
}

h1 {
    margin-top: 0;
    color: var(--primary-color);
}

nav {
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 1rem;
}

nav a {
    margin: 0 10px;
    text-decoration: none;
    color: var(--primary-color);
    font-weight: 500;
}

#test-area {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    min-height: 250px;
    margin: 2rem 0;
    border-radius: var(--border-radius);
    font-size: 2rem;
    font-weight: bold;
    color: white;
    cursor: pointer;
    transition: background-color 0.2s ease, clip-path 0.3s ease;
    user-select: none; /* Prevents text selection */
}

/* State-specific styles */
.state-initial { background-color: var(--primary-color); }
.state-ready { background-color: var(--ready-color); }
.state-result, .state-feedback { background-color: #6c757d; }
.state-waiting {
    background-color: var(--wait-color);
    clip-path: polygon(25% 0%, 75% 0%, 100% 25%, 100% 75%, 75% 100%, 25% 100%, 0% 75%, 0% 25%);
}

/* Sternberg Test Specifics */
#memory-set {
    font-size: 3.5rem;
    letter-spacing: 0.5em;
    padding-bottom: 20px;
    color: var(--text-color);
}
#progress-bar-container {
    width: 80%;
    height: 10px;
    background-color: #e9ecef;
    border-radius: 5px;
    overflow: hidden;
    margin-top: 1rem;
}
#progress-bar {
    height: 100%;
    width: 100%;
    background-color: var(--primary-color);
    border-radius: 5px;
    transform-origin: left;
}
.progress-animate {
    animation: deplete 3s linear forwards;
}
.progress-animate-2 {
    animation: deplete 2s linear forwards;
}
@keyframes deplete {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}


/* Data & Charting */
.data-display {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    gap: 1rem;
    margin-top: 2rem;
}

.summary-stats, .chart-container {
    flex: 1;
    min-width: 250px;
    padding: 1rem;
    background: #f9f9f9;
    border-radius: 8px;
    border: 1px solid #eee;
}

h2 {
    text-align: center;
    color: var(--primary-color);
    margin-top: 0;
    font-size: 1.2rem;
}

/* Session Toggle */
.session-toggle {
    margin-top: 1rem;
    padding: 0.5rem;
    background: #fff;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.session-toggle label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    cursor: pointer;
}

.session-toggle input[type="checkbox"] {
    margin: 0;
}

/* Reaction Test Distribution Chart */
.dist-chart {
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    height: 150px;
    padding: 10px;
    border-top: 1px solid #ccc;
    border-left: 1px solid #ccc;
}
.dist-chart .bar-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}
.dist-chart .bar {
    width: 70%;
    background-color: var(--primary-color);
    transition: height 0.3s ease-out;
    border-radius: 4px 4px 0 0;
}
.dist-chart .label {
    font-size: 0.7rem;
    margin-top: 5px;
    color: #666;
}

/* Sternberg Scatter Plot */
.scatter-plot {
    position: relative;
    height: 200px;
    width: 100%;
    border-bottom: 1px solid #ccc;
    border-left: 1px solid #ccc;
}
.scatter-plot .point {
    position: absolute;
    width: 8px;
    height: 8px;
    background-color: var(--ready-color);
    border-radius: 50%;
    transform: translate(-50%, 50%); /* Center the point */
    z-index: 3;
}
.scatter-plot .error-bar {
    position: absolute;
    width: 2px;
    background-color: rgba(0, 123, 255, 0.3);
    transform: translateX(-50%);
    z-index: 1;
}
.scatter-plot .trend-line {
    position: absolute;
    height: 3px;
    background-color: rgba(220, 53, 69, 0.8);
    transform-origin: left center;
    z-index: 2;
    border-radius: 1px;
}
.scatter-plot .axis-label {
    position: absolute;
    font-size: 0.75rem;
    color: #555;
}
.scatter-plot .x-label { bottom: -20px; }
.scatter-plot .y-label { left: -35px; writing-mode: vertical-rl; transform: rotate(180deg); }

/* Chart canvas wrapper to avoid overflow */
.chart-canvas {
	height: 220px;
	width: 100%;
	position: relative;
	overflow: hidden;
}

/* Sync button row */
.sync-row {
	display: flex;
	gap: 0.5rem;
	justify-content: center;
	align-items: center;
	margin-top: 0.5rem;
}
#sync-status {
	font-size: 0.85rem;
	color: #666;
}

/* Inspection Time Task */
/* .stimulus {
	display: flex;
	justify-content: center;
	align-items: center;
	height: 300px;
	background-color: #f0f0f0;
	border-radius: 8px;
	margin: 20px 0;
}

.arrow-container {
	display: flex;
	justify-content: center;
	align-items: center;
	width: 200px;
	height: 200px;
	background-color: #FFFFFF;
	border-radius: 8px;
}

.arrow {
	font-size: 150px;
	color: #FF0000;
	font-weight: bold;
	text-align: center;
	line-height: 1;
}

.response {
	text-align: center;
	padding: 40px;
	background-color: #f9f9f9;
	border-radius: 8px;
	margin: 20px 0;
}

.response h3 {
	margin-bottom: 20px;
	color: #333;
}

.response p {
	font-size: 18px;
	color: #666;
} */

.sync-row {
	display: flex;
	gap: 0.5rem;
	justify-content: center;
	align-items: center;
	margin-top: 0.5rem;
}
#sync-status {
	font-size: 0.85rem;
	color: #666;
}

/* START: Modified/Added Rules for Inspection Time Task */
.top-zone, .bottom-zone {
    min-height: 60px; /* Essential for preventing layout shift */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 10px;
    color: var(--text-color);
    font-size: 1.2rem;
    transition: opacity 0.2s ease-in-out;
}

.top-zone h2, .top-zone h3,
.bottom-zone p {
    margin: 0;
}

.bottom-zone p {
    font-size: 1rem;
    color: #666;
}

.middle-zone { /* Renamed from .stimulus */
	display: flex;
	justify-content: center;
	align-items: center;
	height: 300px; /* Fixed height is also key */
	background-color: #f0f0f0;
	border-radius: 8px;
	margin: 20px 0;
}
/* END: Modified/Added Rules */

.arrow-container {
	display: flex;
	justify-content: center;
	align-items: center;
	width: 200px;
	height: 200px;
	background-color: #FFFFFF;
	border-radius: 8px;
}

.arrow {
	font-size: 150px;
	color: #FF0000; /* Default color, JS will override */
	font-weight: bold;
	text-align: center;
	line-height: 1;
}