/* ------------------------------
   GENERAL PAGE LAYOUT
------------------------------ */

body {
    background: #4d4141;
    color: #eee;
    font-family: Arial, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding-top: 20px;
}

h1 {
    margin: 0;
}

#intersection {
    display: grid;
    grid-template-columns: repeat(2, 200px);
    gap: 20px;
}

.direction {
    background: #222;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
}

.label {
    margin-bottom: 10px;
    font-size: 14px;
}

/* ------------------------------
   TABLE CONTAINER
------------------------------ */

#directionTable {
    background: white;
    padding: 16px;
    border-radius: 8px;
    margin-top: 20px;
    display: inline-block;
    box-shadow: 0 0 8px rgba(0,0,0,0.1);
    color: black;
}

#directionTable table {
    table-layout: auto;
}


#directionTable th,
#directionTable td {
    padding: 6px 10px;
    border: 1px solid #ccc;
    color: black;
}

/* ------------------------------
   SIGNAL LAMPS
------------------------------ */

.signal {
    margin: 0 auto;
    background: #333;
    padding: 10px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.lamp {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #444;
    opacity: 0.2;
}

.red    { background: #800; }
.yellow { background: #aa0; }
.green  { background: #0a0; }

.lamp.active {
    opacity: 1;
    box-shadow: 0 0 12px rgba(255,255,255,0.7);
}

/* GP split lamp */
.lamp.split {
    border-radius: 50%;
    overflow: hidden;
    background: transparent;
    opacity: 1;
    box-shadow: none;
}

.lamp.split .half {
    width: 100%;
    height: 50%;
}

.lamp.split .top {
    background: #ccc;
}

.lamp.split .bottom {
    background: #0a0;
}

.lamp.split.inactive .top,
.lamp.split.inactive .bottom {
    background: #444;
}

/* ------------------------------
   BLOCK TABLE
------------------------------ */

.blockTable {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.blockTable th, .blockTable td {
    padding: 8px;
    border-bottom: 1px solid #444;
}

/* ------------------------------
   10-SECOND RULER (flex)
------------------------------ */

.rulerRow {
    display: flex;
    height: 30px;
    margin-bottom: 2px;
    position: relative;
}

.rulerSegment {
    border-left: 1px solid black;
    border-right: 1px solid black;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: flex-end;
}

.rulerLabel {
    font-size: 11px;
    color: black;
    position: absolute;
    top: 0px;
    white-space: nowrap;
}

/* ------------------------------
   BLOCK ROW (1-second blocks)
------------------------------ */

.timelineCell {
    display: flex;
    flex-direction: column;
    width: max-content;
    padding: 6px 0;
}

.blockRow {
    display: flex;
    height: 25px;
    margin-bottom: 6px;
}

.block {
    width: calc(var(--px-per-second) - 2px);
    height: 30px;
    border-radius: 3px;
    border: 1px solid #000;
    margin-right: 2px;
    box-sizing: border-box;
    flex-shrink: 0;
}

.blockRow .block:last-child {
    margin-right: 0;
}

/* Block colors */
.block.red            { background: #ff4d4d; }
.block.yellow         { background: #ffff66; }
.block.amber          { background: linear-gradient(to bottom, #ff4d4d 50%, #ffff66 50%); }
.block.green          { background: #66ff66; }
.block.green_special  { background: linear-gradient(to bottom, #ffffff 50%, #66ff66 50%); }
.block.offset         {background: #cccccc;}
.block.non_green      { background: #ff9999;}
