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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

.header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.subtitle {
    font-size: 1.1em;
    opacity: 0.9;
}

.control-panel {
    background: white;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: flex-end;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    min-width: 200px;
}

.control-group label {
    font-weight: 600;
    color: #555;
    font-size: 0.9em;
}

.select-input {
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    transition: all 0.3s ease;
    background: white;
}

.select-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.btn-primary, .btn-secondary {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: #f5f5f5;
    color: #666;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.btn-dashboard {
    display: inline-block;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    text-decoration: none;
}

.btn-dashboard:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.4);
    color: white;
}

.btn-danger {
    background: #dc3545;
    color: white;
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.9em;
    margin-top: 5px;
}

.btn-close {
    background: transparent;
    border: none;
    font-size: 2em;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.btn-close:hover {
    background: #f0f0f0;
    color: #333;
}

/* Dashboard Styles */
.dashboard-panel {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    margin-bottom: 20px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 2px solid #e0e0e0;
}

.dashboard-header h2 {
    margin: 0;
    color: #667eea;
}

.dashboard-tabs {
    display: flex;
    border-bottom: 2px solid #e0e0e0;
    padding: 0 10px;
    overflow-x: auto;
}

.tab-btn {
    padding: 15px 25px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    color: #666;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.tab-btn:hover {
    color: #667eea;
    background: #f8f9fa;
}

.tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.dashboard-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px 25px;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.form-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.form-section h3 {
    margin-top: 0;
    color: #667eea;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #555;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group select {
    width: 100%;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 1em;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.coord-inputs {
    display: flex;
    gap: 10px;
}

.coord-inputs input {
    flex: 1;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: normal;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
    cursor: pointer;
}

.help-text {
    font-size: 0.85em;
    color: #666;
    margin-top: 5px;
    font-style: italic;
}

.drawing-hint {
    font-size: 0.9em;
    color: #667eea;
    font-weight: 600;
    margin-top: 8px;
}

.steps-guide {
    background: #e8f0fe;
    border-left: 4px solid #667eea;
}

.steps-list {
    margin: 0;
    padding-left: 1.25rem;
    line-height: 1.6;
}

.steps-list li {
    margin-bottom: 0.5rem;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.list-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
}

.list-section h3 {
    margin-top: 0;
    color: #667eea;
}

.items-list {
    max-height: 400px;
    overflow-y: auto;
}

.item-card {
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    border: 2px solid #e0e0e0;
    transition: all 0.3s ease;
}

.item-card:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.item-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.item-card-title {
    font-weight: 600;
    color: #333;
}

.item-card-actions {
    display: flex;
    gap: 5px;
}

.btn-edit, .btn-delete {
    padding: 5px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85em;
    transition: all 0.3s ease;
}

.btn-edit {
    background: #667eea;
    color: white;
}

.btn-edit:hover {
    background: #5568d3;
}

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

.btn-delete:hover {
    background: #c82333;
}

.item-card-info {
    font-size: 0.9em;
    color: #666;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.item-card-info span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: #999;
}

.empty-state p {
    margin: 0;
    font-size: 1.1em;
}

.map-container {
    position: relative;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    height: 700px;
    margin-bottom: 20px;
}

#map {
    width: 100%;
    height: 100%;
    display: block;
}

.mapboxgl-ctrl-logo,
.mapboxgl-ctrl-attrib {
    display: none !important;
}

.map-overlay {
    position: absolute;
    top: 20px;
    right: 20px;
    left: auto;
    bottom: auto;
    width: auto;
    pointer-events: none;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: flex-end;
}

.map-overlay .info-panel {
    pointer-events: auto;
}

.places-on-floor-panel ul {
    max-height: 180px;
    overflow-y: auto;
}

.info-panel li.muted {
    color: #999;
    font-style: italic;
    list-style: none;
}

.info-panel li.muted:before {
    content: "·";
}

.canvas-overlay {
    position: absolute;
    top: 20px;
    right: 20px;
    pointer-events: none;
}

.info-panel {
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    max-width: 300px;
}

.info-panel h3 {
    margin-bottom: 15px;
    color: #667eea;
}

.info-panel ul {
    list-style: none;
    padding-left: 0;
}

.info-panel li {
    padding: 8px 0;
    padding-left: 25px;
    position: relative;
    color: #666;
    font-size: 0.9em;
}

.info-panel li:before {
    content: "→";
    position: absolute;
    left: 0;
    color: #667eea;
    font-weight: bold;
}

.route-info {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.route-info h3 {
    color: #667eea;
    margin-bottom: 15px;
}

#route-details {
    color: #666;
    line-height: 1.8;
}

.route-step {
    padding: 10px;
    margin: 5px 0;
    background: #f8f9fa;
    border-left: 4px solid #667eea;
    border-radius: 4px;
}

.route-step.floor-change {
    background: #fff3cd;
    border-left-color: #ffc107;
}

.route-step.destination {
    background: #d4edda;
    border-left-color: #28a745;
}

/* Dashboard page (separate) */
.dashboard-page .header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.dashboard-header-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    margin-left: auto;
}

.view-toggler {
    display: flex;
    background: rgba(255,255,255,0.2);
    border-radius: 10px;
    padding: 4px;
    gap: 2px;
}

.view-toggler-btn {
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: rgba(255,255,255,0.9);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.view-toggler-btn:hover {
    background: rgba(255,255,255,0.15);
    color: #fff;
}

.view-toggler-btn.active {
    background: #fff;
    color: #667eea;
}

.dashboard-nav-panel {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 10;
    pointer-events: none;
}

.dashboard-nav-panel[hidden] {
    display: none !important;
}

.dashboard-nav-inner {
    pointer-events: auto;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.dashboard-nav-inner .control-group {
    min-width: 160px;
}

.dashboard-layout[data-dashboard-view="nav"] .dashboard-sidebar {
    display: none;
}

.dashboard-layout[data-dashboard-view="nav"] .dashboard-map-wrap {
    flex: 1;
    width: 100%;
}

.dashboard-layout {
    display: flex;
    gap: 1rem;
    min-height: 70vh;
}

.dashboard-sidebar {
    flex: 0 0 380px;
    max-width: 380px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    padding: 1rem;
    overflow-y: auto;
    max-height: 75vh;
}

.dashboard-sidebar .dashboard-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 1rem;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 8px;
}

.dashboard-sidebar .tab-btn {
    padding: 10px 14px;
    border: none;
    background: #f0f0f0;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    color: #666;
}

.dashboard-sidebar .tab-btn:hover {
    background: #e0e0e0;
    color: #333;
}

.dashboard-sidebar .tab-btn.active {
    background: #667eea;
    color: #fff;
}

.dashboard-sidebar .tab-content {
    display: none;
}

.dashboard-sidebar .tab-content.active {
    display: block;
}

.dashboard-map-wrap {
    flex: 1;
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    min-height: 500px;
}

.dashboard-map {
    width: 100%;
    height: 100%;
    min-height: 500px;
}

.map-draw-hint {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.75);
    color: #fff;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    pointer-events: none;
    z-index: 10;
}

.mapboxgl-ctrl-group {
    margin: 10px !important;
}

@media (max-width: 900px) {
    .dashboard-layout {
        flex-direction: column;
    }
    .dashboard-sidebar {
        flex: 1 1 auto;
        max-width: 100%;
        max-height: none;
    }
    .dashboard-map-wrap {
        min-height: 400px;
    }
}

@media (max-width: 768px) {
    .control-panel {
        flex-direction: column;
    }
    
    .control-group {
        width: 100%;
    }
    
    .header h1 {
        font-size: 2em;
    }
    
    .canvas-container {
        height: 400px;
    }
    
    .info-panel {
        max-width: 100%;
        position: relative;
        top: 0;
        right: 0;
        margin: 10px;
    }
}
