/* BeoTracker Custom Styles */

:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
}

/* Global Styles */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
}

main {
    min-height: calc(100vh - 200px);
}

/* Navigation */
.navbar-brand {
    font-weight: 600;
    font-size: 1.5rem;
}

/* Cards */
.card {
    border-radius: 10px;
    border: none;
}

.card-header {
    border-radius: 10px 10px 0 0 !important;
    font-weight: 600;
}

/* Map Styles */
#map {
    border-radius: 0 0 10px 10px;
    z-index: 1;
}

.leaflet-popup-content-wrapper {
    border-radius: 8px;
}

.leaflet-popup-content {
    margin: 15px;
    font-size: 14px;
}

.leaflet-popup-content h6 {
    margin-bottom: 10px;
    color: var(--primary-color);
    font-weight: 600;
}

.leaflet-popup-content table {
    width: 100%;
    font-size: 13px;
}

.leaflet-popup-content table td {
    padding: 4px 8px;
}

.leaflet-popup-content table td:first-child {
    font-weight: 600;
    width: 40%;
}

/* Device List */
#device-list .list-group-item {
    border-left: 4px solid transparent;
    transition: all 0.3s ease;
    cursor: pointer;
}

#device-list .list-group-item:hover {
    background-color: #f8f9fa;
}

#device-list .list-group-item.active {
    background-color: #e7f3ff;
    border-left-color: var(--primary-color);
}

#device-list .form-check-input {
    cursor: pointer;
    width: 1.2em;
    height: 1.2em;
}

.device-color-indicator {
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    margin-right: 10px;
    border: 2px solid #fff;
    box-shadow: 0 0 3px rgba(0,0,0,0.3);
}

.device-name {
    font-weight: 500;
}

.device-status {
    font-size: 0.85em;
    color: #6c757d;
}

.device-status.online {
    color: var(--success-color);
}

.device-status.offline {
    color: var(--danger-color);
}

/* Legend */
#legend-container {
    max-height: 300px;
    overflow-y: auto;
}

.legend-item {
    display: flex;
    align-items: center;
    padding: 5px 0;
    font-size: 14px;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    margin-right: 10px;
    border: 2px solid #fff;
    box-shadow: 0 0 3px rgba(0,0,0,0.3);
}

.legend-name {
    flex: 1;
    font-weight: 500;
}

.legend-points {
    color: #6c757d;
    font-size: 0.9em;
}

.legend-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-size: 0.85em;
    line-height: 1.3;
}

/* Stats Cards */
.card-body h3 {
    font-weight: 700;
    font-size: 2rem;
}

/* Tables */
.table {
    font-size: 0.95rem;
}

.table thead th {
    font-weight: 600;
    border-bottom: 2px solid #dee2e6;
    white-space: nowrap;
}

.table tbody tr {
    transition: background-color 0.2s ease;
}

.table tbody tr:hover {
    background-color: #f8f9fa;
}

/* Badges */
.badge {
    padding: 0.5em 0.8em;
    font-weight: 500;
}

/* Buttons */
.btn {
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.btn-sm {
    padding: 0.25rem 0.6rem;
}

/* Modals */
.modal-header {
    border-bottom: 2px solid #dee2e6;
}

.modal-footer {
    border-top: 2px solid #dee2e6;
}

/* Form Controls */
.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Loading Spinner */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

/* Alerts */
.alert {
    border-radius: 8px;
    border: none;
}

/* Footer */
footer {
    margin-top: auto;
    border-top: 1px solid #dee2e6;
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .navbar-brand {
        font-size: 1.2rem;
    }

    #map {
        height: 50vh !important;
        min-height: 400px !important;
    }

    .card-body h3 {
        font-size: 1.5rem;
    }

    .table {
        font-size: 0.85rem;
    }

    .btn {
        font-size: 0.9rem;
    }
}

@media (max-width: 576px) {
    .container-fluid {
        padding-left: 10px;
        padding-right: 10px;
    }

    #map {
        height: 40vh !important;
        min-height: 300px !important;
    }

    .card-header h5 {
        font-size: 1rem;
    }
}

/* Accessibility */
.btn:focus,
.form-control:focus,
.form-select:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .navbar,
    .btn,
    footer,
    .modal {
        display: none !important;
    }

    #map {
        page-break-inside: avoid;
    }
}

/* Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Status Indicators */
.status-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 5px;
}

.status-dot.online {
    background-color: var(--success-color);
    box-shadow: 0 0 5px var(--success-color);
}

.status-dot.offline {
    background-color: var(--secondary-color);
}

/* Device Selector Improvements */
.device-item {
    display: flex;
    align-items: center;
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 5px;
    transition: all 0.2s ease;
}

.device-item:hover {
    background-color: #f0f0f0;
}

.device-item.selected {
    background-color: #e3f2fd;
}

/* Map Controls */
.map-control-btn {
    background: white;
    border: 2px solid rgba(0,0,0,0.2);
    border-radius: 4px;
    padding: 5px 10px;
    cursor: pointer;
    box-shadow: 0 1px 5px rgba(0,0,0,0.15);
}

.map-control-btn:hover {
    background: #f4f4f4;
}

/* Popup Improvements */
.popup-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--info-color) 100%);
    color: white;
    padding: 10px;
    margin: -15px -15px 10px -15px;
    border-radius: 8px 8px 0 0;
}

.popup-data-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px solid #eee;
}

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

.popup-label {
    font-weight: 600;
    color: #555;
}

.popup-value {
    color: #333;
}
