/*
ver: 0.9.1
*/

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: -webkit-fill-available;
}

body {
    font-family: 'Share Tech Mono', monospace;
    background-color: #000;
    color: #ffaa33;
    width: 100vw;
    height: 100vh;
    height: -webkit-fill-available;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

body:not(.modal-open) {
    cursor: pointer;
}

/* Menu Button - MOVED TO BOTTOM LEFT */
.menu-button {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 50px;
    height: 50px;
    background-color: #333;
    border: none;
    border-radius: 50%;
    color: #ccc;
    font-size: 1.5rem;
    z-index: 1000;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.menu-button:hover {
    background-color: #444;
    transform: scale(1.05);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    z-index: 2000;
    overflow-y: auto;
}

.modal.open {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: #111;
    border: 2px solid #333;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    color: #ffaa33;
    font-size: 1.5rem;
}

.close-button {
    background: none;
    border: none;
    color: #ccc;
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
}

.modal-body {
    padding: 20px;
    flex: 1;
    overflow-y: auto;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    color: #ccc;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

#station-search, #station-select, #direction-select {
    width: 100%;
    padding: 10px;
    background-color: #222;
    border: 1px solid #444;
    border-radius: 4px;
    color: #fff;
    font-family: 'Share Tech Mono', monospace;
    font-size: 1rem;
}

#station-select {
    height: 300px;
}

#station-search:focus, #station-select:focus, #direction-select:focus {
    outline: none;
    border-color: #ffaa33;
}

/* Line Selection */
.line-selection {
    margin-bottom: 20px;
    padding: 15px;
    background-color: #1a1a1a;
    border-radius: 4px;
    border: 1px solid #333;
}

.line-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.line-button {
    padding: 8px 12px;
    background-color: #333;
    border: 2px solid #444;
    border-radius: 4px;
    color: #fff;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    flex: 1;
    min-width: 120px;
    text-align: center;
}

.line-button:hover {
    background-color: #444;
    border-color: #555;
}

.line-button.active {
    border-color: #ffaa33;
    background-color: #222;
    color: #ffaa33;
    font-weight: bold;
}

/* Tube line colors */
.line-button[data-line="Central"] {
    border-left: 4px solid #ff3300;
}
.line-button[data-line="District"] {
    border-left: 4px solid #006633;
}
.line-button[data-line="Circle"] {
    border-left: 4px solid #ffcc00;
}
.line-button[data-line="Hammersmith & City"] {
    border-left: 4px solid #cc9999;
}
.line-button[data-line="Metropolitan"] {
    border-left: 4px solid #660066;
}
.line-button[data-line="Jubilee"] {
    border-left: 4px solid #868f98;
}
.line-button[data-line="Victoria"] {
    border-left: 4px solid #0099cc;
}
.line-button[data-line="Northern"] {
    border-left: 4px solid #000000;
}
.line-button[data-line="Piccadilly"] {
    border-left: 4px solid #000099;
}
.line-button[data-line="Bakerloo"] {
    border-left: 4px solid #996633;
}
.line-button[data-line="Waterloo & City"] {
    border-left: 4px solid #66cccc;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid #333;
    text-align: right;
}

.save-button {
    background-color: #333;
    color: #ccc;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    font-family: 'Share Tech Mono', monospace;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.save-button:enabled {
    background-color: #ffaa33;
    color: #000;
    cursor: pointer;
}

.save-button:enabled:hover {
    background-color: #ffbb44;
}

.save-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Main Sign Container */
.sign-container {
    background-color: #000;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 0 20px;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
}

/* Main departure board */
#departures {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding-top: 20px;
}

/* Departure rows */
.departure-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    flex: 1;
    min-height: 0;
    width: 100%;
    overflow: hidden;
    padding: 5px 0;
}

.row-number {
    flex: 0 0 10%;
    text-align: center;
    font-size: 6rem;
    font-weight: 400;
    color: #ffaa33;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.destination {
    flex: 1;
    min-width: 0;
    font-size: 4.5rem;
    font-weight: 400;
    color: #ffaa33;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0 15px;
    display: flex;
    align-items: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1;
}

.time {
    flex: 0 0 25%;
    text-align: right;
    font-size: 4.5rem;
    font-weight: 400;
    color: #ffaa33;
    font-variant-numeric: tabular-nums;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    line-height: 1;
}

.loading {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: #ffaa33;
    opacity: 0.7;
    text-align: center;
    padding: 0 20px;
    line-height: 1.2;
}

.loading small {
    font-size: 1.5rem;
    margin-top: 20px;
    color: #888;
}

/* Digital clock at bottom */
.digital-clock {
    font-size: 5rem;
    font-family: 'Segment7', 'Share Tech Mono', monospace;
    font-weight: normal;
    color: #ffaa33;
    font-variant-numeric: tabular-nums;
    letter-spacing: 2px;
    text-align: center;
    padding: 20px 0;
    border-top: 2px solid #333;
    margin-top: auto;
    flex-shrink: 0;
    background-color: #000;
    position: relative;
    padding-bottom: max(20px, env(safe-area-inset-bottom));
    min-height: 80px;
    line-height: 1;
}

/* Desktop adjustments for smaller screens */
@media (max-width: 1200px) {
    .row-number {
        font-size: 5rem;
    }
    
    .destination {
        font-size: 3.5rem;
    }
    
    .time {
        font-size: 3.5rem;
    }
    
    .digital-clock {
        font-size: 4rem;
    }
}

/* Tablet */
@media (max-width: 1024px) {
    .row-number {
        font-size: 4rem;
    }
    
    .destination {
        font-size: 3rem;
    }
    
    .time {
        font-size: 3rem;
    }
    
    .digital-clock {
        font-size: 3.5rem;
    }
    
    .loading {
        font-size: 2.5rem;
    }
}

/* Mobile Landscape */
@media (max-width: 768px) and (orientation: landscape) {
    .sign-container {
        padding: 0 10px;
    }
    
    #departures {
        padding-top: 5px;
    }
    
    .departure-row {
        padding: 2px 0;
    }
    
    .row-number {
        flex: 0 0 8%;
        font-size: 2.8rem;
    }
    
    .destination {
        flex: 1;
        font-size: 2.2rem;
        padding: 0 10px;
        letter-spacing: 0.5px;
    }
    
    .time {
        flex: 0 0 22%;
        font-size: 2.2rem;
    }
    
    .digital-clock {
        font-size: 2.8rem;
        padding: 10px 0;
        min-height: 50px;
        letter-spacing: 1px;
        padding-bottom: max(10px, env(safe-area-inset-bottom));
    }
    
    .loading {
        font-size: 2rem;
        line-height: 1.1;
    }
    
    .loading small {
        font-size: 1.2rem;
        margin-top: 10px;
    }
    
    /* Bottom menu button for mobile */
    .menu-button {
        bottom: max(15px, env(safe-area-inset-bottom));
        left: 15px;
        width: 45px;
        height: 45px;
        font-size: 1.3rem;
    }
}

/* Mobile Portrait */
@media (max-width: 768px) and (orientation: portrait) {
    .sign-container {
        padding: 0 8px;
    }
    
    #departures {
        padding-top: 5px;
    }
    
    .departure-row {
        padding: 3px 0;
    }
    
    .row-number {
        flex: 0 0 10%;
        font-size: 2.5rem;
    }
    
    .destination {
        flex: 1;
        font-size: 1.9rem;
        padding: 0 8px;
        letter-spacing: 0.5px;
    }
    
    .time {
        flex: 0 0 22%;
        font-size: 1.9rem;
    }
    
    .digital-clock {
        font-size: 2.5rem;
        padding: 12px 0;
        min-height: 50px;
        letter-spacing: 1px;
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }
    
    .loading {
        font-size: 1.8rem;
        line-height: 1.1;
    }
    
    .loading small {
        font-size: 1rem;
        margin-top: 10px;
    }
    
    /* Bottom menu button for mobile */
    .menu-button {
        bottom: max(10px, env(safe-area-inset-bottom));
        left: 10px;
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
    
    /* Smaller line buttons on mobile */
    .line-button {
        min-width: 100px;
        padding: 6px 10px;
        font-size: 0.8rem;
    }
}

/* Very small screens */
@media (max-width: 480px) {
    .sign-container {
        padding: 0 5px;
    }
    
    .destination {
        padding: 0 5px;
    }
    
    .row-number {
        font-size: 2.2rem;
    }
    
    .destination {
        font-size: 1.6rem;
    }
    
    .time {
        font-size: 1.6rem;
    }
    
    .digital-clock {
        font-size: 2.2rem;
        padding: 10px 0;
    }
    
    .modal-content {
        width: 95%;
    }
    
    #station-select {
        height: 200px;
    }
    
    .line-button {
        min-width: 80px;
        padding: 5px 8px;
        font-size: 0.75rem;
    }
}

/* Fullscreen styles */
body.fullscreen {
    background-color: #000;
}

body.fullscreen .menu-button {
    display: none;
}

body.fullscreen .sign-container {
    padding-top: 0;
}