/* CONTAINER */
.webcam-test-tool {
    font-family: 'Segoe UI', Arial, sans-serif;
    max-width: 1200px;
    margin: 20px auto;
    display: flex;
    gap: 20px;
    background: #fff;
    color: #333;
}

/* LEFT COLUMN (Info) */
.col-left {
    flex: 0 0 320px;
    display: flex; flex-direction: column;
    border: 1px solid #ddd; border-radius: 4px; overflow: hidden;
    height: fit-content;
}

.panel-header {
    background: #e1f5fe; padding: 10px 15px;
    font-weight: bold; color: #333; border-bottom: 1px solid #ddd;
    text-align: center; font-size: 16px;
}

.table-container { overflow-x: auto; }
.info-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.info-table td { padding: 6px 10px; border-bottom: 1px solid #eee; }
.info-table tr:nth-child(odd) { background: #fff; }
.info-table tr:nth-child(even) { background: #f9f9f9; }
.info-table td:first-child { font-weight: 600; color: #555; width: 50%; }

.color-preview {
    display: inline-block; width: 15px; height: 15px;
    background: #ccc; border: 1px solid #999; vertical-align: middle;
}
.footer-note { padding: 10px; font-size: 11px; color: #666; font-style: italic; background: #fdfdfd; border-top: 1px solid #eee; }

/* RIGHT COLUMN (Video) */
.col-right {
    flex: 1; display: flex; flex-direction: column;
    border: 1px solid #ddd; border-radius: 4px; overflow: hidden;
    height: fit-content;
}

/* MESSAGES */
.msg-box { padding: 12px; margin: 15px 15px 0 15px; font-size: 13px; line-height: 1.4; border: 1px solid transparent; }
.msg-green { background: #dff0d8; color: #3c763d; border-color: #d6e9c6; }
.msg-blue { background: #d9edf7; color: #31708f; border-color: #bce8f1; }

/* LIVE CONTROLS (New Dropdown Bar) */
.live-controls {
    padding: 10px 15px; background: #f5f5f5; border-bottom: 1px solid #ddd;
    display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: bold;
}
.live-controls select {
    flex: 1; padding: 6px; border: 1px solid #ccc; border-radius: 3px; max-width: 300px;
}

/* VIDEO STAGE */
.video-stage {
    position: relative; margin: 15px; background: #000;
    height: 400px; display: flex; align-items: center; justify-content: center;
    overflow: hidden; border: 1px solid #ccc;
}
video { width: 100%; height: 100%; object-fit: cover; position: relative; z-index: 2; transform: scaleX(-1); }

.static-noise {
    position: absolute; top:0; left:0; width:100%; height:100%;
    background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAYAAABytg0kAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAABZJREFUeNpi2r9//38gYGAEESAAEGAAasgJOgzOKCoAAAAASUVORK5CYII=');
    opacity: 0.3; z-index: 1;
}

/* OVERLAY */
.start-controls {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 10;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.1);
}
.btn-test-main {
    padding: 12px 40px; background: linear-gradient(to bottom, #f5f5f5 0%, #e0e0e0 100%);
    border: 1px solid #ccc; border-radius: 4px; font-weight: bold; cursor: pointer; color: #333;
    font-size: 15px; box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
.btn-test-main:hover { background: #ddd; }

/* ACTION BUTTONS */
.action-buttons { display: flex; flex-direction: column; padding: 0 15px 15px 15px; gap: 5px; }
.btn-action {
    width: 100%; padding: 10px; background: linear-gradient(to bottom, #fff 0%, #f0f0f0 100%);
    border: 1px solid #ccc; border-radius: 3px; cursor: pointer; font-size: 13px; color: #333; text-align: center;
}
.btn-action:hover { background: #e6e6e6; }
.btn-action:disabled { color: #aaa; background: #f9f9f9; cursor: not-allowed; }

/* --- MOBILE RESPONSIVE LOGIC --- */
@media (max-width: 850px) {
    .webcam-test-tool {
        flex-direction: column; /* Stack vertically */
    }
    
    /* REORDERING: Video First (1), Info Second (2) */
    .col-right { order: 1; }
    .col-left { order: 2; width: 100%; flex: auto; }
    
    .video-stage { height: 280px; margin: 10px; }
    .live-controls { flex-direction: column; align-items: flex-start; gap: 5px; }
    .live-controls select { width: 100%; max-width: none; }
}