/* TimeWalk Dashboard — Cities tab styles */

#tab-cities {
    padding: 0;
}

#tab-cities-inner {
    padding: 24px;
    max-width: 1100px;
    margin: 0;
}

/* ---- Toolbar ---- */
.cities-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 12px;
    flex-wrap: wrap;
}

.cities-toolbar h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    flex: 1;
}

/* ---- City grid ---- */
.cities-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

/* ---- City card ---- */
.city-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.city-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.4);
    border-color: var(--accent);
}
.city-card.expanded {
    border-color: var(--accent);
    grid-column: 1 / -1;
}

/* Thumbnail strip */
.city-card-thumbs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    height: 100px;
    overflow: hidden;
}
.city-thumb {
    background-size: cover;
    background-position: center;
    background-color: #1a1a2e;
    transition: transform 0.3s;
}
.city-card:hover .city-thumb {
    transform: scale(1.05);
}

/* Card info area */
.city-card-info {
    padding: 14px 16px;
}
.city-card-name {
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 2px;
}
.city-card-location {
    font-size: 12px;
    color: var(--text-dim);
    margin-bottom: 10px;
}
.city-card-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 12px;
    line-height: 1.4;
}

/* Completion bar */
.city-completion {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}
.city-completion-bar {
    flex: 1;
    height: 6px;
    background: rgba(255,255,255,0.08);
    border-radius: 3px;
    overflow: hidden;
}
.city-completion-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.4s ease;
}
.city-completion-label {
    font-size: 11px;
    color: var(--text-dim);
    font-family: monospace;
    white-space: nowrap;
}

.city-era-count {
    font-size: 11px;
    color: var(--text-dim);
    font-family: monospace;
}

/* Era year tags on city card */
.city-era-years {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 2px;
}
.city-era-year-tag {
    font-size: 11px;
    font-family: monospace;
    padding: 2px 8px;
    border-radius: 4px;
    white-space: nowrap;
    cursor: default;
    transition: opacity 0.2s;
}
.city-era-year-tag:hover { opacity: 0.85; }
.city-era-year-tag.red {
    color: #ef9a9a;
    background: rgba(239, 154, 154, 0.12);
    border: 1px solid rgba(239, 154, 154, 0.25);
}
.city-era-year-tag.blue {
    color: var(--accent);
    background: rgba(124, 131, 255, 0.1);
    border: 1px solid rgba(124, 131, 255, 0.2);
}
.city-era-year-tag.green {
    color: #81c784;
    background: rgba(129, 199, 132, 0.12);
    border: 1px solid rgba(129, 199, 132, 0.25);
}

/* ---- Expanded era list ---- */
.city-eras-expanded {
    padding: 0 16px 16px;
    display: none;
    flex-direction: column;
    gap: 10px;
    border-top: 1px solid var(--border);
    margin-top: 4px;
    padding-top: 14px;
}
.city-card.expanded .city-eras-expanded {
    display: flex;
}

.era-row {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.era-row-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
}

.era-row-thumb-wrap {
    position: relative;
    width: 56px;
    height: 40px;
    flex-shrink: 0;
}

.era-row-thumb {
    width: 56px;
    height: 40px;
    border-radius: 4px;
    background-size: cover;
    background-position: center;
    background-color: #1a1a2e;
}

.era-img-upload-btn {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.55);
    border: none;
    border-radius: 4px;
    color: #fff;
    font-size: 15px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}
.era-row-thumb-wrap:hover .era-img-upload-btn { opacity: 1; }

.era-row-title {
    flex: 1;
    min-width: 0;
}
.era-row-year {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}
.era-row-name {
    font-size: 12px;
    color: var(--text-muted);
}

/* Checklist */
.era-checklist {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 12px 10px 12px;
    border-top: 1px solid rgba(255,255,255,0.05);
}

.checklist-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 4px;
    background: rgba(255,255,255,0.04);
    color: var(--text-muted);
}
.checklist-item.done {
    color: #81c784;
    background: rgba(129, 199, 132, 0.1);
}
.checklist-item-icon {
    font-size: 11px;
    line-height: 1;
}
.checklist-item .notes-tip {
    font-size: 10px;
    color: var(--text-dim);
    font-style: italic;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Era progress bar inside row */
.era-row-progress {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px 8px 12px;
}
.era-row-bar {
    flex: 1;
    height: 4px;
    background: rgba(255,255,255,0.06);
    border-radius: 2px;
    overflow: hidden;
}
.era-row-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
}
.era-row-pct {
    font-size: 10px;
    color: var(--text-dim);
    font-family: monospace;
}

/* ---- Add Era inline (in expanded city) ---- */
.btn-add-era-inline {
    background: rgba(255,255,255,0.04);
    border: 1px dashed var(--border);
    color: var(--text-muted);
    border-radius: 8px;
    width: 100%;
    padding: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
}
.btn-add-era-inline:hover {
    border-color: var(--accent);
    color: var(--text);
}

.add-era-inline-form {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px;
}
.add-era-inline-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 10px;
}

/* ---- Add City button ---- */
.btn-add-city {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
    white-space: nowrap;
}
.btn-add-city:hover { opacity: 0.85; }

/* ---- Wizard Modal ---- */
.cities-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.cities-modal-overlay.open {
    display: flex;
}

.cities-modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    width: 520px;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 60px);
    overflow-y: auto;
    padding: 28px;
    position: relative;
}

.cities-modal-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}
.cities-modal-step-label {
    font-size: 12px;
    color: var(--text-dim);
    margin-bottom: 20px;
    font-family: monospace;
}

.cities-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    line-height: 1;
    padding: 4px 8px;
}
.cities-modal-close:hover { color: var(--text); }

/* Step indicator dots */
.wizard-steps {
    display: flex;
    gap: 6px;
    margin-bottom: 24px;
}
.wizard-step-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border);
    transition: background 0.2s;
}
.wizard-step-dot.active { background: var(--accent); }
.wizard-step-dot.done { background: #81c784; }

/* Wizard step panels */
.wizard-panel { display: none; }
.wizard-panel.active { display: block; }

/* Form fields */
.wizard-field {
    margin-bottom: 14px;
}
.wizard-field label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.wizard-field input,
.wizard-field textarea {
    width: 100%;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 10px;
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}
.wizard-field input:focus,
.wizard-field textarea:focus {
    border-color: var(--accent);
}
.wizard-field .field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.wizard-field textarea { resize: vertical; min-height: 64px; }

/* Era entry in wizard */
.era-entry {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
}
.era-entry-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.era-entry-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}
.btn-remove-era {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 14px;
    padding: 2px 6px;
}
.btn-remove-era:hover { color: #ef9a9a; }

.btn-add-era {
    background: rgba(255,255,255,0.05);
    border: 1px dashed var(--border);
    color: var(--text-muted);
    border-radius: 6px;
    width: 100%;
    padding: 8px;
    font-size: 13px;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
    margin-top: 4px;
}
.btn-add-era:hover { border-color: var(--accent); color: var(--text); }

/* Step 3: checklist per era */
.checklist-era-section {
    margin-bottom: 18px;
}
.checklist-era-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}
.checklist-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}
.checklist-row label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
    cursor: pointer;
    min-width: 110px;
}
.checklist-row input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: var(--accent);
    flex-shrink: 0;
}
.checklist-row .notes-input {
    flex: 1;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 5px 8px;
    color: var(--text);
    font-size: 12px;
    font-family: inherit;
    outline: none;
}
.checklist-row .notes-input:focus { border-color: var(--accent); }

/* Wizard nav buttons */
.wizard-nav {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
    border-top: 1px solid var(--border);
    padding-top: 18px;
}
.btn-wizard {
    background: rgba(255,255,255,0.07);
    border: 1px solid var(--border);
    border-radius: 7px;
    color: var(--text);
    padding: 8px 20px;
    font-size: 13px;
    cursor: pointer;
    transition: border-color 0.2s;
}
.btn-wizard:hover { border-color: var(--accent); }
.btn-wizard.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    font-weight: 600;
}
.btn-wizard.primary:hover { opacity: 0.88; }

/* Empty / loading states */
.cities-loading,
.cities-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-dim);
    font-size: 15px;
}
.cities-empty .icon { font-size: 40px; margin-bottom: 12px; }

/* Status badge */
.city-status-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 7px;
    border-radius: 4px;
    margin-left: 8px;
    vertical-align: middle;
}
.city-status-badge.active { background: rgba(76,175,80,0.2); color: #81c784; }
.city-status-badge.planned { background: rgba(124,131,255,0.15); color: var(--accent); }

/* ---- Crop modal ---- */
.crop-modal {
    width: 700px;
}

.crop-file-area {
    text-align: center;
    padding: 32px 24px;
    border: 1px dashed var(--border);
    border-radius: 8px;
    margin-bottom: 16px;
}

.btn-choose-file {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 7px;
    padding: 9px 22px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
    margin-bottom: 8px;
}
.btn-choose-file:hover { opacity: 0.85; }

.crop-file-hint {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 8px;
}

.crop-container {
    max-height: 60vh;
    overflow: hidden;
    border-radius: 6px;
    background: #000;
    margin-bottom: 16px;
}
.crop-container img {
    display: block;
    max-width: 100%;
}

.crop-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.crop-spinner {
    text-align: center;
    padding: 8px 0;
}

.crop-error {
    font-size: 13px;
    color: #ef9a9a;
    margin-top: 8px;
    min-height: 18px;
}

/* Mobile */
@media (max-width: 640px) {
    #tab-cities { padding: 12px; }
    .cities-grid { grid-template-columns: 1fr; }
    .city-card-thumbs { height: 70px; }
    .era-checklist { gap: 4px; }
    .checklist-row { flex-wrap: wrap; }
    .wizard-field .field-row { grid-template-columns: 1fr; }
    .cities-modal { padding: 18px; }
    .crop-modal { width: 100%; }
}
