/* style.css - fixed colors & small layout fixes */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

body {
    background-color: #1a1a2e;
    color: #e6eef8;
    overflow-x: hidden;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 1600px;
    margin: 0 auto;
    background-color: #16213e;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
}

/* Header Styles */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
    background-color: #0f3460;
    border-bottom: 1px solid rgba(224,224,224,0.08);
    height: 60px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: bold;
    color: #cfe1ff;
}

.search-bar {
    display: flex;
    align-items: center;
    background-color: #f1f3f4;
    border-radius: 24px;
    padding: 8px 16px;
    width: 300px;
}

.search-bar input {
    border: none;
    background: transparent;
    width: 100%;
    padding: 5px;
    font-size: 14px;
    outline: none;
    color: #333;
}

/* Debug Toggle Button */
.debug-toggle {
    margin-left: 20px;
    position: relative;
}

.debug-button {
    background-color: #f1f3f4;
    border: 1px solid #e0e0e0;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    color: #333;
    font-size: 18px;
}

/* Main Content Layout */
.content {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.interface-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    padding: 20px;
    height: calc(100vh - 60px);
}

/* Camera View */
.camera-view {
    position: relative;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    min-height: 360px;
}

.camera-guide {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(0,0,0,0.6);
    color: #e6eef8;
    padding: 12px;
    border-radius: 12px;
    z-index: 30;
    max-width: 320px;
    backdrop-filter: blur(5px);
}

.guide-item {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.guide-icon {
    width: 25px;
    height: 25px;
    background: #4285f4;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    color: white;
    font-weight: bold;
}

#webcam {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* landmarks container sits on top of video and scales with camera-view */
.hand-landmarks {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
}

.landmark {
    position: absolute;
    width: 8px;
    height: 8px;
    background-color: #4285f4;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    z-index: 100;
}

.landmark.index-tip {
    background-color: #34a853;
    width: 12px;
    height: 12px;
    box-shadow: 0 0 8px rgba(52, 168, 83, 0.6);
}

/* Control Panel (light background) - ensure dark text here for contrast */
.control-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
    background: #f5f7fa;
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    color: #0f1724;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    color: #0f1724;
}

.panel-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.panel-button {
    padding: 8px 16px;
    border: 1px solid #4cc9f0;
    border-radius: 6px;
    background: transparent;
    color: #0f3460;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.panel-button:hover {
    background: #4cc9f0;
    color: #0f3460;
}

.instrument-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
}

.instrument-item {
    padding: 15px;
    background: #ffffff;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #0f1724;
    border: 1px solid rgba(66,133,244,0.12);
}

.instrument-item:hover, .instrument-item.active {
    background: #e8f0fe;
    border: 1px solid #4285f4;
}

.instrument-icon {
    font-size: 24px;
}

.instrument-name {
    font-weight: 500;
}

.parameter-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.control-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.range-control {
    width: 100%;
    max-width: 150px;
}

/* Debug Panel (dark) */
.debug-panel {
    position: fixed;
    top: 60px;
    right: 20px;
    background-color: rgba(15, 52, 96, 0.95);
    color: #4cc9f0;
    padding: 15px;
    border-radius: 12px;
    max-width: 300px;
    z-index: 100;
    backdrop-filter: blur(5px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    border: 1px solid #4cc9f0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transform: translateY(-10px);
}

.debug-panel.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.debug-panel h3 {
    color: #4cc9f0;
    margin-bottom: 10px;
    text-align: center;
}

.debug-item {
    margin-bottom: 5px;
}

.debug-label {
    display: inline-block;
    width: 120px;
    color: #aaa;
}

.debug-value {
    color: #fff;
    font-weight: bold;
}

/* Status Indicator */
.status-indicator {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    z-index: 200;
}

.status-indicator.ready {
    background-color: #34a853;
    box-shadow: 0 0 10px #34a853;
}

.status-indicator.processing {
    background-color: #fbbf24;
    animation: blink 1s infinite;
}

.status-indicator.error {
    background-color: #f87171;
    animation: blink 0.5s infinite;
}

@keyframes blink {
    50% { opacity: 0.5; }
}

/* Audio Start Button */
.audio-start-button {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #4285f4;
    color: white;
    border: none;
    border-radius: 50px;
    padding: 15px 30px;
    font-size: 20px;
    z-index: 1000;
    cursor: pointer;
    display: block;
}

/* small improvements for connections */
.connection {
    position: absolute;
    height: 2px;
    background-color: #4285f4;
    transform-origin: 0 0;
    z-index: 60;
}

/* selection highlight */
.selection-highlight {
    position: absolute;
    border: 3px solid #4285f4;
    border-radius: 8px;
    pointer-events: none;
    z-index: 70;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(66, 133, 244, 0.4); }
    70% { box-shadow: 0 0 10px rgba(66, 133, 244, 0); }
    100% { box-shadow: 0 0 0 0 rgba(66, 133, 244, 0); }
}
