:root {
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    --primary-color: #00ff88;
    --danger-color: #ff4757;
    --text-color: #ffffff;
    --bg-gradient-start: #24243e;
    --bg-gradient-mid: #302b63;
    --bg-gradient-end: #0f0c29;
}

/* =========================================
   Base
   ========================================= */
body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    background: #0f0c29;
    background: linear-gradient(to right, var(--bg-gradient-start), var(--bg-gradient-mid), var(--bg-gradient-end));
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text-color);
}

a {
    color: var(--primary-color);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

h1 {
    font-weight: 300;
    letter-spacing: 2px;
    margin-top: 0;
    margin-bottom: 1rem;
}

h3 {
    margin-top: 0;
    margin-bottom: 0.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    opacity: 0.8;
}

/* =========================================
   Layout / Background
   ========================================= */
.background-blobs {
    position: fixed;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    top: 0;
    left: 0;
}

.blob {
    position: absolute;
    filter: blur(80px);
    opacity: 0.6;
    border-radius: 50%;
    animation: float 10s infinite alternate;
}

.blob-1 {
    top: 10%;
    left: 10%;
    width: 300px;
    height: 300px;
    background: #7b4397;
}

.blob-2 {
    bottom: 20%;
    right: 10%;
    width: 350px;
    height: 350px;
    background: #dc2430;
    animation-delay: -2s;
}

.blob-3 {
    top: 40%;
    left: 40%;
    width: 200px;
    height: 200px;
    background: #00c6ff;
    animation-delay: -5s;
}

@keyframes float {
    0% { transform: translate(0, 0); }
    100% { transform: translate(30px, 50px); }
}

/* =========================================
   Components
   ========================================= */

/* Glass Container */
.glass-container {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 2rem;
    padding-top: 0; /* Align with updated index.html style */
    width: 90%;
    max-width: 400px;
    box-shadow: var(--glass-shadow);
    text-align: center;
    margin: auto;
}

/* Info Header */
.info-header {
    margin-bottom: 20px;
    font-size: 0.9rem;
    opacity: 0.9;
}

.info-header p {
    margin: 5px 0;
}

.info-header .note {
    font-size: 0.8rem;
    margin-bottom: 10px;
    font-style: italic;
}

/* Buttons */
.glass-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 1rem;
    border-radius: 12px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 5px;
    font-weight: bold;
    width: 100%; /* Ensure buttons take full width in grid/flex contexts if needed */
    box-sizing: border-box;
}

.glass-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.glass-btn:active {
    transform: translateY(0);
}

.glass-btn.primary {
    background: rgba(0, 255, 136, 0.2);
    border-color: rgba(0, 255, 136, 0.4);
}

.glass-btn.primary:hover {
    background: rgba(0, 255, 136, 0.3);
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.3);
}

.glass-btn.danger {
    background: rgba(255, 71, 87, 0.2);
    border-color: rgba(255, 71, 87, 0.4);
}

.glass-btn.danger:hover {
    background: rgba(255, 71, 87, 0.3);
}

.glass-btn.small {
    padding: 0.5rem;
    font-size: 0.9rem;
}

/* Controls */
.main-controls {
    display: grid;
    gap: 0.5rem;
    margin: 0.5rem 0;
}

.control-panel {
    text-align: left;
}

.control-group {
    margin-bottom: 0.8rem;
}

.control-group.boxed {
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 20px;
}

/* Inputs */
input[type="range"] {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    outline: none;
    -webkit-appearance: none;
    margin-top: 5px;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

.glass-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 0.8rem;
    color: white;
    font-family: inherit;
    box-sizing: border-box;
}

.glass-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: rgba(0, 0, 0, 0.3);
}

/* Status Indicator */
.status-indicator {
    font-size: 0.8rem;
    text-align: center;
    opacity: 0.6;
    margin-bottom: 1rem;
}

.status-indicator.left-align {
    text-align: left;
    opacity: 1;
}

/* Presets */
.preset-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

/* Troubleshooting */
.troubleshooting {
    margin-top: 30px; 
    text-align: left; 
    font-size: 0.85rem; 
    border-top: 1px solid rgba(255,255,255,0.1); 
    padding-top: 20px;
}

.troubleshooting ol {
    padding-left: 20px;
    line-height: 1.6;
}

.troubleshooting img {
    max-width: 100%;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    margin-top: 15px;
}

/* Visualizer (Mic & Camera) */
.visualizer {
    width: 100%;
    height: 20px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

.visualizer__bar {
    width: 0%;
    height: 100%;
    background-color: var(--primary-color);
    transition: width 0.1s ease-out;
}

.visualizer-value {
    text-align: center;
    font-size: 0.9rem;
}

/* Video Feed */
.video-feed {
    width: 100%;
    height: auto;
    border-radius: 10px;
    background-color: rgba(0, 0, 0, 0.5);
    margin-bottom: 1rem;
    transform: scaleX(-1); /* Mirror effect */
    display: block;
}

.hidden-canvas {
    display: none;
}

/* Toggle Switch */
.switch-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary-color);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

/* Helper Classes */
.switch-label {
    margin: 0;
    font-weight: bold;
}

.status-indicator--footer {
    margin-top: 20px;
}

.text-primary {
    color: var(--primary-color);
}

.peer-id-display {
    font-size: 0.8em;
    opacity: 0.7;
    margin-top: 5px;
    display: none;
}

.mode-description {
    font-size: 0.8rem;
    margin-top: 10px;
    opacity: 0.8;
}

/* Faded Controls */
.faded-controls {
    transition: opacity 0.3s;
    opacity: 0.5;
    pointer-events: none;
}

.faded-controls.active {
    opacity: 1;
    pointer-events: auto;
}
