/* --- GLOBAL RESET & GENERAL STYLE --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: #f4f6f9;
    color: #333;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

/* --- LOGIN SCREEN --- */
.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #0d47a1 0%, #1a237e 100%);
}

.login-card {
    background: rgba(255, 255, 255, 0.95);
    padding: 40px 30px;
    border-radius: 16px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

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

.login-logo {
    max-width: 180px !important;
    width: 100% !important;
    height: auto !important;
    margin: 0 auto 20px auto !important;
    display: block !important;
    object-fit: contain !important;
}

.login-header h3 {
    font-size: 24px;
    font-weight: 700;
    color: #1a237e;
    margin-bottom: 8px;
}

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

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

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

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: all 0.3s ease;
}

.form-group input:focus {
    border-color: #0d47a1;
    box-shadow: 0 0 0 3px rgba(13, 71, 161, 0.15);
}

.password-input-wrapper {
    position: relative;
    width: 100%;
}

.password-input-wrapper input {
    padding-right: 44px;
}

.btn-toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #777;
    cursor: pointer;
    font-size: 15px;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.btn-toggle-password:hover {
    color: #0d47a1;
}

.form-options-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 12px 0 20px 0;
    font-size: 13.5px;
    color: #555;
}

.checkbox-remember {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    font-weight: 500;
}

.checkbox-remember input {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #0d47a1;
}

.login-error-msg {
    background-color: #ffebee;
    color: #c62828;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 15px;
    border-left: 4px solid #c62828;
}

.btn-login {
    width: 100%;
    background-color: #0d47a1;
    color: #fff;
    border: none;
    padding: 14px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.btn-login:hover {
    background-color: #1a237e;
}

/* --- APP LAYOUT --- */
.app-wrapper {
    display: flex;
    flex-direction: column;
    width: 100vw;
    height: 100vh;
}

/* App Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
    background-color: #fff;
    padding: 0 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    z-index: 1000;
    border-bottom: 1px solid #e0e0e0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.app-logo {
    height: 32px;
    width: auto;
}

.header-divider {
    height: 20px;
    width: 1px;
    background-color: #ccc;
}

.header-title {
    font-size: 16px;
    font-weight: 600;
    color: #1a237e;
}

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

.user-profile {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #555;
    font-size: 14px;
}

.profile-icon {
    font-size: 20px;
    color: #0d47a1;
}

.profile-email {
    font-weight: 500;
}

.btn-logout {
    background: none;
    border: 1px solid #c62828;
    color: #c62828;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-logout:hover {
    background-color: #c62828;
    color: #fff;
}

/* App Main */
.app-main {
    display: flex;
    flex: 1;
    height: calc(100vh - 60px);
    position: relative;
}

/* Sidebar */
.app-sidebar {
    width: 340px;
    background-color: #fff;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    height: 100%;
    z-index: 999;
    box-shadow: 2px 0 5px rgba(0,0,0,0.02);
}

.sidebar-search {
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-box {
    position: relative;
    flex: 1;
}

.btn-sidebar-alarm {
    background: #0d47a1;
    color: #ff9800;
    border: none;
    border-radius: 8px;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    cursor: pointer;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(13, 71, 161, 0.25);
    transition: all 0.2s ease;
    position: relative;
}

.btn-sidebar-alarm:hover {
    background: #1565c0;
    transform: scale(1.05);
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #888;
}

.search-box input {
    width: 100%;
    padding: 10px 10px 10px 38px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 13px;
    outline: none;
    background-color: #f8f9fa;
    transition: border-color 0.3s ease;
}

.search-box input:focus {
    border-color: #0d47a1;
    background-color: #fff;
}

.sidebar-tabs {
    display: flex;
    border-bottom: 1px solid #e0e0e0;
}

.tab-btn {
    flex: 1;
    padding: 12px 5px;
    background: none;
    border: none;
    font-size: 13px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    text-align: center;
}

.tab-btn.active {
    color: #0d47a1;
    border-bottom-color: #0d47a1;
    background-color: rgba(13, 71, 161, 0.02);
}

.device-list-container {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.list-title {
    padding: 12px 15px;
    font-size: 13px;
    font-weight: 700;
    color: #444;
    background-color: #f8f9fa;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.device-list {
    list-style: none;
}

.list-placeholder {
    padding: 30px;
    text-align: center;
    color: #888;
    font-size: 13px;
}

/* Device Item */
.device-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #f2f2f2;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

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

.device-item.active {
    background-color: #ebf2ff;
    border-left: 4px solid #0d47a1;
    padding-left: 11px;
}

.device-item-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.device-checkbox {
    cursor: pointer;
}

.device-info-wrapper {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.device-name {
    font-size: 13px;
    font-weight: 600;
    color: #0d47a1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.device-time-ago {
    font-size: 11px;
    color: #888;
    margin-top: 3px;
}

.device-item-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.status-online {
    background-color: #2196f3; /* Blue */
    box-shadow: 0 0 6px #2196f3;
}

.status-offline {
    background-color: #bdbdbd; /* Gray */
}

.engine-icon {
    font-size: 14px;
    color: #bdbdbd;
}

.engine-on {
    color: #4caf50; /* Green */
}

.engine-off {
    color: #f44336; /* Red */
}

.btn-device-menu {
    background: none;
    border: none;
    color: #aaa;
    cursor: pointer;
    padding: 4px;
    font-size: 14px;
}

.btn-device-menu:hover {
    color: #333;
}

/* Map Area */
.app-map {
    flex: 1;
    height: 100%;
}

/* --- LEAFLET CUSTOM POPUP PANEL --- */
.leaflet-popup-content-wrapper {
    border-radius: 12px;
    padding: 0;
    overflow: hidden;
    box-shadow: 0 3px 15px rgba(0,0,0,0.2);
}

.leaflet-popup-content {
    margin: 0;
    width: 320px !important;
}

.popup-container {
    display: flex;
    flex-direction: column;
    background-color: #fff;
    width: 100%;
}

.popup-header {
    background-color: #fff;
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.popup-title-box {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.popup-device-name {
    font-size: 14px;
    font-weight: 700;
    color: #333;
    display: flex;
    align-items: center;
    gap: 5px;
}

.popup-btn-edit {
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    font-size: 12px;
}

.popup-device-imei {
    font-size: 11px;
    color: #666;
    font-weight: 500;
    margin-top: 2px;
}

.popup-device-status-badge {
    font-size: 11px;
    font-weight: 600;
    color: #2196f3;
    background-color: rgba(33, 150, 243, 0.08);
    padding: 4px 8px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.popup-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: #2196f3;
}

.popup-body {
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.popup-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    line-height: 1.4;
}

.popup-row-left {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #666;
}

.popup-row-icon {
    font-size: 13px;
    color: #0d47a1;
    width: 16px;
    text-align: center;
}

.popup-row-value {
    font-weight: 600;
    color: #333;
    max-width: 170px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Address Styling (Special wrapping) */
.popup-row.address-row {
    align-items: flex-start;
    border-top: 1px dashed #eee;
    padding-top: 8px;
    margin-top: 4px;
}

.popup-row.address-row .popup-row-value {
    white-space: normal;
    font-size: 11px;
    color: #555;
    font-weight: 500;
    text-align: right;
    max-width: 220px;
}

.popup-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background-color: #f8f9fa;
    border-top: 1px solid #eee;
}

.popup-foot-btn {
    background: none;
    border: none;
    color: #555;
    cursor: pointer;
    padding: 6px;
    font-size: 14px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.popup-foot-btn:hover {
    color: #0d47a1;
    background-color: rgba(13, 71, 161, 0.05);
}

.leaflet-popup-close-button {
    display: none !important; /* Kami pakai icon custom atau default click map to close */
}

/* --- PLAYBACK MODAL STYLE --- */
.modal-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999999;
}

.modal-card {
    background: #fff;
    border-radius: 12px;
    width: 95%;
    max-width: 360px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    overflow: hidden;
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    background-color: #0d47a1;
    color: #fff;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.btn-close-modal {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
}

.modal-body {
    padding: 20px;
}

/* --- POPUP GRID SYSTEM (2-COLUMN Telemetry) --- */
.popup-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 16px;
    margin-bottom: 8px;
}

.popup-grid-item {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.popup-grid-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.popup-grid-label {
    font-size: 10px;
    color: #888;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 1px;
}

.popup-grid-val {
    font-size: 12px;
    font-weight: 700;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.popup-address-box {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    border-top: 1px dashed #e0e0e0;
    padding-top: 8px;
    margin-top: 8px;
}

.popup-address-val {
    font-size: 11px;
    font-weight: 500;
    color: #555;
    line-height: 1.4;
}

/* --- POPUP GRID NEW (NO LABELS, EXACT ALIGNMENT TO REFERENCE IMAGE 3) --- */
.popup-grid-new {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px;
    margin-bottom: 4px;
}

.popup-grid-new-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    font-weight: 500;
    color: #333;
    min-width: 0;
}

.popup-grid-new-item i {
    color: #555;
    font-size: 14px;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.popup-grid-new-item span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.popup-grid-new-full {
    grid-column: span 2;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    font-weight: 500;
    color: #333;
    min-width: 0;
}

.popup-grid-new-full i {
    color: #555;
    font-size: 14px;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

/* --- PLAYBACK PLAYER CONTROL PANEL --- */
.playback-player-panel {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    border-radius: 14px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    z-index: 9999;
    width: 90%;
    max-width: 580px;
    box-sizing: border-box;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.playback-player-btn {
    background-color: #0d47a1;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 15px;
    box-shadow: 0 2px 6px rgba(13, 71, 161, 0.3);
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.playback-player-btn:hover {
    background-color: #1565c0;
    transform: scale(1.05);
}

.playback-player-btn:active {
    transform: scale(0.95);
}

.playback-player-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: #e0e0e0;
    outline: none;
    cursor: pointer;
    transition: background 0.15s ease-in-out;
}

.playback-player-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #0d47a1;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
    transition: transform 0.1s ease;
}

.playback-player-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.playback-player-info {
    display: flex;
    flex-direction: column;
    min-width: 110px;
    font-family: inherit;
    font-size: 12px;
    gap: 2px;
    flex-shrink: 0;
}

.playback-player-select {
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid #ccc;
    background-color: #fff;
    font-size: 12px;
    font-weight: 600;
    color: #333;
    outline: none;
    cursor: pointer;
    flex-shrink: 0;
}

.playback-player-btn-close {
    background: none;
    border: none;
    color: #888;
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
    flex-shrink: 0;
}

.playback-player-btn-close:hover {
    color: #f44336;
}

/* --- AUTO REFRESH PILL (ALA IOPGPS) --- */
.auto-refresh-pill {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #fff;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    margin-right: 8px;
}

.auto-refresh-pill:hover {
    background: rgba(255, 255, 255, 0.28);
    transform: scale(1.03);
}

.auto-refresh-pill strong {
    font-weight: 700;
    color: #ffca28;
    min-width: 16px;
    display: inline-block;
    text-align: center;
}

.auto-refresh-pill .refresh-icon {
    font-size: 12px;
    color: #64b5f6;
    transition: transform 0.3s ease;
}

.auto-refresh-pill .refresh-icon.spinning {
    animation: iconSpin 0.8s linear infinite;
}

@keyframes iconSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* --- ALARM NOTIFICATION BELL & DRAWER PANEL --- */
.btn-alarm-bell {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #fff;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    font-size: 16px;
    transition: all 0.2s ease;
    margin-right: 8px;
}

.btn-alarm-bell:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.alarm-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background-color: #f44336;
    color: #fff;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: 700;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.alarm-drawer {
    position: fixed;
    top: 64px;
    right: 20px;
    width: 340px;
    max-height: 480px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: drawerSlide 0.2s ease;
}

@keyframes drawerSlide {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.alarm-drawer-header {
    background-color: #0d47a1;
    color: #fff;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.alarm-drawer-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-close-alarm {
    background: none;
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.alarm-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.alarm-placeholder {
    padding: 24px 12px;
    text-align: center;
    color: #888;
    font-size: 13px;
}

.alarm-item {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-left: 4px solid #2196f3;
    border-radius: 8px;
    padding: 10px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.alarm-item:hover {
    background: #e3f2fd;
    border-color: #90caf9;
    transform: translateX(2px);
}

.alarm-item.acc-on {
    border-left-color: #4caf50;
}

.alarm-item.acc-off {
    border-left-color: #f44336;
}

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

.alarm-item-title {
    font-size: 12px;
    font-weight: 700;
    color: #333;
    display: flex;
    align-items: center;
    gap: 6px;
}

.alarm-item-time {
    font-size: 10px;
    color: #777;
}

.alarm-item-device {
    font-size: 11px;
    font-weight: 600;
    color: #0d47a1;
    margin-bottom: 2px;
}

.alarm-item-addr {
    font-size: 11px;
    color: #555;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- SIDEBAR DEVICE ITEM ALARM BADGE --- */
.device-alarm-badge {
    margin-top: 4px;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 10.5px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
    animation: badgePulse 1.5s infinite ease-in-out;
}

@keyframes badgePulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

.device-alarm-badge:hover {
    filter: brightness(0.92);
}

.device-alarm-badge.alarm-powercut {
    background-color: #ffebee;
    color: #d32f2f;
    border: 1px solid #ffcdd2;
}

.device-alarm-badge.alarm-lowbattery {
    background-color: #fff8e1;
    color: #f57f17;
    border: 1px solid #ffe082;
}

.device-alarm-badge.alarm-vibration {
    background-color: #fff3e0;
    color: #e65100;
    border: 1px solid #ffcc80;
}

/* --- ADMIN MANAGEMENT PANEL BUTTON & MODAL --- */
.btn-admin-panel {
    background: rgba(255, 193, 7, 0.2);
    border: 1px solid #ffc107;
    color: #fff;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-right: 4px;
}

.btn-admin-panel:hover {
    background: rgba(255, 193, 7, 0.35);
    transform: translateY(-1px);
}

.admin-modal-content {
    max-width: 960px;
    width: 92%;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    padding: 24px;
    border-radius: 12px;
}

.admin-modal-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 16px;
}

.btn-add-device {
    background: #2e7d32;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s ease;
}

.btn-add-device:hover {
    background: #1b5e20;
}

.admin-table-container {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 60vh;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
}

.admin-device-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
    text-align: left;
}

.admin-device-table th {
    background: #f5f5f5;
    color: #333;
    font-weight: 700;
    padding: 10px 12px;
    border-bottom: 2px solid #e0e0e0;
    position: sticky;
    top: 0;
    z-index: 5;
}

.admin-device-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
    color: #444;
}

.admin-device-table tr:hover {
    background: #f9f9f9;
}

.btn-admin-edit {
    background: #e3f2fd;
    color: #1976d2;
    border: 1px solid #bbdefb;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    margin-right: 4px;
}

.btn-admin-edit:hover {
    background: #bbdefb;
}

.btn-admin-delete {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
}

.btn-admin-delete:hover {
    background: #ffcdd2;
}

.device-form-modal-content {
    max-width: 480px;
    width: 90%;
    padding: 24px;
    border-radius: 12px;
}

/* --- ADMIN TOP BAR CUSTOMER SELECTOR DROPDOWN --- */
.admin-customer-selector-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 20px;
    padding-left: 16px;
    border-left: 1px solid #e0e0e0;
}

.customer-select-label {
    font-size: 12.5px;
    font-weight: 600;
    color: #555;
    white-space: nowrap;
}

.customer-dropdown-wrapper {
    position: relative;
}

.btn-customer-dropdown {
    background: #f0f4f9;
    border: 1px solid #c3dafe;
    color: #0d47a1;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 12.5px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 200px;
    justify-content: space-between;
}

.btn-customer-dropdown:hover {
    background: #e3f2fd;
    border-color: #1976d2;
}

.dropdown-arrow {
    font-size: 11px;
    color: #0d47a1;
    transition: transform 0.2s ease;
}

.customer-dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: 280px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    border: 1px solid #e0e0e0;
    z-index: 2000;
    overflow: hidden;
}

.customer-search-box {
    padding: 8px 10px;
    background: #f8fafc;
    border-bottom: 1px solid #eee;
    position: relative;
}

.customer-search-box i {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: #888;
    font-size: 12px;
}

.customer-search-box input {
    width: 100%;
    padding: 6px 8px 6px 28px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 12px;
    outline: none;
}

.customer-list-container {
    max-height: 260px;
    overflow-y: auto;
}

.customer-item {
    padding: 10px 14px;
    font-size: 12.5px;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: background 0.15s ease;
    border-bottom: 1px solid #f5f5f5;
}

.customer-item:hover {
    background: #e3f2fd;
    color: #0d47a1;
}

.customer-item.active {
    background: #bbdefb;
    color: #0d47a1;
    font-weight: 700;
}

.customer-item-badge {
    background: #f1f5f9;
    color: #475569;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
}

/* --- DEVICE COMMAND ACTION BUTTONS --- */
.btn-cmd-action {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.btn-cmd-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.btn-cmd-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.btn-cmd-text {
    display: flex;
    flex-direction: column;
}

.btn-cmd-text strong {
    font-size: 13px;
    color: #1e293b;
}

.btn-cmd-text small {
    font-size: 11px;
    color: #64748b;
    margin-top: 2px;
}

/* Voice Call */
.btn-cmd-voice {
    border-color: #bbf7d0;
    background: #f0fdf4;
}
.btn-cmd-voice:hover {
    background: #dcfce7;
    border-color: #86efac;
}
.btn-cmd-voice .btn-cmd-icon {
    background: #22c55e;
    color: #ffffff;
}

/* Stop Engine */
.btn-cmd-stop {
    border-color: #fecaca;
    background: #fef2f2;
}
.btn-cmd-stop:hover {
    background: #fee2e2;
    border-color: #fca5a5;
}
.btn-cmd-stop .btn-cmd-icon {
    background: #ef4444;
    color: #ffffff;
}

/* Resume Engine */
.btn-cmd-resume {
    border-color: #bfdbfe;
    background: #eff6ff;
}
.btn-cmd-resume:hover {
    background: #dbeafe;
    border-color: #93c5fd;
}
.btn-cmd-resume .btn-cmd-icon {
    background: #3b82f6;
    color: #ffffff;
}

/* --- CUSTOM HEADER BUTTONS --- */
.header-btn {
    background: rgba(13, 71, 161, 0.08);
    border: 1px solid rgba(13, 71, 161, 0.25);
    color: #0d47a1;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12.5px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.header-btn:hover {
    background: rgba(13, 71, 161, 0.18);
    transform: translateY(-1px);
}

.btn-profile-custom {
    background: rgba(2, 132, 199, 0.08);
    border: 1px solid rgba(2, 132, 199, 0.25);
    color: #0284c7;
}
.btn-profile-custom:hover {
    background: rgba(2, 132, 199, 0.18);
}

.btn-billing-custom {
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.25);
    color: #10b981;
}
.btn-billing-custom:hover {
    background: rgba(16, 185, 129, 0.18);
}

.btn-geofence-custom {
    background: rgba(147, 51, 234, 0.08);
    border: 1px solid rgba(147, 51, 234, 0.25);
    color: #9333ea;
}
.btn-geofence-custom:hover {
    background: rgba(147, 51, 234, 0.18);
}

.btn-report-distance-custom {
    background: rgba(217, 119, 6, 0.08);
    border: 1px solid rgba(217, 119, 6, 0.25);
    color: #d97706;
}
.btn-report-distance-custom:hover {
    background: rgba(217, 119, 6, 0.18);
}

/* --- FLOATING MAP LAYER TOGGLE --- */
.map-layer-control {
    position: absolute;
    bottom: 25px;
    right: 65px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 4px;
    border-radius: 30px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.2);
    display: flex;
    gap: 4px;
    border: 1px solid rgba(0,0,0,0.1);
}

.map-layer-btn {
    background: none;
    border: none;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 700;
    color: #555;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.map-layer-btn i {
    font-size: 12px;
}

.map-layer-btn.active {
    background: #0d47a1;
    color: #fff;
    box-shadow: 0 2px 8px rgba(13, 71, 161, 0.35);
}

.map-layer-btn:hover:not(.active) {
    background: rgba(0, 0, 0, 0.06);
    color: #111;
}

/* --- MENU DROPDOWN SYSTEM --- */
.menu-dropdown-container {
    position: relative;
    display: inline-block;
}

.btn-menu-toggle-custom {
    background: rgba(13, 71, 161, 0.08);
    border: 1px solid rgba(13, 71, 161, 0.25);
    color: #0d47a1;
}

.btn-menu-toggle-custom:hover {
    background: rgba(13, 71, 161, 0.15);
}

.menu-dropdown-list {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.25), 0 4px 12px rgba(0, 0, 0, 0.1);
    min-width: 200px;
    padding: 6px;
    z-index: 9999;
    display: none;
    flex-direction: column;
    gap: 4px;
    animation: slideDownFade 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.dropdown-item {
    background: none;
    border: none;
    outline: none;
    width: 100%;
    padding: 10px 14px;
    font-size: 13.5px;
    font-weight: 600;
    color: #334155;
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s ease;
}

.dropdown-item:hover {
    background: #f1f5f9;
    color: #0d47a1;
}

@keyframes slideDownFade {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- MULTI-TAB REPORT SYSTEM --- */
.report-tab-btn {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-bottom: none;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    outline: none;
}

.report-tab-btn:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.report-tab-btn.active {
    background: #ffffff;
    border-color: #cbd5e1;
    border-bottom: 2px solid #ffffff;
    color: #0d47a1;
    padding-bottom: 9px;
    margin-bottom: -2px;
}

.report-tab-content {
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* --- PREMIUM WIDGETS & GLASSMORPHIC DASHBOARD --- */
.maint-status-safe {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
}
.maint-status-warning {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #b45309;
}
.maint-status-danger {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    color: #b91c1c;
}

/* CSS Activity Chart */
.dash-chart-bar-row {
    display: flex;
    align-items: center;
    gap: 12px;
}
.dash-chart-bar-name {
    width: 120px;
    font-size: 12.5px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #94a3b8;
}
.dash-chart-bar-bg {
    flex: 1;
    background: #334155;
    height: 16px;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}
.dash-chart-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #38bdf8, #0ea5e9);
    border-radius: 8px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}
.dash-chart-bar-value {
    width: 65px;
    font-size: 12.5px;
    font-weight: 600;
    color: #fff;
    text-align: right;
}

/* Top Active Item */
.dash-top-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #1e293b;
    border: 1px solid #334155;
    padding: 10px 14px;
    border-radius: 8px;
    transition: all 0.2s ease;
}
.dash-top-item:hover {
    background: #334155;
    border-color: #475569;
}

/* ══════════════════════════════════════════════════════════════
   FLOATING ALERT BAR OVER MAP
   ══════════════════════════════════════════════════════════════ */
.floating-alert-bar {
    position: absolute;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1500;
    background: rgba(15, 23, 42, 0.94);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(239, 68, 68, 0.4);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 0 15px rgba(239, 68, 68, 0.3);
    border-radius: 12px;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    max-width: 90%;
    width: max-content;
    animation: slideDownAlert 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideDownAlert {
    from { opacity: 0; transform: translate(-50%, -20px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

.floating-alert-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid #ef4444;
    color: #ef4444;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.floating-alert-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.floating-alert-content strong {
    font-size: 13px;
    color: #f87171;
}

.floating-alert-content span {
    font-size: 12px;
    color: #cbd5e1;
}

.floating-alert-btn {
    background: #0284c7;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: 8px;
    flex-shrink: 0;
}

.floating-alert-btn:hover {
    background: #0369a1;
}

.floating-alert-close {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
    margin-left: 4px;
}

.floating-alert-close:hover {
    color: #fff;
}

/* Print Copy Styling for PDF export */
@media print {
    body * {
        visibility: hidden;
    }
    #report-distance-modal, #report-distance-modal * {
        visibility: visible;
    }
    #report-distance-modal {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        height: auto;
        background: #fff !important;
    }
    .modal-card {
        box-shadow: none !important;
        border: none !important;
        max-width: 100% !important;
        width: 100% !important;
    }
    .btn-close-modal, .btn-secondary, .btn-login, .modal-footer {
        display: none !important;
    }
}

/* --- SMART POWER CUT ALARM BADGES --- */
.device-alarm-badge.alarm-powercut-moving {
    background-color: #fef2f2 !important;
    color: #dc2626 !important;
    border: 1.5px solid #ef4444 !important;
    font-weight: 700 !important;
    animation: pulse-red-border 1.5s infinite;
}
.device-alarm-badge.alarm-powercut-idling {
    background-color: #fffbeb !important;
    color: #b45309 !important;
    border: 1.5px solid #f59e0b !important;
    font-weight: 700 !important;
}
.device-alarm-badge.alarm-powercut-parked {
    background-color: #f1f5f9 !important;
    color: #475569 !important;
    border: 1px solid #cbd5e1 !important;
    font-weight: 600 !important;
}
@keyframes pulse-red-border {
    0% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.5); }
    70% { box-shadow: 0 0 0 6px rgba(220, 38, 38, 0); }
    100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}
