/* semaforo.css */

.semaforo-wrapper {
    display: grid;
    grid-template-columns: 1.2fr 1fr; /* Adjusted for better balance */
    gap: 2rem;
    align-items: stretch;
    max-width: 1100px;
    margin: 0 auto;
}

@media (max-width: 992px) {
    .semaforo-wrapper {
        grid-template-columns: 1fr;
    }
}

/* Left Column: Visuals */
.visual-section {
    position: relative;
    background: var(--surface-2, #f1f5f9);
    border-radius: var(--radius-xl, 1.5rem);
    padding: 1.5rem; /* Reduced from 3rem */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem; /* Reduced from 3rem */
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
    border: 1px solid rgba(0,0,0,0.05);
    height: 100%;
}

.traffic-light-container {
    background: #1a1a1a;
    padding: 1.25rem; /* Slightly reduced */
    border-radius: 3.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem; /* Reduced */
    box-shadow: 
        0 20px 50px rgba(0,0,0,0.3),
        inset 0 -5px 15px rgba(255,255,255,0.1),
        inset 0 5px 15px rgba(0,0,0,0.5);
    position: relative;
    border: 4px solid #333;
}

.light {
    width: 110px; /* Slightly reduced to help fit */
    height: 110px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.2rem;
    opacity: 0.15;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    filter: saturate(0.5) brightness(0.5);
    position: relative;
    cursor: default;
    background: #222;
    box-shadow: inset 0 4px 10px rgba(0,0,0,0.8);
}

.light::after {
    content: '';
    position: absolute;
    top: 10%;
    left: 20%;
    width: 30%;
    height: 20%;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    filter: blur(2px);
}

.light.active {
    opacity: 1;
    filter: saturate(1.2) brightness(1.1);
    transform: scale(1.05);
    box-shadow: 
        0 0 30px currentColor,
        0 0 60px currentColor,
        inset 0 2px 10px rgba(255,255,255,0.4);
}

.light.red { color: #ff4757; }
.light.red.active { background: radial-gradient(circle at 30% 30%, #ff6b81, #ff4757); }

.light.yellow { color: #ffa502; }
.light.yellow.active { background: radial-gradient(circle at 30% 30%, #ffbe76, #ffa502); }

.light.green { color: #2ed573; }
.light.green.active { background: radial-gradient(circle at 30% 30%, #7bed9f, #2ed573); }

.light .face {
    filter: drop-shadow(0 2px 5px rgba(0,0,0,0.4));
    user-select: none;
}

/* Visualizer Style Upgrade */
.visualizer-container {
    width: 100%;
    max-width: 500px;
    height: 140px; /* Slightly reduced */
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
    border-radius: 1.25rem;
    position: relative;
    overflow: hidden;
    box-shadow: 
        0 10px 30px rgba(0,0,0,0.2),
        inset 0 1px 1px rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.05);
}

#audioVisualizer {
    width: 100%;
    height: 100%;
    display: block;
    opacity: 0.8;
}

.volume-meter {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 10px;
    background: rgba(0,0,0,0.3);
}

.volume-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #2ed573, #ffa502, #ff4757);
    background-size: 600px 100%;
    transition: width 0.1s linear;
}

.threshold-marker {
    position: absolute;
    top: -20px;
    width: 3px;
    height: 40px;
    background: #fff;
    box-shadow: 0 0 10px rgba(255,255,255,0.8);
    z-index: 10;
    border-radius: 2px;
}

/* Alert Overlay */
.noise-alert-overlay {
    position: absolute;
    inset: 0;
    border: 0px solid rgba(255, 71, 87, 0.5);
    pointer-events: none;
    transition: border-width 0.3s ease;
    z-index: 5;
    border-radius: var(--radius-xl, 1.5rem);
}

.is-alerting .noise-alert-overlay {
    border-width: 25px;
    animation: pulse-border 1s infinite alternate;
}

@keyframes pulse-border {
    0% { border-color: rgba(255, 71, 87, 0.2); }
    100% { border-color: rgba(255, 71, 87, 0.6); }
}

/* Right Column: Controls */
.control-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    justify-content: space-between; /* Distribute vertically */
    height: 100%;
}

.control-group {
    background: var(--surface-1, #fff);
    padding: 1.5rem;
    border-radius: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    border: 1px solid rgba(0,0,0,0.03);
    margin: 0;
    flex: 1; /* Make them grow to fill space */
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.control-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-main);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

/* Timer Premium */
.timer-display {
    background: #1e293b;
    color: #fff;
    padding: 2rem 1.5rem;
    border-radius: 1.25rem;
    text-align: center;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.2);
    position: relative;
    overflow: hidden;
    flex: 1.5; /* Give timer more space */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.timer-display::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #ff4757, transparent);
}

.timer-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #94a3b8;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.timer-value {
    font-family: 'JetBrains Mono', 'Courier New', Courier, monospace;
    font-size: 4rem;
    line-height: 1;
    font-weight: 800;
    margin-bottom: 1.5rem;
    color: #ff4757;
    text-shadow: 0 0 20px rgba(255, 71, 87, 0.3);
}

.btn-primary {
    background: var(--primary, #2150c9);
    border: none;
    color: white;
    font-weight: 700;
    border-radius: 0.75rem;
    transition: all 0.2s;
    box-shadow: 0 4px 14px 0 rgba(33, 80, 201, 0.39);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(33, 80, 201, 0.45);
}

.btn-primary:disabled {
    background: #94a3b8;
    box-shadow: none;
    opacity: 0.7;
}

.btn-secondary {
    background: rgba(255,255,255,0.1);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 0.5rem;
}

.btn-secondary:hover {
    background: rgba(255,255,255,0.2);
}


/* EduTools visual refresh: shared tool polish */
:root {
  --sl-primary: var(--color-primary);
  --sl-primary-hover: var(--color-primary-dark);
  --sl-accent: var(--color-accent);
  --sl-accent-hover: var(--color-accent-dark);
  --sl-border: var(--color-border);
  --gc2-blue: var(--color-primary);
  --gc2-blue-lt: var(--color-primary-soft);
  --die-bg: var(--color-primary);
  --arena-bg: var(--color-primary-soft);
  --stat-bar-color: var(--color-primary);
}

.tool-stage {
  border-color: rgb(219 226 220 / 0.96);
  background: rgb(255 255 255 / 0.94);
  box-shadow: 0 18px 45px rgb(23 58 70 / 0.08);
}

.tool-stage :is(.sl-step, .gc2-panel, .grade-panel, .team-card, .rb-panel, .rb-card, .rb-section, .md-card, .md-panel, .vote-card, .clock-panel, .roulette-panel, .noise-card, .stats-section, .dice-arena) {
  border-color: rgb(219 226 220 / 0.96);
  border-radius: var(--radius-xl);
  box-shadow: 0 16px 36px rgb(23 58 70 / 0.08);
}

.tool-stage :is(input, textarea, select, .sl-qty-input, .gc2-meta-input, .gc2-setting select, .gc2-setting input[type="number"]) {
  border-color: rgb(202 213 205 / 0.95);
  background-color: #ffffff;
}

.tool-stage :is(input, textarea, select, .sl-qty-input, .gc2-meta-input):focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgb(23 107 135 / 0.12);
}

.btn--ai,
.gc2-btn--primary,
.btn-giant,
.rb-btn--primary,
.md-primary-action,
.vote-primary,
.clock-primary {
  border-color: var(--color-primary);
  color: #ffffff;
  background: var(--color-primary);
  box-shadow: 0 14px 24px rgb(23 107 135 / 0.18);
}

.btn--ai:hover,
.gc2-btn--primary:hover,
.btn-giant:hover,
.rb-btn--primary:hover,
.md-primary-action:hover,
.vote-primary:hover,
.clock-primary:hover {
  background: var(--color-primary-dark);
}

.sl-step::before {
  background: linear-gradient(90deg, var(--color-primary), #1b7f67, var(--color-accent));
}

.sl-preset.active,
.btn-toggle.active,
.grade-meter span {
  background: var(--color-primary);
}

.sl-qty-btn:hover,
.sl-preset:hover {
  border-color: rgb(23 107 135 / 0.34);
  color: var(--color-primary-dark);
  background: var(--color-primary-soft);
  box-shadow: 0 10px 20px rgb(23 107 135 / 0.12);
}

.rb-section__icon,
.rb-export-card__icon,
.edu-warning-icon,
.face {
  display: inline-grid;
  place-items: center;
  color: var(--color-primary-dark);
}

.edu-warning-icon {
  width: 3.75rem;
  height: 3.75rem;
  margin-bottom: 12px;
  border-radius: var(--radius-md);
  background: var(--color-primary-soft);
}

.rb-section__icon,
.rb-export-card__icon {
  border-radius: var(--radius-md);
  background: var(--color-primary-soft);
}

.material-symbols-outlined {
  vertical-align: middle;
}
