body {
    background: url('assets/oldPaperBackground.jpg') no-repeat center center fixed;
    background-size: cover;
    font-family: 'Garamond', serif;
    color: #333;
    margin: 0;
    padding: 0;
}

.header-bar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 10px 20px;
    background-color: rgba(139, 69, 19, 0.9);
    gap: 10px;
}

.header-bar h2 {
    justify-self: start;
}

#status-container {
    justify-self: center;
}

#auth-container {
    justify-self: end;
}

.header-bar h2 {
    margin: 0;
    color: #F5DEB3;
    text-shadow: 1px 1px 2px #000;
}

.header-bar h2 .subtitle {
    font-size: 0.5em;
    font-weight: normal;
    opacity: 0.8;
    display: block;
}

#status-container {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0,0,0,0.3);
    padding: 8px 15px;
    border-radius: 20px;
}

#auth-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Connection status dot */
#connection-dot {
    width: 12px;
    height: 12px;
    min-width: 12px;
    min-height: 12px;
    border-radius: 50%;
    background-color: #dc3545;
    transition: background-color 0.3s;
    box-shadow: 0 0 5px rgba(0,0,0,0.3);
}

#connection-dot.connected {
    background-color: #28a745;
    box-shadow: 0 0 10px #28a745;
    animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
    0%, 100% { box-shadow: 0 0 5px #28a745; }
    50% { box-shadow: 0 0 15px #28a745; }
}

/* Ship count animation */
#ship-count {
    font-weight: bold;
    color: #F5DEB3;
    transition: transform 0.2s;
}

#ship-count.bump {
    transform: scale(1.3);
}

/* RTT celebration */
@keyframes rtt-celebration {
    0% { transform: scale(1); }
    25% { transform: scale(1.5); }
    50% { transform: scale(1); }
    75% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

.rtt-found {
    animation: rtt-celebration 1s ease-in-out;
}

#user-display {
    color: #F5DEB3;
    font-weight: bold;
}

.main-content {
    display: flex;
    gap: 20px;
    padding: 20px;
    max-width: 95%;
    margin: 0 auto;
}

.map-container {
    flex: 1;
}

#map {
    height: 600px;
    border: 2px solid #8B4513;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.rtt-panel {
    width: 250px;
    background-color: rgba(255, 255, 255, 0.9);
    border: 2px solid #8B4513;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
    transition: box-shadow 0.3s, transform 0.3s;
}

.rtt-panel.rtt-found {
    box-shadow: 0 0 30px #FFD700, 0 0 60px #FFD700;
    transform: scale(1.05);
}

.rtt-panel h4 {
    margin: 0 0 10px 0;
    color: #8B4513;
    font-size: 1.2em;
    border-bottom: 1px solid #8B4513;
    padding-bottom: 5px;
}

.rtt-panel div {
    margin: 5px 0;
    font-size: 0.95em;
}

#rtt-status {
    color: #666;
    font-style: italic;
}

#rtt-status.online {
    color: #228B22;
    font-style: normal;
    font-weight: bold;
}

.rtt-buttons {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.rtt-buttons button {
    font-size: 0.9em;
    padding: 8px;
}

.button-container {
    text-align: center;
    margin: 20px 0;
}

h2 {
    text-align: center;
    font-size: 2em;
    color: #8B4513;
    text-shadow: 1px 1px 2px #000;
}

h3 {
    text-align: center;
    color: #8B4513;
}

button {
    background-color: #8B4513;
    color: #fff;
    border: none;
    padding: 10px;
    margin: 5px;
    cursor: pointer;
    font-size: 1em;
    border-radius: 5px;
}

button:hover {
    background-color: #A0522D;
}

button:disabled {
    background-color: #999;
    cursor: not-allowed;
}

#routes-list {
    max-width: 80%;
    margin: 10px auto;
    background-color: rgba(255, 255, 255, 0.8);
    padding: 10px;
    border: 1px solid #8B4513;
    border-radius: 5px;
}

.route-item {
    cursor: pointer;
    padding: 5px;
    border: 1px solid #8B4513;
    margin: 2px;
    background-color: #F5DEB3;
}

.route-item:hover {
    background-color: #DEB887;
}

.route-item.sample {
    background-color: #E6F3FF;
    border-color: #4A90D9;
}

.route-item.sample:hover {
    background-color: #CCE5FF;
}

.connection-status {
    text-align: center;
    padding: 10px;
    margin: 10px auto;
    max-width: 400px;
    border-radius: 5px;
    display: none;
}

.connection-status.warning {
    display: block;
    background-color: #FFF3CD;
    border: 1px solid #FFC107;
    color: #856404;
}

.connection-status.info {
    display: block;
    background-color: #D1ECF1;
    border: 1px solid #17A2B8;
    color: #0C5460;
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background-color: #FFF8DC;
    border: 2px solid #8B4513;
    border-radius: 10px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
    position: relative;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

.modal-content h3 {
    margin-top: 0;
    color: #8B4513;
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    cursor: pointer;
    color: #8B4513;
}

.close-btn:hover {
    color: #A0522D;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #8B4513;
    font-weight: bold;
}

.form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #8B4513;
    border-radius: 5px;
    font-size: 1em;
    box-sizing: border-box;
}

.error-message {
    color: #DC3545;
    font-size: 0.9em;
    margin: 10px 0;
    min-height: 20px;
}

.auth-switch {
    text-align: center;
    margin-top: 15px;
    font-size: 0.9em;
}

.auth-switch a {
    color: #8B4513;
    font-weight: bold;
}

footer {
    text-align: center;
    padding: 20px;
    font-size: 0.8em;
    color: #666;
}

footer a {
    color: #8B4513;
}

/* Leaflet custom marker for RTT - no background, handled by inner div */
.rtt-marker-icon {
    background: transparent !important;
    border: none !important;
}

/* Make layer control more visible */
.leaflet-control-layers {
    background: rgba(255, 248, 220, 0.95) !important;
    border: 2px solid #8B4513 !important;
    border-radius: 8px !important;
    box-shadow: 0 3px 10px rgba(0,0,0,0.3) !important;
}

.leaflet-control-layers-toggle {
    width: 40px !important;
    height: 40px !important;
    background-size: 24px 24px !important;
}

.leaflet-control-layers-expanded {
    padding: 10px 15px !important;
}

.leaflet-control-layers-list {
    font-family: 'Garamond', serif;
    font-size: 14px;
}

.leaflet-control-layers-separator {
    border-top-color: #8B4513 !important;
}

/* ========== MOBILE RESPONSIVENESS ========== */
@media (max-width: 768px) {
    .header-bar {
        display: flex;
        flex-direction: column;
        padding: 10px;
        text-align: center;
    }

    .header-bar h2 {
        font-size: 1.4em;
        margin-bottom: 5px;
        justify-self: center;
    }

    #status-container {
        order: 3;
        justify-self: center;
    }

    #auth-container {
        order: 2;
        justify-self: center;
    }

    .main-content {
        flex-direction: column;
        padding: 10px;
    }

    .map-container {
        width: 100%;
    }

    #map {
        height: 400px;
    }

    .rtt-panel {
        width: 100%;
        margin-top: 10px;
    }

    .button-container {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 5px;
        padding: 10px;
    }

    .button-container button {
        font-size: 0.85em;
        padding: 8px 12px;
    }

    #routes-list {
        max-width: 95%;
    }

    /* Layer control on mobile - collapsed by default, smaller */
    .leaflet-control-layers {
        max-width: 120px;
    }

    .leaflet-control-layers-toggle {
        width: 30px !important;
        height: 30px !important;
    }

    .leaflet-control-layers-list {
        font-size: 12px;
    }

    .leaflet-control-layers-expanded {
        padding: 6px 8px !important;
    }

    /* Modal on mobile */
    .modal-content {
        width: 95%;
        padding: 20px;
        margin: 10px;
    }

    footer {
        font-size: 0.7em;
        padding: 10px;
    }
}

@media (max-width: 480px) {
    .header-bar h2 {
        font-size: 1.2em;
    }

    #map {
        height: 300px;
    }

    .button-container button {
        font-size: 0.75em;
        padding: 6px 10px;
        margin: 3px;
    }

    .rtt-panel h4 {
        font-size: 1em;
    }

    .rtt-buttons button {
        font-size: 0.8em;
        padding: 6px;
    }
}
