/* wrapper.css - styles for the Testing Environment Control Panel */

* {
    box-sizing: border-box;
    font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: #1e1e1e;
    /* dark theme for wrapper */
}

.wrapper-container {
    display: flex;
    width: 100vw;
    height: 100vh;
}

/* left panel - 70% */
.test-panel {
    flex: 1;
    height: 100%;
    border-right: 1px solid #333;
}

.test-panel iframe {
    width: 100%;
    height: 100%;
    display: block;
}

/* right panel - 30% */
.control-panel {
    flex: 0 0 340px;
    width: 340px;
    height: 100%;
    display: flex;
    flex-direction: column;
    background-color: #252526;
    color: #cccccc;
    overflow-y: auto;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: #1e1e1e;
    border-bottom: 1px solid #333;
}

.panel-header h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
    color: #ffffff;
}

/* webcam area */
.webcam-container {
    width: 100%;
    background-color: #000;
    position: relative;
    border-bottom: 1px solid #333;
    overflow: hidden;
    min-height: 200px;
}

#webcam-video {
    width: 100%;
    height: auto;
    display: block;
    transform: scaleX(-1);
    /* mirror effect */
}

.webcam-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    transform: scaleX(-1);
    /* mirror overlay to align with video */
}

.overlay-text {
    position: absolute;
    bottom: 8px;
    left: 8px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.85);
    background: rgba(0, 0, 0, 0.65);
    padding: 3px 7px;
    border-radius: 4px;
    font-family: monospace;
}

/* camera action controls */
.camera-controls-container {
    padding: 8px 12px;
    background-color: #1f1f21;
    border-bottom: 1px solid #333;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.control-action-btn {
    padding: 5px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
    border: 1px solid #444;
    background: #007acc;
    color: #fff;
    cursor: pointer;
    transition: background 0.15s;
}

.control-action-btn:hover {
    background: #005999;
}

.control-action-btn.secondary {
    background: #3e3e42;
    border-color: #555;
}

.control-action-btn.secondary:hover {
    background: #4e4e52;
}

.toggle-control {
    font-size: 11px;
    color: #aaa;
    display: flex;
    align-items: center;
    margin-left: auto;
}

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

/* diagnostics HUD */
.diagnostics-panel {
    padding: 10px 14px;
    background-color: #1e1e1e;
    border-bottom: 1px solid #333;
}

.diagnostics-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.diagnostics-header h4 {
    margin: 0;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #888;
}

.status-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.1);
    color: #34c759;
    font-family: monospace;
}

.diagnostics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px 10px;
}

.diag-item {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    padding: 2px 0;
    border-bottom: 1px dotted #2d2d30;
}

.diag-label {
    color: #888;
}

.diag-value {
    color: #4ec9b0;
    font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
    font-size: 10.5px;
}

/* logging area */
.project-info-container {
    padding: 10px 14px;
    background-color: #1e1e1e;
    border-bottom: 1px solid #333;
}

.button-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.reset-btn, .benchmark-btn {
    flex: 1;
    padding: 7px 10px;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    transition: background-color 0.2s;
    text-align: center;
}

.reset-btn {
    background-color: #d63031;
}

.reset-btn:hover {
    background-color: #b71c1c;
}

.benchmark-btn {
    background-color: #6c5ce7;
}

.benchmark-btn:hover {
    background-color: #5541d7;
}

.footnote {
    margin: 0;
    font-size: 11px;
    color: #888;
}

.footnote a {
    color: #9cdcfe;
    text-decoration: none;
}

.footnote a:hover {
    text-decoration: underline;
}

.log-container {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    padding: 12px 14px;
    overflow: hidden;
    min-height: 180px;
}

.log-container h3 {
    margin: 0 0 8px 0;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #888;
}

.logs {
    flex: 1 1 0;
    overflow-y: auto;
    font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
    font-size: 11px;
    line-height: 1.5;
    color: #9cdcfe;
    padding-right: 5px;
    min-height: 0;
}

.logs .log-entry {
    margin-bottom: 4px;
}

.logs .log-time {
    color: #858585;
    margin-right: 6px;
}

.logs .log-action {
    color: #ce9178;
}

/* calibration overlay */
#calibration-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(18, 18, 18, 0.75);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.4s ease;
}

.calibration-instructions {
    text-align: center;
    color: white;
    background: rgba(0, 0, 0, 0.85);
    padding: 24px 36px;
    border-radius: 12px;
    border: 1px solid #444;
    pointer-events: none;
    max-width: 480px;
}

.calibration-instructions h2 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 20px;
}

.calibration-instructions p {
    margin: 0;
    font-size: 13px;
    color: #bbb;
    line-height: 1.5;
}

.calibration-dot {
    position: absolute;
    width: 40px;
    height: 40px;
    background-color: #ff3b30;
    border: 2px solid #fff;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-weight: bold;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    box-shadow: 0 0 12px rgba(255, 59, 48, 0.7);
    transition: opacity 0.2s, background-color 0.3s, transform 0.1s;
}

.calibration-dot:hover {
    transform: scale(1.08);
}

.calibration-dot:active {
    transform: scale(0.95);
    filter: brightness(0.8);
}

.calibration-dot.completed {
    background-color: #34c759;
    border-color: #a8ffb2;
    box-shadow: 0 0 12px rgba(52, 199, 89, 0.7);
    transform: scale(1);
}

.calibration-dot.waiting-click {
    cursor: pointer;
    background-color: #ff3b30;
    border-color: #ffffff;
    box-shadow: 0 0 16px rgba(255, 59, 48, 0.85);
    animation: calib-pulse 1.2s infinite ease-in-out;
}

.calibration-dot.waiting-click:hover {
    transform: scale(1.15);
    background-color: #ff5247;
    box-shadow: 0 0 24px rgba(255, 59, 48, 1);
}

.calibration-dot.settling {
    background-color: #feca57;
    border-color: #ffffff;
    color: #000;
    box-shadow: 0 0 14px rgba(254, 202, 87, 0.8);
    cursor: default;
    animation: none;
}

.calibration-dot.collecting {
    background-color: #34c759;
    border-color: #ffffff;
    color: #000;
    box-shadow: 0 0 20px rgba(52, 199, 89, 0.9);
    cursor: default;
    animation: none;
}

/* sequential calibration overlay controls */
.calibration-top-bar {
    position: absolute;
    top: 24px;
    left: 24px;
    right: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: auto;
    z-index: 10002;
}

.calibration-status-header {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
}

.calib-badge {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    text-transform: uppercase;
    font-weight: bold;
    background: #feca57;
    color: #000;
}

.calib-badge.collecting {
    background: #00d2d3;
    color: #000;
}

.calib-badge.complete {
    background: #2ed573;
    color: #000;
}

.calibration-actions {
    display: flex;
    gap: 10px;
}

.calib-ctrl-btn {
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 4px;
    border: 1px solid #444;
    background: #007acc;
    color: #fff;
    cursor: pointer;
    transition: background 0.15s;
}

.calib-ctrl-btn:hover {
    background: #005999;
}

.calib-ctrl-btn.secondary {
    background: #3e3e42;
    border-color: #555;
}

.calib-ctrl-btn.secondary:hover {
    background: #4e4e52;
}

.calibration-dot.active-target {
    animation: calib-pulse 1.2s infinite ease-in-out;
}

@keyframes calib-pulse {
    0% { transform: scale(1); box-shadow: 0 0 10px rgba(255, 59, 48, 0.7); }
    50% { transform: scale(1.18); box-shadow: 0 0 24px rgba(255, 59, 48, 0.95); }
    100% { transform: scale(1); box-shadow: 0 0 10px rgba(255, 59, 48, 0.7); }
}

#gaze-pointer {
    position: fixed;
    top: 0;
    left: 0;
    width: 22px;
    height: 22px;
    background-color: rgba(255, 59, 48, 0.85);
    border: 2px solid white;
    border-radius: 50%;
    pointer-events: none;
    z-index: 10000;
    transform: translate(-50%, -50%);
    display: none;
    box-shadow: 0 0 8px rgba(0,0,0,0.5);
    transition: background-color 0.15s ease;
}

/* benchmark modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(5px);
    z-index: 10001;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-card {
    background: #252526;
    border: 1px solid #444;
    border-radius: 8px;
    width: 650px;
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0,0,0,0.6);
    overflow: hidden;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    background: #1e1e1e;
    border-bottom: 1px solid #333;
}

.modal-header h3 {
    margin: 0;
    font-size: 15px;
    color: #fff;
}

.modal-close {
    font-size: 22px;
    color: #888;
    cursor: pointer;
    line-height: 1;
}

.modal-close:hover {
    color: #fff;
}

.benchmark-status {
    padding: 8px 20px;
    background: #2d2d30;
    font-size: 11px;
    color: #feca57;
    font-family: monospace;
    border-bottom: 1px solid #3a3a3d;
}

.modal-body {
    padding: 16px 20px;
    overflow-y: auto;
    font-size: 13px;
    color: #ddd;
}

.benchmark-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 12px;
}

.benchmark-table th, .benchmark-table td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid #333;
}

.benchmark-table th {
    background: #1e1e1e;
    color: #aaa;
    font-weight: 600;
}