/**
 * Main Stylesheet - OVERLAY VERSION
 * Full-screen map with overlaying sidebars
 */

/* ==================== GLOBAL STYLES ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #2c3e50;
    min-height: 100vh;
    overflow: hidden;
}

/* ==================== LOGIN CONTAINER ==================== */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-box {
    background: white;
    border-radius: 15px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.3);
}

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

.login-header h1 {
    color: #2c3e50;
    font-size: 28px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.header-icon {
    color: #667eea;
}

.login-subtitle {
    color: #7f8c8d;
    font-size: 14px;
}

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

.login-form label {
    display: block;
    margin-bottom: 8px;
    color: #2c3e50;
    font-weight: 600;
    font-size: 14px;
}

.login-form input {
    width: 100%;
    padding: 12px;
    border: 2px solid #ecf0f1;
    border-radius: 8px;
    font-size: 14px;
    transition: border 0.3s;
}

.login-form input:focus {
    outline: none;
    border-color: #667eea;
}

.login-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

.login-btn:hover {
    transform: translateY(-2px);
}

.error-message {
    display: none;
    margin-top: 15px;
    padding: 12px;
    background: #fee;
    border: 1px solid #fcc;
    border-radius: 6px;
    color: #c33;
    font-size: 13px;
}

/* ==================== DASHBOARD ==================== */
.dashboard {
    display: none;
    height: 100vh;
    flex-direction: column;
    overflow: hidden;
}

/* ==================== MAIN HEADER ==================== */
.main-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    z-index: 1100;
    position: relative;
}

.main-header h1 {
    font-size: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logout-btn {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.logout-btn:hover {
    background: rgba(255,255,255,0.3);
}

/* ==================== DASHBOARD CONTAINER ==================== */
.dashboard-container {
    position: relative;
    flex: 1;
    overflow: hidden;
}

/* ==================== MAP CONTAINER (FULL SCREEN) ==================== */
.map-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
}

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

/* ==================== LEFT SIDEBAR (OVERLAY) ==================== */
.left-sidebar {
    position: absolute;
    top: 0;
    left: 0;
    width: 320px;
    height: 100%;
    background: white;
    box-shadow: 2px 0 15px rgba(0,0,0,0.3);
    z-index: 1050;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease-in-out;
}

.left-sidebar.collapsed {
    transform: translateX(-320px);
}

.left-sidebar > h2 {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    margin: 0;
    font-size: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.left-sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.left-sidebar h3 {
    color: #34495e;
    font-size: 14px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ==================== RIGHT SIDEBAR (OVERLAY) ==================== */
.right-sidebar {
    position: absolute;
    top: 0;
    right: 0;
    width: 350px;
    height: 100%;
    background: white;
    box-shadow: -2px 0 15px rgba(0,0,0,0.3);
    z-index: 1050;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease-in-out;
}

.right-sidebar.collapsed {
    transform: translateX(350px);
}

.dashboard-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    flex-shrink: 0;
}

.dashboard-header h2 {
    font-size: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

/* ==================== SIDEBAR TOGGLE BUTTONS ==================== */
.sidebar-toggle {
    position: absolute;
    top: 20px;
    width: 30px;
    height: 50px;
    background: rgba(255,255,255,0.95);
    border: 1px solid #ddd;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1060;
    transition: all 0.3s ease-in-out;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.sidebar-toggle:hover {
    background: white;
    box-shadow: 0 3px 12px rgba(0,0,0,0.3);
}

.left-toggle {
    left: 320px;
    border-radius: 0 8px 8px 0;
    border-left: none;
}

.right-toggle {
    right: 350px;
    border-radius: 8px 0 0 8px;
    border-right: none;
}

/* Move toggles when sidebars collapse */
.left-sidebar.collapsed ~ .left-toggle {
    left: 0;
}

.right-sidebar.collapsed ~ .right-toggle {
    right: 0;
}

/* ==================== STATUS SECTION ==================== */
.status-section {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #95a5a6;
}

.status-dot.online {
    background: #27ae60;
    box-shadow: 0 0 10px #27ae60;
}

.status-dot.fetching {
    background: #f39c12;
    animation: pulse 1.5s infinite;
}

.status-dot.error {
    background: #e74c3c;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.last-update {
    font-size: 12px;
    color: #7f8c8d;
}

/* ==================== CONTROL SECTIONS ==================== */
.control-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #ecf0f1;
}

.control-section:last-child {
    border-bottom: none;
}

.control-row {
    margin-bottom: 12px;
}

.control-row label {
    display: block;
    font-size: 13px;
    color: #7f8c8d;
    margin-bottom: 6px;
}

.control-row select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    background: white;
}

.control-row button {
    width: 100%;
}

/* ==================== BUTTONS ==================== */
button {
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

button.primary {
    background: linear-gradient(45deg, #3498db, #2980b9);
    color: white;
}

button.primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(52,152,219,0.3);
}

button.success {
    background: linear-gradient(45deg, #27ae60, #229954);
    color: white;
}

button.success:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(39,174,96,0.3);
}

button.warning {
    background: linear-gradient(45deg, #f39c12, #e67e22);
    color: white;
}

button.warning:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(243,156,18,0.3);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ==================== DISTANCE TOOL ==================== */
.tool-instructions {
    display: none;
    padding: 12px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 6px;
    font-size: 12px;
    color: #856404;
    margin-top: 10px;
}

.distance-display {
    display: none;
    padding: 15px;
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 6px;
    margin-top: 10px;
}

.distance-value {
    font-size: 24px;
    font-weight: bold;
    color: #155724;
    text-align: center;
}

.distance-label {
    font-size: 11px;
    color: #155724;
    text-align: center;
    margin-top: 5px;
}

/* ==================== SOLDIER MARKERS ==================== */
.soldier-marker-wrapper {
    background: transparent !important;
    border: none !important;
}

.soldier-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    border-radius: 50%;
    transition: all 0.3s;
    position: relative;
    background-color: currentColor;
    color: white;
}

.soldier-icon i {
    position: relative;
    z-index: 2;
    filter: drop-shadow(0 0 3px rgba(0,0,0,0.5));
    color: white;
}

.soldier-icon.selected {
    transform: scale(1.4);
    filter: brightness(1.4);
}

/* Online glow - green */
.soldier-icon.soldier-online {
    animation: glowGreen 2s ease-in-out infinite;
}

@keyframes glowGreen {
    0%, 100% {
        box-shadow: 0 0 10px 3px #00e676,
                    0 0 20px 5px rgba(0, 230, 118, 0.6),
                    0 0 30px 8px rgba(0, 230, 118, 0.4);
    }
    50% {
        box-shadow: 0 0 15px 5px #00e676,
                    0 0 30px 8px rgba(0, 230, 118, 0.7),
                    0 0 45px 12px rgba(0, 230, 118, 0.5);
    }
}

/* Offline glow - red */
.soldier-icon.soldier-offline {
    animation: glowRed 2s ease-in-out infinite;
}

@keyframes glowRed {
    0%, 100% {
        box-shadow: 0 0 10px 3px #ff1744,
                    0 0 20px 5px rgba(255, 23, 68, 0.6),
                    0 0 30px 8px rgba(255, 23, 68, 0.4);
    }
    50% {
        box-shadow: 0 0 15px 5px #ff1744,
                    0 0 30px 8px rgba(255, 23, 68, 0.7),
                    0 0 45px 12px rgba(255, 23, 68, 0.5);
    }
}

/* ==================== MARKER LABELS (TOOLTIPS) ==================== */
.leaflet-tooltip.marker-label {
    background: #000 !important;
    color: white !important;
    border: none !important;
    border-radius: 4px !important;
    padding: 6px 10px !important;
    font-weight: bold !important;
    font-size: 13px !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.5) !important;
    white-space: nowrap !important;
}

.leaflet-tooltip.marker-label::before {
    border-top-color: #000 !important;
}

/* ==================== MAP POPUPS ==================== */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
    box-shadow: 0 3px 14px rgba(0,0,0,0.3);
}

.popup-header {
    font-size: 16px;
    font-weight: bold;
    color: #2c3e50;
    padding-bottom: 10px;
    border-bottom: 1px solid #ecf0f1;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.popup-detail {
    font-size: 13px;
    padding: 5px 0;
    color: #34495e;
    display: flex;
    align-items: center;
    gap: 8px;
}

.popup-detail i {
    color: #667eea;
    width: 16px;
}

/* ==================== FIXED STATS BLOCK ==================== */
.stats-fixed {
    padding: 15px;
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    flex-shrink: 0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.stat-card {
    background: white;
    padding: 15px 10px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-card.online {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
}

.stat-card.offline {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
}

.stat-number {
    font-size: 32px;
    font-weight: bold;
    color: #2c3e50;
    line-height: 1;
}

.stat-label {
    font-size: 11px;
    color: #7f8c8d;
    margin-top: 8px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* ==================== SCROLLABLE LOCATIONS SECTION ==================== */
.locations-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.locations-header {
    padding: 15px;
    border-bottom: 1px solid #dee2e6;
    flex-shrink: 0;
    background: white;
}

.locations-header h3 {
    font-size: 16px;
    color: #2c3e50;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-box {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
}

.search-box:focus {
    outline: none;
    border-color: #667eea;
}

.locations-list-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px;
    min-height: 0;
}

/* ==================== LOCATION ITEMS ==================== */
.location-item {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s;
}

.location-item:hover {
    transform: translateX(-5px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.location-item.online {
    border-left: 4px solid #27ae60;
    background: linear-gradient(90deg, #d4edda 0%, white 15%);
}

.location-item.offline {
    border-left: 4px solid #e74c3c;
    background: linear-gradient(90deg, #f8d7da 0%, white 15%);
}

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

.location-name {
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.location-time {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.location-time.online {
    background: #27ae60;
    color: white;
}

.location-time.offline {
    background: #e74c3c;
    color: white;
}

.location-details {
    font-size: 11px;
    color: #7f8c8d;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.location-details div {
    display: flex;
    align-items: center;
    gap: 6px;
}

.location-details i {
    color: #667eea;
    width: 14px;
    flex-shrink: 0;
}

/* ==================== SCROLLBAR STYLING ==================== */
.left-sidebar-content::-webkit-scrollbar,
.locations-list-scroll::-webkit-scrollbar {
    width: 8px;
}

.left-sidebar-content::-webkit-scrollbar-track,
.locations-list-scroll::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.left-sidebar-content::-webkit-scrollbar-thumb,
.locations-list-scroll::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.left-sidebar-content::-webkit-scrollbar-thumb:hover,
.locations-list-scroll::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ==================== DISTANCE LINE ==================== */
.distance-line {
    pointer-events: none;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1024px) {
    .left-sidebar {
        width: 280px;
    }
    
    .right-sidebar {
        width: 300px;
    }
    
    .left-toggle {
        left: 280px;
    }
    
    .right-toggle {
        right: 300px;
    }
    
    .left-sidebar.collapsed ~ .left-toggle {
        left: 0;
    }
    
    .right-sidebar.collapsed ~ .right-toggle {
        right: 0;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .main-header h1 {
        font-size: 18px;
    }
    
    .left-sidebar,
    .right-sidebar {
        width: 100%;
        max-width: 320px;
    }
}
