:root {
    --primary-color: #f59e0b;
    --secondary-color: #1f2937;
    --text-on-primary: #000000;
    --bg-dark: #111827;
    --bg-card: #1f2937;
    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
    --border-color: #374151;
}

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

.hidden {
    display: none !important;
}

body {
    font-family: 'Roboto', sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
}

/* Home Page */
.home-page {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.home-container {
    max-width: 500px;
    width: 100%;
    text-align: center;
}

.hero-title {
    font-family: 'Tangerine', cursive;
    font-size: 5rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    line-height: 1;
}

.hero-subtitle {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

.create-form {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 1rem;
    border: 1px solid var(--border-color);
}

.form-group {
    margin-bottom: 1rem;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
}

.form-group input[type="text"],
.form-group input[type="time"] {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
}

.form-group input[type="text"]:focus,
.form-group input[type="time"]:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-group input[type="color"] {
    width: 100%;
    height: 50px;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    cursor: pointer;
    background: transparent;
}

.color-row {
    display: flex;
    gap: 1rem;
}

.color-row .form-group {
    flex: 1;
}

.btn-create,
.btn-primary {
    width: 100%;
    padding: 1rem;
    background: var(--primary-color);
    color: var(--secondary-color);
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s;
    font-family: inherit;
}

.btn-create:hover,
.btn-primary:hover {
    opacity: 0.9;
}

.btn-secondary {
    padding: 0.75rem 1.5rem;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
    cursor: pointer;
    font-family: inherit;
}

.btn-secondary:hover {
    background: var(--border-color);
}

/* Crawl Page */
.crawl-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: var(--secondary-color);
    border-bottom: 1px solid var(--border-color);
}

.crawl-header-info {
    flex: 1;
}

.crawl-title {
    font-family: 'Tangerine', cursive;
    font-size: 2.5rem;
    color: var(--primary-color);
    line-height: 1;
}

.crawl-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 0.25rem;
    white-space: pre-line;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

/* Settings Panel */
.settings-panel {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
}

.settings-panel.hidden {
    display: none;
}

.settings-form h3 {
    margin-bottom: 1rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.settings-form .color-row {
    margin-bottom: 1rem;
}

.settings-form .btn-primary {
    padding: 0.75rem;
}

/* Announcement Banner */
.announcement-banner {
    background: var(--primary-color);
    color: var(--secondary-color);
    padding: 0.75rem 1.5rem;
    text-align: center;
    font-weight: 500;
    animation: pulse 2s infinite;
}

.announcement-banner.hidden {
    display: none;
}

/* SSE disconnection indicator */
.sse-disconnected::before {
    content: 'Reconnecting...';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #ef4444;
    color: white;
    text-align: center;
    padding: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    z-index: 9999;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

/* Admin Controls */
.admin-controls {
    background: var(--bg-card);
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.announcement-form {
    display: flex;
    gap: 0.5rem;
}

.announcement-form input {
    flex: 1;
    padding: 0.5rem 1rem;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    color: var(--text-primary);
    font-family: inherit;
}

.btn-small {
    padding: 0.5rem 1rem;
    background: var(--primary-color);
    color: var(--secondary-color);
    border: none;
    border-radius: 0.5rem;
    font-weight: 500;
    cursor: pointer;
}

/* Map */
#map {
    width: 100%;
    height: 55vh;
}

.custom-marker .marker-pin {
    width: 30px;
    height: 30px;
    border-radius: 50% 50% 50% 0;
    background: var(--primary-color);
    transform: rotate(-45deg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--secondary-color);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.custom-marker .marker-pin::after {
    content: attr(data-number);
    transform: rotate(45deg);
}

.leaflet-container {
    font-family: inherit;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 1rem;
    border: 1px solid var(--border-color);
    width: 100%;
    max-width: 400px;
}

.modal-content h2 {
    font-family: 'Tangerine', cursive;
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.modal-actions .btn-secondary {
    flex: 1;
}

.modal-actions .btn-primary {
    flex: 2;
}

/* Bar List */
.bar-list-container {
    padding: 1.5rem;
    max-width: 800px;
    margin: 0 auto;
}

.list-title {
    font-family: 'Tangerine', cursive;
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.bar-list {
    list-style: none;
}

.bar-list li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    transition: border-color 0.2s;
    cursor: pointer;
}

.bar-list li:hover {
    border-color: var(--primary-color);
}

.bar-list li.current-bar {
    background: var(--primary-color);
    color: var(--text-on-primary);
    border-color: var(--primary-color);
    animation: glow 2s infinite;
}

.bar-list li.current-bar .bar-number,
.bar-list li.current-bar .bar-name {
    color: var(--text-on-primary);
}

.bar-list li.current-bar .bar-time {
    background: rgba(0,0,0,0.2);
    color: var(--text-on-primary);
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 5px var(--primary-color); }
    50% { box-shadow: 0 0 20px var(--primary-color); }
}

.bar-number {
    font-weight: 700;
    color: var(--primary-color);
    min-width: 1.5rem;
}

.bar-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.bar-name {
    font-weight: 500;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bar-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.current-bar .bar-description {
    color: var(--text-on-primary);
    opacity: 0.8;
}

.bar-time {
    color: var(--text-secondary);
    font-size: 0.875rem;
    background: var(--bg-dark);
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    text-align: center;
    flex-shrink: 0;
    white-space: nowrap;
}

.bar-time-form {
    flex-shrink: 0;
}

.bar-time-form input[type="time"] {
    font-size: 0.875rem;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--primary-color);
    border-radius: 0.5rem;
    background: var(--bg-card);
    color: var(--text-primary);
}

.current-btn,
.delete-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 0.25rem;
    transition: all 0.2s;
}

.current-btn:hover {
    background: var(--primary-color);
    color: var(--text-on-primary);
}

.delete-btn:hover {
    background: #ef4444;
    color: white;
}

.current-bar .current-btn {
    color: var(--text-on-primary);
}

.current-bar .delete-btn {
    color: var(--text-on-primary);
}

.empty-state {
    text-align: center;
    color: var(--text-secondary);
    padding: 3rem 1rem;
    font-size: 1.1rem;
}

/* Mobile Responsive */
@media (max-width: 640px) {
    .hero-title {
        font-size: 3.5rem;
    }

    #map {
        height: 45vh;
    }

    .crawl-title {
        font-size: 2.5rem;
    }

    .crawl-description {
        font-size: 1.1rem;
    }

    .bar-time {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
}

/* View-only mode - uses computed palette */
.view-only {
    --text-on-secondary: #ffffff;
    --text-muted-on-secondary: rgba(255, 255, 255, 0.7);
    --card-bg: rgba(255, 255, 255, 0.1);
    --card-border: rgba(255, 255, 255, 0.2);
    --badge-bg: rgba(0, 0, 0, 0.2);

    background: var(--secondary-color);
    color: var(--text-on-secondary);
}

.view-only.light-bg {
    --text-on-secondary: #1a1a1a;
    --text-muted-on-secondary: rgba(0, 0, 0, 0.6);
    --card-bg: rgba(0, 0, 0, 0.05);
    --card-border: rgba(0, 0, 0, 0.15);
    --badge-bg: rgba(0, 0, 0, 0.1);
}

.view-only .crawl-header {
    background: var(--secondary-color);
    border-color: var(--card-border);
}

.view-only .crawl-title {
    color: var(--primary-color);
}

.view-only .btn-icon {
    color: var(--text-muted-on-secondary);
    border-color: var(--card-border);
}

.view-only .btn-icon:hover {
    background: var(--card-bg);
    color: var(--text-on-secondary);
}

.view-only .list-title {
    color: var(--primary-color);
}

.view-only .bar-list li {
    background: var(--card-bg);
    border-color: var(--card-border);
    color: var(--text-on-secondary);
}

.view-only .bar-list li:hover {
    border-color: var(--primary-color);
}

.view-only .bar-number {
    color: var(--primary-color);
}

.view-only .bar-name {
    color: var(--text-on-secondary);
}

.view-only .bar-time {
    background: var(--badge-bg);
    color: var(--text-muted-on-secondary);
}

.view-only .empty-state {
    color: var(--text-muted-on-secondary);
}

.view-only .delete-btn,
.view-only .current-btn,
.view-only .settings-panel,
.view-only .admin-controls,
.view-only .header-actions {
    display: none !important;
}

.view-only #map {
    cursor: default;
}

/* QR Code - hidden on screen, shown in print */
.print-qr {
    display: none;
}


/* Print Styles */
@page {
    margin: 0.5in;
    /* Hide browser header/footer */
    @top-left { content: none; }
    @top-right { content: none; }
    @bottom-left { content: none; }
    @bottom-right { content: none; }
}

@media print {
    .print-qr {
        display: block;
        text-align: center;
        margin: 1rem 0;
    }

    .print-qr p {
        margin-top: 0.25rem;
        font-size: 0.75rem;
        color: #666;
    }
    body {
        background: white;
        color: black;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .crawl-header {
        background: white;
        border: none;
        padding: 0.5rem 0;
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
    }

    .crawl-title {
        color: black;
        font-size: 2.5rem;
    }

    .crawl-description {
        color: #666;
    }

    .print-qr {
        display: block !important;
        text-align: center;
        flex-shrink: 0;
    }

    .print-qr img {
        display: block !important;
        width: 100px;
        height: 100px;
        margin: 0 auto;
    }

    .print-qr p {
        margin: 0.25rem 0 0 0;
        font-size: 0.625rem;
        color: #666;
    }

    .header-actions,
    .modal,
    .settings-panel,
    .admin-controls,
    .announcement-banner,
    .delete-btn,
    .current-btn,
    .btn-icon,
    .empty-state {
        display: none !important;
    }

    #map {
        height: 300px !important;
        margin-bottom: 1rem;
        border: 1px solid #ccc;
    }

    .bar-list-container {
        padding: 0;
    }

    .list-title {
        color: black;
        border-bottom: 2px solid black;
        padding-bottom: 0.5rem;
        font-size: 2rem;
    }

    .bar-list li {
        background: white;
        border: none;
        border-bottom: 1px solid #ddd;
        border-radius: 0;
        padding: 0.75rem 0;
    }

    .bar-number {
        color: black;
    }

    .bar-time {
        background: none;
        color: #666;
    }
}
