/* Base Styles */
* { box-sizing: border-box; }
body { 
    margin: 0; 
    padding: 0; 
    display: flex; 
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f5f5;
}

#map { flex-grow: 1; height: 100vh; }

#sidebar {
    width: 400px;
    background: #ffffff;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    padding: 20px;
    z-index: 1;
    overflow-y: auto;
    height: 100vh;
}

/* Header */
.header { 
    padding-bottom: 15px; 
    margin-bottom: 20px; 
    border-bottom: 3px solid #fc0;
}
.logo { 
    margin: 0; 
    font-size: 28px; 
    color: #d40511;
}
.logo span { color: #fc0; }
.tagline {
    margin: 5px 0 0 0;
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Search Section */
.search-section {
    margin-bottom: 20px;
}
#search-input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}
#search-input:focus {
    outline: none;
    border-color: #d40511;
}
.filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}
.filter-btn {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 20px;
    background: white;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}
.filter-btn:hover {
    background: #f5f5f5;
}
.filter-btn.active {
    background: #d40511;
    color: white;
    border-color: #d40511;
}

/* Facility List */
#facility-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.loading, .no-results {
    text-align: center;
    color: #999;
    padding: 20px;
}

/* Facility Card */
.facility-card {
    background: #f9f9f9;
    border-radius: 10px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}
.facility-card:hover {
    background: #fff;
    border-color: #d40511;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.facility-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}
.facility-badge {
    padding: 3px 8px;
    border-radius: 4px;
    color: white;
    font-size: 11px;
    font-weight: 600;
}
.facility-type {
    font-size: 11px;
    color: #666;
    text-transform: uppercase;
}
.facility-name {
    margin: 0 0 5px 0;
    font-size: 16px;
    color: #333;
}
.facility-address {
    margin: 0 0 10px 0;
    font-size: 12px;
    color: #666;
}
.facility-stats {
    display: flex;
    gap: 15px;
    font-size: 12px;
    color: #888;
}

/* Details Panel */
#facility-details.hidden, #facility-list.hidden {
    display: none;
}
.back-btn {
    background: none;
    border: none;
    color: #d40511;
    font-size: 14px;
    cursor: pointer;
    padding: 0;
    margin-bottom: 15px;
}
.back-btn:hover {
    text-decoration: underline;
}

/* Detail Header */
.detail-header {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}
.detail-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    color: white;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 8px;
}
.detail-header h2 {
    margin: 0 0 5px 0;
    color: #333;
    font-size: 20px;
}
.detail-type {
    margin: 0 0 8px 0;
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
}
.detail-address {
    margin: 0;
    font-size: 13px;
    color: #555;
}

/* Detail Sections */
.detail-section {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}
.detail-section:last-child {
    border-bottom: none;
}
.detail-section h3 {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: #333;
}

/* Collapsible Sections */
.detail-section.collapsible {
    margin-bottom: 10px;
    padding-bottom: 10px;
}
.section-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 10px 12px;
    margin: 0 -15px 0 -15px;
    background: #f5f5f5;
    border-radius: 8px;
    transition: background 0.2s;
}
.section-toggle:hover {
    background: #eee;
}
.section-toggle.expanded {
    background: #e8e8e8;
    border-radius: 8px 8px 0 0;
}
.toggle-icon {
    font-size: 12px;
    color: #666;
    transition: transform 0.2s;
}
.section-content {
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    max-height: 1000px;
    padding-top: 12px;
}
.section-content.collapsed {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
}

/* Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.info-item {
    background: #f5f5f5;
    padding: 10px;
    border-radius: 6px;
}
.info-label {
    display: block;
    font-size: 11px;
    color: #666;
    margin-bottom: 4px;
}
.info-value {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

/* Contacts Grid */
.contacts-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}
.contact-card {
    background: #f9f9f9;
    padding: 12px;
    border-radius: 8px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}
.contact-icon {
    font-size: 28px;
    flex-shrink: 0;
}
.contact-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    flex: 1;
}
.contact-role {
    font-size: 10px;
    color: #999;
    text-transform: uppercase;
}
.contact-name {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}
.contact-email, .contact-phone {
    font-size: 12px;
    color: #d40511;
    text-decoration: none;
    word-break: break-all;
    display: block;
}
.contact-email:hover, .contact-phone:hover {
    text-decoration: underline;
}

/* Equipment List */
.equipment-list {
    margin: 0;
    padding-left: 20px;
}
.equipment-list li {
    font-size: 13px;
    color: #555;
    margin-bottom: 5px;
}

/* Emergency Buttons */
.section-hint {
    font-size: 12px;
    color: #666;
    margin: 0 0 10px 0;
}
.emergency-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}
.emergency-btn {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}
.emergency-btn:hover {
    background: #fff3f3;
    border-color: #d40511;
}
.emergency-btn.active {
    background: #d40511;
    color: white;
    border-color: #d40511;
}

/* Procedure Steps */
.procedure-steps {
    background: #fff8f5;
    border-left: 4px solid #e74c3c;
    padding: 15px;
    border-radius: 0 8px 8px 0;
}
.procedure-steps.hidden {
    display: none;
}
.procedure-steps h4 {
    margin: 0 0 10px 0;
    color: #e74c3c;
    font-size: 14px;
}
.steps-list {
    margin: 0;
    padding-left: 20px;
}
.steps-list li {
    font-size: 13px;
    color: #555;
    margin-bottom: 8px;
    line-height: 1.4;
}

/* Floor Plan Button */
.floor-plan-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}
.floor-plan-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

/* 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;
}
.modal-content {
    background: white;
    border-radius: 12px;
    padding: 25px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}
.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
}
.modal-close:hover {
    color: #333;
}
.modal-content h2 {
    margin: 0 0 20px 0;
    color: #333;
}

/* Floor Plan Placeholder */
.floor-plan-container {
    background: #f5f5f5;
    border-radius: 8px;
    padding: 20px;
}
.floor-plan-placeholder {
    text-align: center;
}
.floor-plan-placeholder p {
    margin: 0 0 10px 0;
    color: #666;
}
.placeholder-text {
    font-size: 14px;
    color: #999;
}
.placeholder-hint {
    font-size: 12px;
    color: #aaa;
    font-style: italic;
}

/* Sample Floor Plan */
.sample-floor-plan {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 80px);
    gap: 8px;
    margin: 20px 0;
    padding: 15px;
    background: white;
    border-radius: 8px;
    border: 2px dashed #ddd;
}
.fp-zone {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    color: white;
}
.fp-office { background: #3498db; }
.fp-warehouse { background: #2ecc71; grid-column: span 2; }
.fp-dock { background: #e67e22; }
.fp-utility { background: #9b59b6; }
.fp-it { background: #e74c3c; }

/* Navigation Tabs */
.nav-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 20px;
    background: #f5f5f5;
    padding: 5px;
    border-radius: 10px;
}
.nav-tab {
    flex: 1;
    padding: 10px 8px;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    color: #666;
}
.nav-tab:hover {
    background: #e0e0e0;
}
.nav-tab.active {
    background: #d40511;
    color: white;
}

/* Tab Content */
.tab-content {
    display: none;
}
.tab-content.active {
    display: block;
}
.tab-title {
    margin: 0 0 10px 0;
    font-size: 20px;
    color: #333;
}
.tab-description {
    margin: 0 0 20px 0;
    font-size: 13px;
    color: #666;
}

/* Resource Cards */
.resource-card {
    display: flex;
    gap: 15px;
    background: #f9f9f9;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 15px;
    border-left: 4px solid #ddd;
    transition: all 0.2s;
}
.resource-card:hover {
    background: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.resource-card.rem { border-left-color: #3498db; }
.resource-card.it { border-left-color: #9b59b6; }
.resource-card.security { border-left-color: #e74c3c; }
.resource-card.risk { border-left-color: #f39c12; }

/* Equipment Inventory & Maintenance Calendar */
.resource-section {
    margin-top: 30px;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.section-title {
    font-size: 18px;
    color: #333;
    margin: 0 0 5px 0;
}

.section-desc {
    color: #666;
    font-size: 13px;
    margin: 0 0 20px 0;
}

.inventory-summary {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.inventory-stat {
    flex: 1;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
}

.inventory-stat.operational {
    background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
}

.inventory-stat.maintenance {
    background: linear-gradient(135deg, #fff8e1, #ffecb3);
}

.inventory-stat.fault {
    background: linear-gradient(135deg, #ffebee, #ffcdd2);
}

.inv-number {
    display: block;
    font-size: 28px;
    font-weight: bold;
    color: #333;
}

.inv-label {
    font-size: 12px;
    color: #666;
}

.inventory-table-container {
    max-height: 300px;
    overflow-y: auto;
    border-radius: 8px;
    border: 1px solid #eee;
}

.inventory-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}

.inventory-table th {
    background: #f5f5f5;
    padding: 6px 8px;
    text-align: left;
    font-weight: 600;
    color: #555;
    position: sticky;
    top: 0;
    font-size: 10px;
}

.inventory-table td {
    padding: 6px 8px;
    border-bottom: 1px solid #eee;
}

.inventory-table tr:hover {
    background: #fafafa;
}

.status-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 9px;
    font-weight: 500;
    text-transform: uppercase;
}

.status-pill.operational {
    background: #c8e6c9;
    color: #2e7d32;
}

.status-pill.maintenance {
    background: #ffecb3;
    color: #f57c00;
}

.status-pill.fault {
    background: #ffcdd2;
    color: #c62828;
}

.view-3d-btn {
    padding: 3px 8px;
    background: #d40511;
    color: white;
    font-size: 10px;
    border: none;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
}

.view-3d-btn:hover {
    background: #b30410;
}

/* Maintenance Calendar */
.calendar-container {
    background: #fafafa;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.calendar-header span {
    font-weight: 600;
    font-size: 16px;
}

.cal-nav {
    background: white;
    border: 1px solid #ddd;
    padding: 5px 12px;
    border-radius: 5px;
    cursor: pointer;
}

.cal-nav:hover {
    background: #f0f0f0;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
    margin-bottom: 5px;
}

.cal-day-header {
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    color: #999;
    padding: 5px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
}

.cal-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    position: relative;
}

.cal-day:hover {
    background: #f0f0f0;
}

.cal-day.today {
    background: #d40511;
    color: white;
    font-weight: bold;
}

.cal-day.has-event::after {
    content: '';
    position: absolute;
    bottom: 4px;
    width: 6px;
    height: 6px;
    background: #ff6600;
    border-radius: 50%;
}

.cal-day.other-month {
    color: #ccc;
}

.upcoming-maintenance h3 {
    font-size: 15px;
    margin: 0 0 15px 0;
    color: #333;
}

.maintenance-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: white;
    border-radius: 8px;
    margin-bottom: 10px;
    border-left: 4px solid #ff6600;
}

.maint-date {
    text-align: center;
    min-width: 50px;
}

.maint-day {
    display: block;
    font-size: 20px;
    font-weight: bold;
    color: #d40511;
}

.maint-month {
    font-size: 11px;
    color: #999;
}

.maint-details h4 {
    margin: 0 0 5px 0;
    font-size: 14px;
}

.maint-details p {
    margin: 0;
    font-size: 12px;
    color: #666;
}

.maint-type {
    display: inline-block;
    padding: 2px 8px;
    background: #fff3e0;
    color: #e65100;
    border-radius: 4px;
    font-size: 10px;
    margin-top: 5px;
}

.resource-icon {
    font-size: 32px;
    flex-shrink: 0;
}
.resource-content h3 {
    margin: 0 0 8px 0;
    font-size: 16px;
    color: #333;
}
.resource-content p {
    margin: 0 0 12px 0;
    font-size: 13px;
    color: #666;
}
.resource-links {
    list-style: none;
    margin: 0;
    padding: 0;
}
.resource-links li {
    margin-bottom: 6px;
}
.resource-links a {
    font-size: 13px;
    color: #d40511;
    text-decoration: none;
}
.resource-links a:hover {
    text-decoration: underline;
}

/* Dashboard Stats */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 25px;
}
.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px 15px;
    border-radius: 12px;
    text-align: center;
    color: white;
}
.stat-number {
    display: block;
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 5px;
}
.stat-label {
    font-size: 11px;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Dashboard Sections */
.dashboard-section {
    margin-bottom: 25px;
}
.dashboard-section h3 {
    margin: 0 0 15px 0;
    font-size: 14px;
    color: #333;
}

/* Type Chart */
.type-chart {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.chart-bar {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.chart-label {
    font-size: 12px;
    color: #666;
}
.chart-bar-container {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f0f0f0;
    border-radius: 4px;
    overflow: hidden;
}
.chart-bar-fill {
    height: 24px;
    border-radius: 4px;
    transition: width 0.5s ease;
}
.chart-value {
    font-size: 12px;
    font-weight: 600;
    color: #333;
    padding-right: 10px;
}

/* Top Facilities */
.top-facilities {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.top-facility-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #f9f9f9;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}
.top-facility-item:hover {
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.top-rank {
    font-size: 16px;
    font-weight: 700;
    color: #d40511;
    width: 30px;
}
.top-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}
.top-name {
    font-size: 13px;
    font-weight: 600;
    color: #333;
}
.top-size {
    font-size: 11px;
    color: #666;
}
.top-badge {
    padding: 4px 8px;
    border-radius: 4px;
    color: white;
    font-size: 10px;
    text-transform: uppercase;
}

/* Coverage Info */
.coverage-info {
    background: #f0f8ff;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #3498db;
}
.coverage-info p {
    margin: 0 0 5px 0;
    font-size: 13px;
    color: #555;
}
.coverage-info p:last-child {
    margin-bottom: 0;
}

/* Geocoder (Address Search) */
.geocoder-container {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 10;
}
.geocoder-container .mapboxgl-ctrl-geocoder {
    min-width: 300px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    border-radius: 8px;
}
.geocoder-container .mapboxgl-ctrl-geocoder input {
    font-size: 14px;
}

/* Scrollbar */
#sidebar::-webkit-scrollbar {
    width: 6px;
}
#sidebar::-webkit-scrollbar-track {
    background: #f1f1f1;
}
#sidebar::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}
#sidebar::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* =============================================
   DATA IMPORT TAB STYLES
   ============================================= */

.upload-section {
    margin-bottom: 25px;
}

.upload-hint {
    font-size: 13px;
    color: #666;
    margin-bottom: 15px;
}

.upload-area {
    border: 2px dashed #ddd;
    border-radius: 12px;
    padding: 30px;
    text-align: center;
    background: #fafafa;
    transition: all 0.3s;
    cursor: pointer;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: #d40511;
    background: #fff5f5;
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.upload-area p {
    margin: 5px 0;
    color: #666;
    font-size: 14px;
}

.upload-or {
    color: #999;
    font-size: 12px;
}

.upload-btn {
    display: inline-block;
    background: #d40511;
    color: white;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    margin-top: 10px;
    transition: background 0.2s;
}

.upload-btn:hover {
    background: #b30410;
}

.upload-status {
    margin-top: 15px;
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
}

.upload-status.info {
    background: #e3f2fd;
    color: #1565c0;
    border: 1px solid #90caf9;
}

.upload-status.success {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

.upload-status.error {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ef9a9a;
}

/* Template Section */
.template-section {
    background: #f5f5f5;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 25px;
}

.template-section h3 {
    margin: 0 0 10px 0;
    font-size: 15px;
}

.template-section p {
    font-size: 13px;
    color: #666;
    margin-bottom: 15px;
}

.template-columns {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}

.template-columns .col {
    background: #fff;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-family: monospace;
    border: 1px solid #ddd;
}

.template-columns .col.required {
    background: #fff3e0;
    border-color: #ffb74d;
    color: #e65100;
}

.download-template-btn {
    background: #2196f3;
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
}

.download-template-btn:hover {
    background: #1976d2;
}

/* Import History / Data Summary */
.import-history h3 {
    margin: 0 0 15px 0;
    font-size: 15px;
}

.data-stats {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.data-stat {
    flex: 1;
    background: linear-gradient(135deg, #d40511 0%, #ff6b6b 100%);
    color: white;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
}

.data-stat-value {
    display: block;
    font-size: 28px;
    font-weight: bold;
}

.data-stat-label {
    font-size: 12px;
    opacity: 0.9;
}

.type-breakdown {
    background: #f9f9f9;
    border-radius: 8px;
    overflow: hidden;
}

.type-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
    font-size: 13px;
}

.type-row:last-child {
    border-bottom: none;
}

.type-name {
    color: #555;
}

.type-count {
    font-weight: 600;
    color: #d40511;
}

/* =============================================
   EXPORT SECTION STYLES
   ============================================= */

.export-section {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.export-section h3 {
    margin: 0 0 10px 0;
    font-size: 15px;
}

.export-section p {
    font-size: 13px;
    color: #666;
    margin-bottom: 15px;
}

.export-buttons {
    display: flex;
    gap: 10px;
}

.export-btn {
    flex: 1;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
    background: #27ae60;
    color: white;
}

.export-btn:hover {
    background: #219a52;
    transform: translateY(-1px);
}

.export-btn.secondary {
    background: #3498db;
}

.export-btn.secondary:hover {
    background: #2980b9;
}

/* =============================================
   TICKET SYSTEM STYLES
   ============================================= */

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

.ticket-form-section h3 {
    margin: 0 0 15px 0;
    font-size: 15px;
}

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

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

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #d40511;
}

.submit-ticket-btn {
    width: 100%;
    padding: 12px;
    background: #d40511;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.submit-ticket-btn:hover {
    background: #b30410;
}

/* Ticket List */
.ticket-list-section h3 {
    margin: 0 0 15px 0;
    font-size: 15px;
}

.ticket-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
}

.ticket-filter {
    padding: 6px 12px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.ticket-filter:hover {
    border-color: #d40511;
}

.ticket-filter.active {
    background: #d40511;
    color: white;
    border-color: #d40511;
}

.no-tickets {
    text-align: center;
    color: #999;
    padding: 30px;
    font-size: 14px;
}

.ticket-card {
    background: white;
    border: 1px solid #eee;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 12px;
    border-left: 4px solid #999;
}

.ticket-card.low { border-left-color: #27ae60; }
.ticket-card.medium { border-left-color: #f39c12; }
.ticket-card.high { border-left-color: #e74c3c; }
.ticket-card.urgent { border-left-color: #8e44ad; }

.ticket-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.ticket-id {
    font-size: 12px;
    font-weight: 600;
    color: #666;
}

.ticket-status {
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    font-weight: 600;
}

.ticket-status.open { background: #e3f2fd; color: #1565c0; }
.ticket-status.in_progress { background: #fff3e0; color: #e65100; }
.ticket-status.resolved { background: #e8f5e9; color: #2e7d32; }

.ticket-title {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #333;
}

.ticket-meta {
    display: flex;
    gap: 12px;
    font-size: 11px;
    color: #666;
    margin-bottom: 10px;
}

.facility-link {
    cursor: pointer;
    color: #d40511;
    transition: all 0.2s;
}

.facility-link:hover {
    text-decoration: underline;
    color: #ff6600;
}

.priority-badge {
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
}

.priority-badge.low { background: #e8f5e9; color: #2e7d32; }
.priority-badge.medium { background: #fff3e0; color: #e65100; }
.priority-badge.high { background: #ffebee; color: #c62828; }
.priority-badge.urgent { background: #f3e5f5; color: #6a1b9a; }

.ticket-desc {
    font-size: 13px;
    color: #666;
    margin: 0 0 10px 0;
}

.ticket-actions {
    display: flex;
    gap: 8px;
}

.ticket-actions button {
    padding: 6px 12px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 5px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.ticket-actions button:hover {
    background: #d40511;
    color: white;
    border-color: #d40511;
}

.ticket-actions .delete-btn {
    background: #fff5f5;
    border-color: #ffcccc;
    color: #cc0000;
}

.ticket-actions .delete-btn:hover {
    background: #cc0000;
    color: white;
    border-color: #cc0000;
}

/* =============================================
   LOGIN / AUTHENTICATION STYLES
   ============================================= */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.modal-overlay.active {
    display: flex;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 16px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

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

.login-header h1 {
    font-size: 28px;
    margin: 0 0 5px 0;
    color: #333;
}

.login-header h1 span {
    color: #d40511;
}

.login-header p {
    color: #666;
    margin: 0;
    font-size: 14px;
}

.login-box .form-group {
    margin-bottom: 20px;
}

.login-box .form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin-bottom: 6px;
}

.login-box .form-group input,
.login-box .form-group select {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #eee;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.login-box .form-group input:focus,
.login-box .form-group select:focus {
    outline: none;
    border-color: #d40511;
}

.login-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #d40511 0%, #ff6b6b 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(212, 5, 17, 0.3);
}

.demo-hint {
    text-align: center;
    font-size: 12px;
    color: #999;
    margin-top: 20px;
}

/* Login Prompt in Header */
.login-prompt {
    margin-top: 10px;
}

.signin-btn {
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, #d40511 0%, #ff6b6b 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.signin-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(212, 5, 17, 0.3);
}

/* User Info in Header */
.user-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f5f5f5;
    padding: 8px 12px;
    border-radius: 6px;
    margin-top: 10px;
}

.user-info #user-name {
    font-size: 13px;
    font-weight: 600;
    color: #333;
}

.logout-btn {
    padding: 4px 10px;
    background: transparent;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    color: #666;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: #d40511;
    color: white;
    border-color: #d40511;
}

/* =============================================
   3D BIM / FLOOR PLAN STYLES
   ============================================= */

.modal-3d {
    width: 90%;
    max-width: 900px;
    height: 70vh;
    max-height: 600px;
    display: flex;
    flex-direction: column;
}

.modal-3d h2 {
    margin: 0 0 15px 0;
    font-size: 18px;
}

.bim-toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    align-items: center;
}

.bim-btn {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.bim-btn:hover {
    border-color: #d40511;
}

.bim-btn.active {
    background: #d40511;
    color: white;
    border-color: #d40511;
}

.bim-hint {
    margin-left: auto;
    font-size: 12px;
    color: #999;
}

.bim-viewer-wrapper {
    flex: 1;
    position: relative;
    min-height: 350px;
}

.threejs-container {
    width: 100%;
    height: 100%;
    background: #f5f5f5;
    border-radius: 10px;
    overflow: hidden;
}

.equipment-legend {
    position: absolute;
    bottom: 10px;
    left: 10px;
    display: flex;
    gap: 12px;
    padding: 8px 12px;
    background: rgba(255,255,255,0.95);
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: #555;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.status-dot.green { background: #27ae60; }
.status-dot.yellow { background: #f1c40f; }
.status-dot.red { background: #e74c3c; }

.equipment-info {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 240px;
    padding: 10px;
    background: transparent;
    border: none;
    font-size: 12px;
}

.equipment-info h4 {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: #333;
    font-weight: 700;
    text-shadow: 1px 1px 2px rgba(255,255,255,0.8);
}

.equipment-info p {
    margin: 4px 0;
    font-size: 12px;
    color: #333;
    text-shadow: 1px 1px 2px rgba(255,255,255,0.8);
}

.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.green { background: #e8f5e9; color: #2e7d32; }
.status-badge.yellow { background: #fff3e0; color: #e65100; }
.status-badge.red { background: #ffebee; color: #c62828; }

.report-btn {
    margin-top: 10px;
    padding: 8px 16px;
    background: #d40511;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}

.report-btn:hover {
    background: #b30410;
}

.view-ticket-btn {
    margin-top: 10px;
    padding: 8px 16px;
    background: #ff6600;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}

.view-ticket-btn:hover {
    background: #e55a00;
}

/* =============================================
   DARK MODE
   ============================================= */
.theme-btn {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 6px;
    transition: background 0.2s;
    margin-left: auto;
}
.theme-btn:hover { background: rgba(0,0,0,0.1); }

body.dark-mode #sidebar {
    background: #1a1a2e;
    color: #e0e0e0;
}
body.dark-mode .header { border-bottom-color: #fc0; }
body.dark-mode .logo { color: #ff4444; }
body.dark-mode .tagline { color: #999; }
body.dark-mode .nav-tabs { background: #16213e; }
body.dark-mode .nav-tab { color: #aaa; }
body.dark-mode .nav-tab:hover { background: #0f3460; }
body.dark-mode .nav-tab.active { background: #d40511; color: white; }
body.dark-mode #search-input {
    background: #16213e;
    border-color: #333;
    color: #e0e0e0;
}
body.dark-mode #ticket-search {
    background: #16213e;
    border-color: #333;
    color: #e0e0e0;
}
body.dark-mode .filter-btn {
    background: #16213e;
    color: #ccc;
    border-color: #333;
}
body.dark-mode .filter-btn.active { background: #d40511; color: white; }
body.dark-mode .facility-card {
    background: #16213e;
    border-color: #333;
    color: #e0e0e0;
}
body.dark-mode .facility-card:hover { background: #0f3460; }
body.dark-mode .ticket-card {
    background: #16213e;
    border-color: #333;
    color: #e0e0e0;
}
body.dark-mode .stat-card {
    background: linear-gradient(135deg, #16213e, #0f3460);
    color: #e0e0e0;
}
body.dark-mode .dashboard-section { border-color: #333; }
body.dark-mode .dashboard-section h3 { color: #e0e0e0; }
body.dark-mode .resource-card {
    background: #16213e;
    color: #e0e0e0;
}
body.dark-mode .tab-title { color: #e0e0e0; }
body.dark-mode .tab-description { color: #999; }
body.dark-mode .login-box { background: #1a1a2e; color: #e0e0e0; }
body.dark-mode .login-box label { color: #ccc; }
body.dark-mode .login-box input,
body.dark-mode .login-box select {
    background: #16213e;
    border-color: #444;
    color: #e0e0e0;
}
body.dark-mode .top-facility-item {
    background: #16213e;
    color: #e0e0e0;
}
body.dark-mode .ticket-filters .ticket-filter {
    background: #16213e;
    color: #ccc;
    border-color: #333;
}
body.dark-mode .upload-section {
    background: #16213e;
    border-color: #444;
    color: #e0e0e0;
}

/* =============================================
   MOBILE RESPONSIVE (≤768px)
   ============================================= */
@media (max-width: 768px) {
    body {
        flex-direction: column;
    }

    #sidebar {
        width: 100%;
        height: 55vh;
        overflow-y: auto;
        padding: 12px;
        order: 2;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    }

    #map {
        height: 45vh;
        order: 1;
        flex-grow: 0;
    }

    .logo { font-size: 20px; }
    .tagline { font-size: 10px; }

    .header {
        padding-bottom: 8px;
        margin-bottom: 10px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 6px;
    }

    /* Nav tabs: smaller and scrollable */
    .nav-tabs {
        gap: 3px;
        padding: 3px;
        margin-bottom: 10px;
        overflow-x: auto;
        flex-wrap: nowrap;
    }
    .nav-tab {
        padding: 7px 5px;
        font-size: 10px;
        white-space: nowrap;
        flex: 0 0 auto;
    }

    /* Filter buttons: horizontal scroll */
    .filter-buttons {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 4px;
        gap: 5px;
    }
    .filter-btn {
        white-space: nowrap;
        flex: 0 0 auto;
        padding: 5px 10px;
        font-size: 11px;
    }

    /* Dashboard stats: 2 columns */
    .dashboard-stats {
        grid-template-columns: 1fr 1fr;
    }

    /* Facility cards: compact */
    .facility-card { padding: 10px; }
    .facility-stats { flex-wrap: wrap; gap: 6px; }

    /* Ticket cards */
    .ticket-card { padding: 10px; }
    .ticket-actions { flex-wrap: wrap; gap: 6px; }
    .ticket-actions button { flex: 1; font-size: 12px; }

    /* Login box */
    .login-box { width: 90vw; padding: 20px; }

    /* Tab titles */
    .tab-title { font-size: 16px; }
    .tab-description { font-size: 11px; margin-bottom: 10px; }
}

/* Small phones (≤480px) */
@media (max-width: 480px) {
    #sidebar { height: 60vh; }
    #map { height: 40vh; }
    .nav-tab { font-size: 9px; padding: 6px 4px; }
}
