::-webkit-scrollbar { height: 6px; width: 6px; }
::-webkit-scrollbar-track { background: #0f172a; }
::-webkit-scrollbar-thumb { background: #334155; border-radius: 10px; }

.matrix-table { table-layout: fixed; width: max-content; border-spacing: 0; border-collapse: separate; }

.sticky-col {
    position: sticky; left: 0; z-index: 50;
    width: 300px; min-width: 300px; max-width: 300px;
    padding: 0 16px; white-space: nowrap; border-right: 2px solid #1e293b;
}

#table-body tr { background-color: #0b0f1a; }
#table-body tr:nth-child(even) { background-color: rgba(30, 41, 59, 0.4); }

#table-body tr td.sticky-col { background-color: #070a13; }
#table-body tr:nth-child(even) td.sticky-col { background-color: #0f1525; }

thead th { background-color: #0f172a !important; transition: background-color 0.1s ease; }
thead th.sticky-col { z-index: 60; }

.matrix-cell { width: 54px; min-width: 54px; height: 60px; text-align: center; vertical-align: middle; transition: background-color 0.1s ease; }

.col-locked {
    background-color: rgba(59, 130, 246, 0.35) !important;
}

.matrix-cell.col-hover:not(.col-locked) {
    background-color: rgba(59, 130, 246, 0.12) !important;
}

.mode-active { background-color: #2563eb; color: white; box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3); }

.table-container {
    overflow-x: auto; max-width: 100%; border-radius: 0.4rem;
    background: #0f172a; border: 1px solid #1e293b; display: inline-block;
}

.icon-wrapper { display: flex; justify-content: center; align-items: center; height: 24px; font-size: 16px; margin-bottom: 2px; }
.icon-wrapper.detail-icon { height: auto; font-size: inherit; margin-bottom: 0; }
.detail-card-icon { font-size: 28px; }
.detail-card-icon svg { display: block; height: 36px; width: auto; }

.action-btn {
    display: flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 50%;
    border: 1px solid #334155; transition: all 0.2s;
    cursor: pointer; color: #475569;
    flex-shrink: 0;
}
.remove-btn-container { opacity: 0; }
.sticky-col:hover .remove-btn-container { opacity: 1; }

/* Drag to reorder */
.drag-handle {
    display: flex; align-items: center; justify-content: center;
    width: 16px; margin-right: 10px; color: #334155; cursor: grab;
    opacity: 0; transition: opacity 0.15s;
    flex-shrink: 0; font-size: 12px;
}
.sticky-col:hover .drag-handle { opacity: 1; }
.drag-handle:active { cursor: grabbing; }

tr.dragging { opacity: 0.4; }
tr.drag-over-top td { box-shadow: inset 0 2px 0 0 #2563eb; }
tr.drag-over-bottom td { box-shadow: inset 0 -2px 0 0 #2563eb; }

.remove-btn-container:hover { background-color: #ef4444; border-color: #ef4444; color: white; }
.map-btn:hover { background-color: #334155; color: #60a5fa; border-color: #475569; }
.map-btn i { font-size: 14px; }

#autocomplete-results {
    position: absolute; top: 100%; left: 0; right: 0;
    background: #1e293b; border: 1px solid #334155; border-radius: 0.5rem;
    margin-top: 0.5rem; z-index: 100; max-height: 300px; overflow-y: auto;
    display: none; box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}
.suggestion-item { padding: 0.75rem; cursor: pointer; border-bottom: 1px solid #334155; }
.suggestion-item:hover { background: #2563eb; color: white; }

.detail-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.6);
    z-index: 200; display: flex; align-items: center; justify-content: center;
    animation: fadeIn 0.15s ease;
}
.detail-card {
    background: #1e293b; border: 1px solid #334155; border-radius: 1rem;
    padding: 1.5rem; width: 360px; max-width: 90vw; color: #e2e8f0;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
    animation: slideUp 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

.detail-card .detail-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 6px 0; border-bottom: 1px solid #334155;
}
.detail-card .detail-row:last-child { border-bottom: none; }
.detail-card .detail-label { font-size: 11px; text-transform: uppercase; font-weight: 700; letter-spacing: 0.05em; color: #94a3b8; }
.detail-card .detail-value { font-size: 14px; font-weight: 700; color: #f1f5f9; }

.detail-tabs { display: flex; gap: 2px; margin-bottom: 12px; background: #0f172a; border-radius: 8px; padding: 3px; }
.detail-tab {
    flex: 1; padding: 6px 0; text-align: center; font-size: 10px;
    font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em;
    border-radius: 6px; cursor: pointer; color: #64748b; transition: all 0.15s;
}
.detail-tab.active { background: #2563eb; color: white; box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3); }
.detail-tab:not(.active):hover { color: #94a3b8; }
.detail-tab-content { display: none; }
.detail-tab-content.active { display: block; }

.hourly-section { max-height: 340px; overflow-y: auto; margin-top: 4px; padding-right: 13px; }
.hourly-row {
    display: grid; grid-template-columns: 52px 28px 46px 1fr 50px;
    align-items: center; gap: 6px; padding: 5px 0;
    border-bottom: 1px solid rgba(51, 65, 85, 0.5); font-size: 12px;
}
.hourly-row:last-child { border-bottom: none; }
.hourly-time { font-weight: 700; color: #94a3b8; font-size: 11px; }
.hourly-temp { font-weight: 800; }
.hourly-precip { font-size: 10px; font-weight: 700; color: #60a5fa; text-align: right; }
.hourly-conditions { font-size: 10px; color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.loading-indicator {
    display: inline-block; width: 12px; height: 12px;
    border: 2px solid #334155; border-top-color: #60a5fa;
    border-radius: 50%; animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Auth styles */
.auth-overlay {
    position: fixed; inset: 0; background: #0b0f1a;
    z-index: 1000; display: flex; align-items: center; justify-content: center;
}
.auth-card {
    background: #1e293b; border: 1px solid #334155; border-radius: 1rem;
    padding: 2rem; width: 380px; max-width: 90vw; color: #e2e8f0;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
}
.auth-input {
    width: 100%; background: #0f172a; border: 1px solid #334155; border-radius: 0.5rem;
    padding: 0.625rem 0.875rem; color: white; font-size: 14px;
    outline: none; transition: border-color 0.15s;
}
.auth-input:focus { border-color: #2563eb; }
.auth-input::placeholder { color: #475569; }
.auth-btn {
    width: 100%; padding: 0.625rem; border-radius: 0.5rem; font-size: 13px;
    font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em;
    cursor: pointer; transition: all 0.15s; border: none;
}
.auth-btn-primary { background: #2563eb; color: white; }
.auth-btn-primary:hover { background: #1d4ed8; }
.auth-btn-primary:disabled { background: #1e3a5f; color: #64748b; cursor: not-allowed; }
.auth-error { color: #f87171; font-size: 12px; font-weight: 600; margin-top: 0.5rem; }
.auth-toggle { color: #60a5fa; cursor: pointer; font-size: 13px; font-weight: 600; }
.auth-toggle:hover { color: #93c5fd; }

.user-menu {
    display: flex; align-items: center; gap: 0.5rem;
    background: #0f172a; border: 1px solid #334155; border-radius: 0.5rem;
    padding: 0.375rem 0.75rem; font-size: 12px; font-weight: 700;
    color: #94a3b8; white-space: nowrap;
    flex-shrink: 0;
}
.user-menu-name { color: #e2e8f0; }
.sign-out-btn {
    color: #64748b; cursor: pointer; margin-left: 0.25rem;
    transition: color 0.15s;
}
.sign-out-btn:hover { color: #f87171; }

/* Controls row */
.controls-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 8px;
}
.controls-row > :nth-child(1) {
    justify-self: start;
}
.controls-row > :nth-child(2) {
    justify-self: center;
}
.controls-row > :nth-child(3) {
    justify-self: end;
}

@media (max-width: 768px) {
    .controls-row {
        display: flex; flex-wrap: wrap; gap: 8px;
    }
    .controls-row > :nth-child(2) {
        order: -1; width: 100%;
    }
}

/* Dashboard title dropdown */
.dashboard-dropdown-container-title {
    position: relative;
}

.dashboard-title-btn {
    background: none; border: none; padding: 0;
    cursor: pointer; white-space: nowrap;
    font-size: 1.5rem; font-weight: 900; color: white;
    font-style: italic; text-transform: uppercase;
    letter-spacing: -0.05em; line-height: 1;
}
.dashboard-title-btn:hover { color: #93c5fd; }

#dashboard-current-name {
    max-width: 400px; padding-right: 2px;
    text-overflow: ellipsis; overflow: hidden;
    display: inline;
}

.dashboard-title-chevron {
    font-size: 8px; color: #334155;
    background: #1e293b; border: 1px solid #334155; border-radius: 4px;
    width: 16px; height: 16px;
    display: inline-flex; align-items: center; justify-content: center;
    position: relative; top: 0px;
    margin-left: 4px; font-style: normal;
    transition: all 0.2s; flex-shrink: 0;
}
.dashboard-title-btn:hover .dashboard-title-chevron { border-color: #475569; color: #64748b; background: #334155; }
.dashboard-title-btn.open .dashboard-title-chevron { transform: rotate(180deg); border-color: #2563eb; color: #60a5fa; background: rgba(37, 99, 235, 0.15); }

.dashboard-dropdown-menu {
    position: absolute; top: calc(100% + 8px); left: 0;
    min-width: 240px; width: max-content;
    background: #1e293b; border: 1px solid #334155; border-radius: 0.5rem;
    z-index: 150; max-height: 400px; overflow-y: auto;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    animation: dropdownSlide 0.15s ease;
}
@keyframes dropdownSlide {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.dashboard-dropdown-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px; cursor: pointer;
    border-bottom: 1px solid rgba(51, 65, 85, 0.5);
    transition: background-color 0.1s;
    font-size: 11px; font-weight: 700; color: #94a3b8;
}
.dashboard-dropdown-item:hover { background: #334155; color: #e2e8f0; }
.dashboard-dropdown-item.active { background: rgba(37, 99, 235, 0.15); color: #60a5fa; }
.dashboard-dropdown-item.active:hover { background: rgba(37, 99, 235, 0.25); }

.dashboard-dropdown-divider { height: 1px; background: #334155; }

.dashboard-dropdown-create {
    display: flex; align-items: center;
    padding: 10px 14px; cursor: pointer;
    color: #60a5fa; font-size: 11px; font-weight: 700;
    transition: background-color 0.15s;
    border-radius: 0 0 0.4rem 0.4rem;
}
.dashboard-dropdown-create:hover { background: #334155; color: #93c5fd; }

@media (max-width: 768px) {
    #dashboard-current-name { max-width: 220px; font-size: 1.25rem; }
}
