/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

/* Screen Management */
.screen {
    display: none;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    width: 100%;
    box-sizing: border-box;
}

.screen.active {
    display: block;
}

/* Login Screen */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    padding: 40px;
    width: 100%;
    max-width: 400px;
    backdrop-filter: blur(10px);
}

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

.login-header i {
    font-size: 48px;
    color: #667eea;
    margin-bottom: 16px;
}

.login-header h1 {
    font-size: 26px;
    font-weight: 800;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
    letter-spacing: -0.3px;
    white-space: nowrap;
}

.login-header p {
    color: #718096;
    font-size: 16px;
}

.login-note {
    color: #a0aec0 !important;
    font-size: 14px !important;
    font-style: italic;
    margin-top: 8px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

#loginForm .login-btn {
    width: 100%;
    align-self: center;
}

/* Phone OTP form: equal-width buttons stacked and centered */
.phone-otp-buttons {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
}

.phone-otp-buttons .login-btn,
.phone-otp-buttons .cancel-btn {
    width: 100%;
}

.login-version {
    margin-top: 18px;
    text-align: center;
    font-size: 12px;
    color: #94a3b8;
    letter-spacing: 0.2px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 500;
    color: #4a5568;
    font-size: 14px;
}

.form-group input {
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.2s ease;
    background: #f7fafc;
}

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

.login-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 14px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
    box-sizing: border-box;
    line-height: 1.5;
    height: auto;
    min-height: 48px;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.login-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.btn-spinner {
    display: none;
}

/* General Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

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

.btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: #3b82f6;
    color: #ffffff;
}

.btn-primary:hover {
    background: #2563eb;
}

.btn-secondary {
    background: #6b7280;
    color: #ffffff;
}

.btn-secondary:hover {
    background: #4b5563;
}

/* Cancel Button Styles */
.cancel-btn {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #e5e7eb;
    padding: 14px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
    box-sizing: border-box;
    line-height: 1.5;
    height: auto;
    min-height: 48px;
}

.cancel-btn:hover {
    background: #e5e7eb;
    border-color: #d1d5db;
    color: #1f2937;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.cancel-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.cancel-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Reset password modal button alignment */
#resetPasswordModal .login-btn,
#resetPasswordModal .cancel-btn,
#forgotPasswordModal .login-btn,
#forgotPasswordModal .cancel-btn {
    height: 48px;
    flex: 1 1 0 !important;
    width: 100%;
}

.modal-action-row {
    display: flex;
    align-items: stretch;
    gap: 10px;
    flex-wrap: nowrap;
}

.modal-action-row .btn-text {
    white-space: nowrap;
}

.modal-action-row .login-btn,
.modal-action-row .cancel-btn {
    margin-top: 0;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: #f3f4f6;
    color: #374151;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background: #e5e7eb;
    color: #1f2937;
    transform: translateY(-1px);
}

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

.error-message {
    background: #fed7d7;
    color: #c53030;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin-top: 16px;
    border-left: 4px solid #e53e3e;
}

/* Dashboard Screen */
.dashboard-header {
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 10001;
    margin: 0;
    padding: 0;
    width: 100%;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 12px 24px;
    gap: 16px;
    width: 100%;
    box-sizing: border-box;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    overflow: visible;
    flex: 0 0 auto;
    min-width: 0;
    margin: 0;
    padding: 0;
}

.header-left i {
    font-size: 24px;
    color: #667eea;
}

.header-left img {
    display: block;
    margin: 0;
    padding: 0;
}

.header-left h1 {
    font-size: 22px;
    font-weight: 800;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.3px;
    white-space: nowrap;
    overflow: visible;
    padding-right: 10px;
    margin: 0;
}


.header-right {
    display: flex;
    align-items: center;
    margin-left: auto;
    gap: 16px;
    flex-wrap: wrap;
    margin-right: 0;
}

/* Alert Menu Styles */
.alert-menu {
    position: relative;
    display: none;
    margin-right: 10px;
}

.alert-menu[style*="display: flex"],
.alert-menu[style*="display:flex"],
.alert-menu[style*="display: block"],
.alert-menu[style*="display:block"] {
    display: flex;
}

.alert-menu-btn {
    background: #10b981;
    color: #ffffff;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.2s;
}

.alert-menu-btn:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.alert-menu-btn i:last-child {
    font-size: 10px;
}

.alert-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    z-index: 10000;
    overflow: hidden;
    display: none;
}

.alert-dropdown.show {
    display: block;
}

.alert-dropdown-option {
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: white;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #374151;
    transition: background 0.2s;
}

.alert-dropdown-option:hover:not(:disabled) {
    background: #f3f4f6;
}

.alert-dropdown-option:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.alert-dropdown-option i {
    width: 16px;
    color: #10b981;
}

.history-menu {
    position: relative;
    display: none;
    align-items: center;
    margin-right: 8px;
}

.history-menu[style*="display: flex"],
.history-menu[style*="display:flex"],
.history-menu[style*="display: block"],
.history-menu[style*="display:block"] {
    display: flex !important;
    align-items: center;
}

.history-menu-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #0ea5e9;
    color: #ffffff;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(14, 165, 233, 0.25);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.history-menu-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(14, 165, 233, 0.35);
}

.history-menu-btn i:last-child {
    font-size: 10px;
}

.history-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.18);
    min-width: 220px;
    z-index: 9999;
    overflow: hidden;
    border: 1px solid #e5e7eb;
}

.history-dropdown-option {
    width: 100%;
    padding: 12px 16px;
    background: none;
    border: none;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #1f2937;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.history-dropdown-option:hover {
    background: #f1f5f9;
    color: #0f172a;
}

/* Map Clock Control */
.map-clock-control {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 6px;
    padding: 8px 12px;
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.2),
        0 0 0 1px rgba(0, 0, 0, 0.1);
    margin: 10px;
    backdrop-filter: blur(10px);
    min-width: 180px;
}

.clock-time {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 2px;
    font-family: 'Courier New', monospace;
    line-height: 1.2;
    display: flex;
    align-items: center;
    gap: 6px;
    color: #000000;
    position: relative;
    z-index: 1;
}

.clock-date {
    color: #000000;
    font-size: 15px;
    font-weight: 600;
}

.clock-time-part {
    color: #000000;
}

.clock-timezone {
    font-size: 13px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-family: 'Courier New', monospace;
    color: #333333;
    position: relative;
    z-index: 1;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-info span {
    font-weight: 500;
    color: #4a5568;
}

#userMenuBtn {
    display: inline-flex !important;
    align-items: center !important;
    vertical-align: middle;
    line-height: 1.2;
    transition: transform 0.2s ease, box-shadow 0.2s ease !important;
}

#userMenuBtn:hover {
    transform: translateY(-1px) !important;
    /* box-shadow is set dynamically in JavaScript based on user role */
}

#userMenuBtn i {
    display: inline-flex;
    align-items: center;
    line-height: 1;
    flex-shrink: 0;
}

#userMenuBtn span {
    display: inline-flex;
    align-items: center;
    line-height: 1.2;
}

.logout-btn {
    background: #e53e3e;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.logout-btn:hover {
    background: #c53030;
    transform: translateY(-1px);
}

/* Management Action Buttons (Super User) */
.management-btn {
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.management-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.management-btn.create-user {
    background: #3b82f6;
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.25);
}

.management-btn.create-user:hover {
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.35);
}

.management-btn.create-device {
    background: #10b981;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.25);
}

.management-btn.create-device:hover {
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.35);
}

.management-btn.restore-users {
    background: #f59e0b;
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.25);
}

.management-btn.restore-users:hover {
    box-shadow: 0 4px 10px rgba(245, 158, 11, 0.35);
}

.management-btn.manage-devices {
    background: #8b5cf6;
    box-shadow: 0 2px 6px rgba(139, 92, 246, 0.25);
}

/* Management Dropdown Options */
.management-dropdown-option:hover {
    background: #f9fafb !important;
}

.management-btn.manage-devices:hover {
    box-shadow: 0 4px 10px rgba(139, 92, 246, 0.35);
}

/* Dashboard Main */
.dashboard-main {
    padding: 24px;
    padding-top: 80px;
    max-width: 100%;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

.dashboard-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 3fr 1fr; /* 75% map, 25% devices panel */
    gap: 24px;
    align-items: start;
    width: 100%;
}

@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

.map-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    position: relative;
    z-index: 1;
    margin-bottom: 24px;
}

.map {
    width: 100%;
    height: 70vh; /* Use viewport height for responsive scaling */
    min-height: 400px; /* Minimum height for usability */
    position: relative;
    border-radius: 12px;
    overflow: hidden;
}

/* Ensure Google Maps respects border radius */
.map > div,
.map > div > div {
    border-radius: 12px !important;
}

.map-controls {
    position: absolute;
    top: 16px;
    right: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 1000;
}

.control-btn {
    background: white;
    border: none;
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: #4a5568;
}

.control-btn:hover {
    background: #f7fafc;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.control-btn.small {
    padding: 6px 12px;
    font-size: 12px;
}

/* Devices Panel */
.devices-panel {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.panel-header {
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f7fafc;
}

.panel-header h3 {
    margin: 0;
    color: #2d3748;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.devices-list {
    max-height: 500px;
    overflow-y: auto;
}

/* Edit User modal - device list */
.devices-list-edit {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 400px;
    overflow-y: auto;
}

.device-edit-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.device-edit-item:hover {
    border-color: #d1d5db;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.device-edit-item-main {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.device-status-indicator {
    flex-shrink: 0;
    width: 10px;
    height: 10px;
    border-radius: 2px;
}

.device-status-indicator.device-status-active {
    background: #22c55e;
}

.device-status-indicator.device-status-inactive {
    background: #ef4444;
}

.device-edit-item-info {
    min-width: 0;
}

.device-edit-item-name {
    font-weight: 600;
    color: #111827;
    font-size: 14px;
    margin-bottom: 2px;
}

.device-edit-item-imei {
    font-size: 12px;
    color: #6b7280;
    font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
}

.device-edit-item-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.device-edit-item-actions .btn-edit-device,
.device-edit-item-actions .btn-reassign {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
}

.device-edit-item-actions .btn-edit-device {
    background: #10b981;
    color: white;
}

.device-edit-item-actions .btn-edit-device:hover {
    background: #059669;
}

.device-edit-item-actions .btn-reassign {
    background: #3b82f6;
    color: white;
}

.device-edit-item-actions .btn-reassign:hover {
    background: #2563eb;
}

.device-item {
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.device-item:hover {
    background: #f7fafc;
}

.device-item:last-child {
    border-bottom: none;
}

.device-item.active {
    background: #e6fffa;
    border-left: 4px solid #38b2ac;
}

.device-metrics-row {
    font-size: 11px;
    color: #718096;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.device-item-address .last-known-badge {
    background: #FEF3C7;
    color: #92400E;
    font-size: 9px;
    font-weight: 600;
    padding: 1px 5px;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    flex-shrink: 0;
}

.signal-aging-badge {
    background: #E0F2FE;
    color: #0369A1;
    font-size: 9px;
    font-weight: 600;
    padding: 1px 5px;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    flex-shrink: 0;
}

.device-item-address .device-item-address-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    line-height: 1.4;
    flex: 1 1 100%;
    width: 100%;
}

.device-name {
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 4px;
}

.device-details {
    font-size: 14px;
    color: #718096;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.device-label-editable,
.device-label-editable * {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
    font-weight: 500;
}

.label-edit-input {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
    font-weight: 500;
    color: #3b82f6 !important;
}

.device-status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    margin-top: 4px;
}

.device-status.has-signal {
    background: transparent;
    color: transparent;
}

.device-status.no-signal {
    background: #fed7d7;
    color: #742a2a;
}

.loading-devices {
    padding: 40px 20px;
    text-align: center;
    color: #718096;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.no-devices {
    padding: 40px 20px;
    text-align: center;
    color: #718096;
}

.no-devices i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* No History Message Overlay */
.no-history-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #f7fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.no-history-content {
    text-align: center;
    padding: 40px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    max-width: 400px;
}

.location-info {
    background: white;
    padding: 16px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    min-width: 200px;
}

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

.info-item:last-child {
    margin-bottom: 0;
}

.info-item .label {
    font-weight: 500;
    color: #718096;
    font-size: 14px;
}

.info-item span:last-child {
    font-weight: 600;
    color: #2d3748;
    font-size: 14px;
}

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

.loading-spinner {
    background: white;
    padding: 32px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.loading-spinner i {
    font-size: 32px;
    color: #667eea;
    margin-bottom: 16px;
}

.loading-spinner p {
    font-weight: 500;
    color: #4a5568;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .map {
        height: 60vh;
        min-height: 450px;
        border-radius: 12px;
        overflow: hidden;
    }
    
    .dashboard-main {
        padding: 16px;
        padding-top: 72px;
    }
}

@media (max-width: 768px) {
    .login-card {
        padding: 24px;
        margin: 16px;
    }
    
    .header-content {
        padding: 12px 16px;
        flex-direction: column;
        gap: 12px;
    }
    
    .header-left {
        width: 100%;
    }
    
    .header-left h1 {
        font-size: 18px;
        font-weight: 800;
    }
    
    .header-right {
        width: 100%;
        justify-content: flex-end;
    }
    
    .header-center {
        order: 2;
        width: 100%;
    }
    
    .map-clock-control {
        padding: 6px 10px;
        min-width: 150px;
        margin: 8px;
    }
    
    .clock-time {
        font-size: 14px;
        gap: 5px;
        letter-spacing: 1.5px;
    }
    
    .clock-timezone {
        font-size: 11px;
        letter-spacing: 1.5px;
    }
    
    .dashboard-main {
        padding: 12px;
        padding-top: 68px;
    }
    
    .map {
        height: 50vh;
        min-height: 350px;
        border-radius: 12px;
        overflow: hidden;
    }
    
    .map-controls {
        position: static;
        flex-direction: row;
        margin: 12px;
        flex-wrap: wrap;
    }
    
    .location-info {
        min-width: auto;
        flex: 1;
    }
    
    .control-btn {
        padding: 10px 14px;
        font-size: 14px;
    }
    
    .device-item {
        padding: 12px 16px;
    }
    
    .devices-list {
        max-height: 400px;
    }
}

@media (max-width: 480px) {
    .map {
        height: 45vh;
        min-height: 300px;
        border-radius: 12px;
        overflow: hidden;
    }
    
    .login-card {
        padding: 20px;
        margin: 12px;
    }
    
    .header-left h1 {
        font-size: 16px;
        font-weight: 800;
    }
    
    .user-info {
        font-size: 14px;
    }
    
    .device-name {
        font-size: 15px;
    }
    
    .device-details {
        font-size: 12px;
    }
    
    .panel-header {
        padding: 16px;
    }
    
    .panel-header h3 {
        font-size: 16px;
    }
    
    .map-clock-control {
        padding: 6px 10px;
        min-width: 140px;
        margin: 6px;
    }
    
    .clock-time {
        font-size: 13px;
        gap: 4px;
        letter-spacing: 1px;
    }
    
    .clock-timezone {
        font-size: 10px;
        letter-spacing: 1px;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Alert Bell Badge Animation */
@keyframes alertBellFadeInOut {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(-10px);
    }
    15% {
        opacity: 1;
        transform: scale(1.1) translateY(0);
    }
    85% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
    100% {
        opacity: 0;
        transform: scale(0.8) translateY(-5px);
    }
}

.alert-bell-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    background: #ef4444;
    border: 2px solid white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    pointer-events: none;
    animation: alertBellFadeInOut 4s ease-in-out forwards;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    /* Ensure badge doesn't affect parent layout - it's purely decorative */
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.alert-bell-badge i {
    color: white;
    font-size: 12px;
}

.screen.active {
    animation: fadeIn 0.3s ease-out;
}

/* Custom Map Marker Styles - Now uses custom image, so remove default styles */
.custom-marker {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    width: auto;
    height: auto;
    border-radius: 0;
}

.custom-marker::after {
    display: none;
}

.custom-marker img {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.device-marker {
    --marker-color: #FF385C;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: rotate(0deg);
    transform-origin: center center;
    pointer-events: auto;
    will-change: transform;
    /* Ensure container has fixed dimensions based on icon, not children */
    width: fit-content;
    height: fit-content;
    /* Prevent absolutely positioned children (like badges) from affecting layout */
    isolation: isolate;
    overflow: visible;
}

.device-marker-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: transparent;
    border: none;
    box-shadow: none;
}

.device-marker-icon img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: contain;
    display: block;
}

.device-marker--glyph .device-marker-icon {
    background: var(--marker-color);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.25);
}

.device-marker-glyph {
    color: #ffffff;
    font-size: 18px;
    line-height: 1;
}

.device-marker--has-image .device-marker-glyph {
    display: none;
}

.device-marker--low-speed .device-marker-icon {
    width: 24px;
    height: 24px;
    background: transparent;
    border: 3px solid var(--marker-color);
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(255, 56, 92, 0.2), 0 10px 20px rgba(0, 0, 0, 0.15);
    animation: blinkAdvanced 1.2s ease-in-out infinite;
    position: relative;
}

/* When using Font Awesome icon, style it properly */
.device-marker--low-speed .device-marker-icon i {
    animation: blinkAdvanced 1.2s ease-in-out infinite;
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    transform: rotate(0deg); /* Fixed at 0 degrees - no rotation */
    transform-origin: center center;
}

/* Font Awesome unicode icon support */
.device-marker--low-speed .device-marker-icon i[data-unicode] {
    font-family: 'Font Awesome 6 Free' !important;
    font-weight: 900 !important;
    font-style: normal !important;
    position: relative;
    transform: rotate(0deg); /* Fixed at 0 degrees - no rotation */
    transform-origin: center center;
}

.device-marker--low-speed .device-marker-icon i[data-unicode]::before {
    content: '\f05b'; /* Will be dynamically set via JavaScript, this is fallback for unicode f05b */
    font-family: 'Font Awesome 6 Free' !important;
    font-weight: 900 !important;
    font-style: normal !important;
    display: inline-block;
}

/* Hide border when using Font Awesome icon */
.device-marker--low-speed .device-marker-icon:has(i),
.device-marker--low-speed.device-marker--fa-icon .device-marker-icon {
    border: none;
    box-shadow: 0 0 0 4px rgba(255, 56, 92, 0.2), 0 10px 20px rgba(0, 0, 0, 0.15);
}

/* Target/bullseye effect for low-speed marker (transparent background, map shows through) */
/* Only show when NOT using custom image - hide pseudo-elements if image exists */
.device-marker--low-speed .device-marker-icon:not(:has(img))::before,
.device-marker--low-speed:not(.device-marker--has-image) .device-marker-icon::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    border: 2px solid #FFFFFF;
    border-radius: 50%;
    box-sizing: border-box;
    background: transparent;
}

.device-marker--low-speed .device-marker-icon:not(:has(img))::after,
.device-marker--low-speed:not(.device-marker--has-image) .device-marker-icon::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    border: 2px solid var(--marker-color);
    border-radius: 50%;
    box-sizing: border-box;
    background: transparent;
}

.device-marker--low-speed .device-marker-glyph {
    display: none;
}

@keyframes blinkAdvanced {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.35;
    }
}

/* Blinking dot marker for low speed */
.blinking-dot-marker {
    background: #ef4444 !important; /* Red color for low speed */
    border: none !important;
    box-shadow: none !important;
}

@keyframes blinkDot {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.3;
        transform: scale(0.8);
    }
}

/* Blinking animation for high-speed marker */
/* Blinking red LED animation for device location marker */
@keyframes blinkRedLED {
    0%, 100% {
        opacity: 1;
        filter: brightness(1);
    }
    50% {
        opacity: 0.4;
        filter: brightness(0.5);
    }
}

@keyframes blinkMarker {
    0%, 100% {
        opacity: 1;
        filter: brightness(1);
    }
    50% {
        opacity: 0.6;
        filter: brightness(1.3);
    }
}

.blinking-high-speed-marker {
    animation: blinkMarker 1.5s ease-in-out infinite !important;
    position: relative;
}

.directional-arrow-container {
    filter: drop-shadow(0 2px 4px rgba(59, 130, 246, 0.4));
}

/* Super User Interface Styles */
.super-user-container {
    grid-column: 1 / -1;
    width: 100%;
    min-height: calc(70vh - 100px);
    padding: 0 40px 40px 40px;
}

.super-user-header {
    text-align: center;
    margin-top: 0;
    margin-bottom: 15px;
    padding-top: 0;
}

.super-user-header h2 {
    font-size: 28px;
    color: #2d3748;
    margin: 0 0 10px 0;
}

.super-user-header .subtitle {
    color: #718096;
    font-size: 16px;
    margin: 0 0 30px 0;
}

.admin-status-modal-content {
    max-width: 1100px;
}

.admin-status-modal-header h2 {
    margin: 0;
    font-size: 20px;
    color: inherit;
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-status-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-status-refresh {
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
}

.admin-status-refresh:hover {
    background: rgba(255, 255, 255, 0.3);
}

.admin-status-tabs {
    display: flex;
    gap: 12px;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 4px;
}

.admin-status-tab {
    border: none;
    background: transparent;
    color: #6b7280;
    font-size: 14px;
    font-weight: 600;
    padding: 10px 6px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
}

.admin-status-tab.active {
    color: #1f2937;
    border-color: #6366f1;
}

.admin-status-body {
    min-height: 200px;
}
.admin-status-modal-content.history-modal-content .history-modal-body {
    padding-top: 6px;
}

.admin-status-users-header {
    margin-top: 6px;
    padding: 8px 12px;
}

.admin-status-tab-content {
    display: none;
}

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

.admin-status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.admin-status-grid-2x2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-status-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.admin-status-card h4 {
    margin: 0 0 8px 0;
    font-size: 15px;
    color: #1f2937;
}

.admin-status-card-system:nth-child(1) {
    background: #eff6ff;
    border-color: #bfdbfe;
}

.admin-status-card-system:nth-child(2) {
    background: #ecfdf3;
    border-color: #bbf7d0;
}

.admin-status-card-system:nth-child(3) {
    background: #fefce8;
    border-color: #fde68a;
}

.admin-status-card-system:nth-child(4) {
    background: #fdf2f8;
    border-color: #fbcfe8;
}

.admin-status-metric {
    font-size: 13px;
    color: #4b5563;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.admin-status-metric strong {
    color: #111827;
    white-space: nowrap;
}

.admin-status-subtext {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 4px;
}

.admin-status-cert-warning {
    font-size: 12px;
    color: #b45309;
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: 6px;
    padding: 6px 8px;
    margin-top: 6px;
}

.admin-status-cert-warning i {
    margin-right: 4px;
}

.admin-status-cert-actions {
    margin-top: 12px;
}

.admin-status-cert-renew-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #ffffff;
    color: #111827;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}

.admin-status-cert-renew-btn:hover:not(:disabled) {
    background: #f9fafb;
    border-color: #9ca3af;
}

.admin-status-cert-renew-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.admin-status-cert-result {
    margin-top: 10px;
    font-size: 12px;
    border-radius: 6px;
    padding: 8px 10px;
    line-height: 1.4;
}

.admin-status-cert-result.success {
    color: #166534;
    background: #ecfdf5;
    border: 1px solid #86efac;
}

.admin-status-cert-result.error {
    color: #991b1b;
    background: #fef2f2;
    border: 1px solid #fca5a5;
}

.admin-status-cert-note {
    margin-top: 8px;
}

.admin-status-filters {
    margin-top: 16px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.admin-status-filter label {
    display: block;
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 6px;
}

.admin-status-filter select {
    width: 100%;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    font-size: 13px;
    color: #111827;
    background: #ffffff;
}

.admin-status-users-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 18px;
    margin: 18px 0 12px 0;
    padding: 12px 14px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
}

.admin-status-users-header-colored {
    background: #f0f9ff;
    border-color: #bae6fd;
}

.admin-status-card-message:nth-child(1) {
    background: #f0fdf4;
    border-color: #bbf7d0;
}

.admin-status-card-message:nth-child(2) {
    background: #fef3c7;
    border-color: #fde68a;
}

.admin-status-card-message:nth-child(3) {
    background: #fee2e2;
    border-color: #fecaca;
}

.admin-status-grid-message .admin-status-card:nth-child(1) {
    background: #eef2ff;
    border-color: #c7d2fe;
}

.admin-status-grid-message .admin-status-card:nth-child(2) {
    background: #ecfeff;
    border-color: #a5f3fc;
}

.admin-status-grid-message .admin-status-card:nth-child(3) {
    background: #fdf2f8;
    border-color: #fbcfe8;
}

.admin-status-card-geo {
    background: #f5f3ff;
    border-color: #ddd6fe;
}

.admin-status-users-title {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 4px;
}

.admin-status-users-metric {
    font-size: 18px;
    font-weight: 600;
    color: #111827;
}

.admin-status-users-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #374151;
    margin-left: auto;
}

.admin-status-users-toggle input[type="checkbox"] {
    accent-color: #2563eb;
    cursor: pointer;
}

.admin-status-table-wrapper {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
}

.admin-status-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.admin-status-table thead {
    background: #f3f4f6;
}

.admin-status-table th,
.admin-status-table td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid #e5e7eb;
}

.admin-status-table tbody tr:last-child td {
    border-bottom: none;
}

.admin-status-table tbody tr.admin-status-session-active td {
    background: #ecfdf3;
}

.admin-status-table tbody tr.admin-status-session-active td:first-child {
    box-shadow: inset 4px 0 0 #22c55e;
}

.admin-status-sortable {
    cursor: pointer;
    user-select: none;
}

.admin-status-sortable i {
    margin-left: 6px;
    font-size: 12px;
    color: #6b7280;
}

.admin-status-empty {
    text-align: center;
    color: #6b7280;
    padding: 16px;
}

.search-container {
    position: relative;
    max-width: 500px;
    margin: 0 auto;
    margin-top: 0;
    margin-bottom: 0;
}

.search-container i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #718096;
}

.search-input {
    width: 100%;
    padding: 12px 45px 12px 45px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: white;
    box-sizing: border-box;
}

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

.user-search-clear {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px;
    color: #9ca3af;
    font-size: 14px;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    border-radius: 4px;
    z-index: 1;
    width: 24px;
    height: 24px;
    min-width: 24px;
}

.user-search-clear:hover {
    color: #ef4444;
    background: #fee2e2;
}

.user-search-clear:active {
    transform: translateY(-50%) scale(0.95);
}

.no-results-message {
    text-align: center;
    padding: 40px 20px;
    color: #718096;
}

.no-results-message p {
    font-size: 18px;
    margin: 0;
}

.loading-message, .error-message, .no-users-message {
    text-align: center;
    padding: 60px 20px;
}

.loading-message i, .error-message i, .no-users-message i {
    font-size: 48px;
    color: #667eea;
    margin-bottom: 20px;
}

.loading-message p, .error-message p, .no-users-message p {
    font-size: 18px;
    color: #718096;
}

.error-message i {
    color: #e53e3e;
}

.users-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.user-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 15px;
    border: 2px solid transparent;
}

.user-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    border-color: #667eea;
    transform: translateY(-2px);
}

.user-card-icon {
    width: 50px;
    height: 50px;
    background: rgba(249, 250, 251, 0.8);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    flex-shrink: 0;
}

.user-card-info {
    flex: 1;
    min-width: 0; /* Allow flex item to shrink below content size */
    overflow: hidden; /* Prevent overflow */
    cursor: pointer; /* Make it clear this area is clickable */
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 80px;
    left: 20px;
    z-index: 10002;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.toast {
    min-width: 320px;
    max-width: 500px;
    padding: 16px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideInLeft 0.3s ease-out;
    pointer-events: auto;
    background: white;
    border-left: 4px solid;
}

.toast.success {
    border-left-color: #10b981;
    background: linear-gradient(135deg, #ecfdf5 0%, #ffffff 100%);
}

.toast.error {
    border-left-color: #ef4444;
    background: linear-gradient(135deg, #fef2f2 0%, #ffffff 100%);
}

.toast.warning {
    border-left-color: #f59e0b;
    background: linear-gradient(135deg, #fffbeb 0%, #ffffff 100%);
}

.toast.info {
    border-left-color: #3b82f6;
    background: linear-gradient(135deg, #eff6ff 0%, #ffffff 100%);
}

.toast-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.toast.success .toast-icon {
    color: #10b981;
}

.toast.error .toast-icon {
    color: #ef4444;
}

.toast.warning .toast-icon {
    color: #f59e0b;
}

.toast.info .toast-icon {
    color: #3b82f6;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    font-size: 14px;
    color: #111827;
    margin-bottom: 4px;
}

.toast-message {
    font-size: 13px;
    color: #6b7280;
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    font-size: 18px;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.toast-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #374151;
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutLeft {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(-100%);
        opacity: 0;
    }
}

.toast.hiding {
    animation: slideOutLeft 5s ease-in forwards;
}

.device-marker .device-marker-image {
    width: 100%;
    height: 100%;
    transform-origin: center;
    transition: transform 0.2s ease;
}
.user-card-info h4 {
    margin: 0 0 5px 0;
    color: #2d3748;
    font-size: 16px;
    font-weight: 600;
}

.user-role {
    margin: 0 0 3px 0;
    color: #667eea;
    font-size: 13px;
    font-weight: 500;
    text-transform: capitalize;
}

.user-email {
    margin: 0;
    color: #718096;
    font-size: 12px;
}

.user-devices {
    margin: 5px 0 0 0;
    color: #667eea;
    font-size: 13px;
    font-weight: 600;
}

.user-card-action {
    color: #667eea;
    font-size: 20px;
    flex-shrink: 0;
}

.user-card:hover .user-card-action {
    transform: translateX(5px);
}

.user-card-actions {
    flex-shrink: 0; /* Prevent buttons from being pushed away */
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Responsive adjustments for user cards */
@media (max-width: 768px) {
    .users-grid {
        grid-template-columns: 1fr;
    }
}

/* Floating Devices Panel */
.devices-panel-floating {
    position: fixed;
    top: 80px;
    right: 20px;
    width: 320px;
    max-height: calc(100vh - 150px);
    background: rgba(255, 255, 255, 0.32);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    z-index: 9999;
    transition: transform 0.3s ease, width 0.3s ease;
    user-select: none;
    pointer-events: auto;
}

.devices-panel-floating .panel-header {
    padding: 16px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.25);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.92) 0%, rgba(14, 165, 233, 0.85) 100%);
    backdrop-filter: blur(10px);
    cursor: move;
    pointer-events: auto;
    touch-action: none;
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.25);
}

.devices-panel-floating .panel-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.devices-panel-floating .panel-toggle {
    padding: 6px 10px;
}

.devices-panel-floating .panel-header h3 {
    color: #f8fafc;
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    user-select: none;
}

.devices-panel-floating .panel-header .panel-hint {
    color: rgba(226, 232, 240, 0.9) !important;
}

.devices-panel-floating .panel-header .control-btn {
    background: rgba(255, 255, 255, 0.2);
    color: #f8fafc;
    box-shadow: none;
}

.devices-panel-floating .panel-header .control-btn:hover {
    background: rgba(255, 255, 255, 0.28);
}

.devices-panel-floating.is-collapsed {
    width: 56px;
    max-height: 56px;
}

.devices-panel-floating.is-collapsed .devices-list,
.devices-panel-floating.is-collapsed .panel-title,
.devices-panel-floating.is-collapsed .panel-hint,
.devices-panel-floating.is-collapsed #refreshDevicesBtn {
    display: none;
}

.devices-panel-floating.is-collapsed .panel-header {
    padding: 10px;
    justify-content: center;
}

.devices-panel-floating.is-collapsed .panel-actions {
    width: 100%;
    justify-content: center;
}

.devices-panel-floating .panel-header h3 i {
    font-size: 18px;
}

.devices-panel-floating .devices-list {
    max-height: calc(70vh - 100px);
    overflow-y: auto;
    padding: 12px;
}

.devices-panel-floating .device-item {
    padding: 12px;
    margin-bottom: 8px;
    background: rgba(247, 250, 252, 0.5);
    backdrop-filter: blur(5px);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.devices-panel-floating .device-item:hover {
    background: rgba(237, 242, 247, 0.7);
    transform: translateX(4px);
}

.devices-panel-floating .device-item.active {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-color: #667eea;
}

.devices-panel-floating .device-item.is-loading .device-name {
    position: relative;
    padding-right: 22px;
}

.devices-panel-floating .device-item.is-loading .device-name::after {
    content: '';
    position: absolute;
    top: 2px;
    right: 0;
    width: 12px;
    height: 12px;
    border: 2px solid rgba(102, 126, 234, 0.25);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: device-item-spinner 0.8s linear infinite;
}

@keyframes device-item-spinner {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

:root[data-device-highlight="glow"] .devices-panel-floating .device-item.active {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.12) 0%, rgba(118, 75, 162, 0.12) 100%);
    border-color: #667eea;
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.18);
}

:root[data-device-highlight="solid"] .devices-panel-floating .device-item.active {
    background: rgba(99, 102, 241, 0.16);
    border-color: #4f46e5;
    box-shadow: none;
}

:root[data-device-highlight="accent"] .devices-panel-floating .device-item.active {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(226, 232, 240, 0.9);
    box-shadow: inset 4px 0 0 rgba(56, 189, 248, 0.9);
}

.devices-panel-floating .device-name {
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 4px;
}

.devices-panel-floating .device-details {
    font-size: 12px;
    color: #718096;
    display: flex;
    align-items: center;
    gap: 8px;
}

.devices-panel-floating .device-status {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    margin-top: 6px;
}

.devices-panel-floating .device-status.has-signal {
    background: transparent;
    color: transparent;
}

.devices-panel-floating .device-status.no-signal {
    background: #fed7d7;
    color: #742a2a;
}

/* Signal Bars Styling */
.signal-bars {
    display: flex;
    align-items: flex-end;
    gap: 1.4px;
    height: 11.2px;
    border: none;
    padding: 0;
}

.signal-bar {
    width: 2.8px;
    background-color: #cbd5e0;
    border-radius: 1.4px;
    transition: background-color 0.2s ease;
}

.signal-bar.active {
    background-color: #48bb78;
}

.signal-bar.inactive {
    background-color: #e2e8f0;
}

.signal-bars-low .signal-bar.active {
    background-color: #e53e3e;
}

.signal-bars-medium .signal-bar.active {
    background-color: #f97316;
}

.signal-bars-zero {
    display: none;
}

@keyframes towerCriticalBlink {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.3;
        transform: scale(0.95);
    }
}

.signal-tower-critical {
    color: #e53e3e !important;
    animation: towerCriticalBlink 1.2s ease-in-out infinite;
}

/* LED Indicator Styling */
.led-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 
        0 0 4px currentColor,
        inset 0 0 2px rgba(255, 255, 255, 0.3);
}

.led-indicator.led-green {
    background-color: #48bb78;
    color: #48bb78;
}

.led-indicator.led-red {
    background-color: #F9CF16;
    color: #F9CF16;
    animation: towerCriticalBlink 1.2s ease-in-out infinite;
}

.history-modal-content {
    width: 90%;
    max-width: 1100px;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    box-sizing: border-box;
    margin: auto;
}

.history-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%);
    color: #ffffff;
    padding: 16px 20px;
}

.history-modal-header h2 {
    margin: 0;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.history-modal-header i {
    font-size: 16px;
}

.history-modal-header .close-modal {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
}

.history-modal-header .close-modal:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.history-modal-header .close-modal i {
    font-size: 16px;
    color: white;
}

.history-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.history-download-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    border: none;
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: background 0.2s ease, transform 0.2s ease;
}

.history-download-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.history-modal-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    min-height: 0;
}

.history-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    align-items: flex-end;
}

.history-filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.history-filter-group label {
    font-size: 13px;
    font-weight: 600;
    color: #1f2937;
}

.history-filter-group select,
.history-filter-group input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    color: #1f2937;
    background: #ffffff;
}

.history-filter-group input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.65;
    filter: invert(30%) sepia(12%) saturate(900%) hue-rotate(95deg) brightness(95%) contrast(92%);
    padding: 4px;
    border-radius: 6px;
    background-color: #f0fdf4;
    transition: background-color 0.2s ease, opacity 0.2s ease, transform 0.2s ease;
}

.history-filter-group input[type="datetime-local"]::-webkit-calendar-picker-indicator:hover {
    opacity: 0.9;
    background-color: #dcfce7;
    transform: translateY(-1px);
}

.history-filter-actions {
    display: flex;
    gap: 10px;
}


.history-apply-btn,
.history-reset-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.history-apply-btn {
    background: #0ea5e9;
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(14, 165, 233, 0.25);
}

.history-apply-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(14, 165, 233, 0.35);
}

.history-reset-btn {
    background: #f1f5f9;
    color: #1f2937;
    border: 1px solid #d1d5db;
}

.history-reset-btn:hover {
    background: #e2e8f0;
}

.history-table-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: auto;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #ffffff;
    min-height: 200px;
    max-height: 500px;
}

.history-table-container.admin-status-table-container {
    max-height: 420px;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
}

.history-table thead {
    background: #f8fafc;
    position: sticky;
    top: 0;
    z-index: 1;
}

.history-table th,
.history-table td {
    padding: 10px 12px;
    font-size: 13px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
    vertical-align: top;
}

.history-table th {
    font-weight: 700;
    color: #1f2937;
}

.history-table tbody tr:hover {
    background: #f8fafc;
}

.history-table .gps-acquired {
    color: #16a34a;
    font-weight: 600;
}

.history-table .gps-missing {
    color: #111827;
    font-size: 11px;
    font-weight: 500;
}

.history-table .history-signal-bars {
    justify-content: flex-start;
    gap: 2px;
}

.history-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex: 1;
    min-height: 0;
}

.history-pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

.history-page-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f1f5f9;
    color: #1f2937;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.history-page-btn:hover:not(:disabled) {
    background: #e2e8f0;
    transform: translateY(-1px);
}

.history-page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.history-page-info {
    font-size: 13px;
    color: #475569;
    font-weight: 600;
}

.history-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 40px;
    color: #475569;
    font-size: 14px;
}

.history-loading i {
    font-size: 24px;
    color: #0ea5e9;
}

.history-error {
    padding: 12px 16px;
    border-radius: 8px;
    background: #fee2e2;
    border: 1px solid #f87171;
    color: #b91c1c;
    font-size: 13px;
}

@media (max-width: 900px) {
    .history-filters {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    }
}

/* Playback Modal Styles */
.playback-modal {
    z-index: 30000 !important; /* Higher than other modals */
    /* Monitor frame effect */
    background: #1a1a1a;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 
        0 0 0 4px #2d2d2d,
        0 0 0 8px #1a1a1a,
        0 20px 60px rgba(0, 0, 0, 0.8),
        inset 0 0 40px rgba(0, 0, 0, 0.3);
}

.playback-modal-content {
    max-width: 95vw;
    max-height: 95vh;
    width: 1200px;
    height: 800px;
    display: flex;
    flex-direction: column;
    background: #0a0a0a;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 
        inset 0 0 20px rgba(0, 0, 0, 0.5),
        inset 0 2px 4px rgba(255, 255, 255, 0.1);
    position: relative;
}

/* Monitor bezel effect */
.playback-modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(to bottom, #2a2a2a 0%, #1a1a1a 100%);
    border-bottom: 2px solid #0a0a0a;
    z-index: 10;
    pointer-events: none;
}

/* Monitor stand/base effect */
.playback-modal::after {
    content: '';
    position: absolute;
    bottom: -60px;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 60px;
    background: linear-gradient(to bottom, #2d2d2d 0%, #1a1a1a 100%);
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.playback-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 2px solid #2d2d2d;
    background: linear-gradient(to bottom, #1a1a1a 0%, #0f0f0f 100%);
    position: relative;
    z-index: 11;
    /* Monitor screen glow effect */
    box-shadow: 0 2px 10px rgba(0, 150, 255, 0.1);
}

.playback-modal-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #00d4ff;
    display: flex;
    align-items: center;
    gap: 10px;
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}

.playback-modal-header i {
    color: #00d4ff;
    text-shadow: 0 0 8px rgba(0, 212, 255, 0.6);
}

.playback-modal-header .close-modal {
    background: #1a1a1a;
    border: 1px solid #2d2d2d;
    font-size: 18px;
    cursor: pointer;
    color: #00d4ff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
    margin: 0;
}

.playback-modal-header .close-modal:hover {
    background: #2a2a2a;
    border-color: #00d4ff;
    color: #00d4ff;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.3);
    transform: rotate(90deg);
}

.playback-modal-header .close-modal:active {
    transform: scale(0.95);
}

.playback-modal-header .close-modal i {
    color: inherit;
    font-size: 16px;
}

.playback-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.playback-modal-header .history-download-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    border: none;
    background: rgba(0, 212, 255, 0.1);
    color: #00d4ff;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    border: 1px solid rgba(0, 212, 255, 0.3);
}

.playback-modal-header .history-download-btn:hover {
    background: rgba(0, 212, 255, 0.2);
    border-color: #00d4ff;
    transform: translateY(-1px);
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.3);
}

.playback-modal-header .history-download-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.download-dropdown {
    position: relative;
}

.download-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 5px;
    background: #1a1a1a;
    border: 1px solid #2d2d2d;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    min-width: 220px;
    z-index: 1000;
    overflow: hidden;
}

.download-option {
    width: 100%;
    padding: 12px 16px;
    background: transparent;
    border: none;
    color: #ffffff;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 14px;
    transition: background-color 0.2s;
    min-height: 60px;
}

.download-option:hover {
    background: #2d2d2d;
}

.download-option i {
    width: 18px;
    color: #00d4ff;
}

.playback-modal-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    background: #000000;
    position: relative;
    /* Screen glow effect */
    box-shadow: inset 0 0 30px rgba(0, 150, 255, 0.1);
}

.playback-map-container {
    flex: 1;
    min-height: 0;
    width: 100%;
    position: relative;
}

.playback-info-panel {
    display: flex;
    gap: 20px;
    padding: 12px 24px;
    background: #0a0a0a;
    border-top: 2px solid #2d2d2d;
    border-bottom: 2px solid #2d2d2d;
    flex-wrap: wrap;
    /* Subtle screen glow */
    box-shadow: 0 -2px 10px rgba(0, 150, 255, 0.05);
}

.playback-info-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #00d4ff;
}

.playback-info-item i {
    color: #00a8cc;
    width: 16px;
    text-align: center;
}

.playback-info-item span {
    font-weight: 500;
    text-shadow: 0 0 5px rgba(0, 212, 255, 0.3);
}

.playback-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px 24px;
    background: #0a0a0a;
    border-bottom: 2px solid #2d2d2d;
    gap: 20px;
    flex-wrap: wrap;
    /* Subtle screen glow */
    box-shadow: 0 2px 10px rgba(0, 150, 255, 0.05);
}

.playback-control-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.playback-control-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 1px solid #2d2d2d;
    border-radius: 8px;
    background: #1a1a1a;
    color: #00d4ff;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 16px;
}

.playback-control-btn:hover:not(:disabled) {
    background: #2a2a2a;
    border-color: #00d4ff;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.3);
    transform: translateY(-1px);
}

.playback-control-btn:active:not(:disabled) {
    transform: translateY(0);
}

.playback-control-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.playback-control-btn.primary {
    background: #0066cc;
    border-color: #00d4ff;
    color: #00d4ff;
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.4);
}

.playback-control-btn.primary:hover:not(:disabled) {
    background: #0088ff;
    border-color: #00d4ff;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.6);
}

.playback-speed-select {
    padding: 8px 12px;
    border: 1px solid #2d2d2d;
    border-radius: 6px;
    background: #1a1a1a;
    color: #00d4ff;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.playback-speed-select:hover {
    border-color: #00d4ff;
    box-shadow: 0 0 8px rgba(0, 212, 255, 0.2);
}

.playback-speed-select:focus {
    outline: none;
    border-color: #00d4ff;
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.2);
}

.playback-progress-container {
    padding: 16px 24px;
    background: #0a0a0a;
    border-top: 2px solid #2d2d2d;
}

.playback-progress-bar {
    width: 100%;
    height: 8px;
    background: #1a1a1a;
    border: 1px solid #2d2d2d;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.playback-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #0066cc 0%, #00d4ff 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}

.playback-progress-info {
    display: flex;
    justify-content: center;
    font-size: 13px;
    color: #00d4ff;
    font-weight: 500;
    text-shadow: 0 0 5px rgba(0, 212, 255, 0.3);
}

/* Playback marker animation */
@keyframes playback-marker-pulse {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 0.8;
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

.playback-marker-active {
    animation: playback-marker-pulse 1.5s ease-in-out infinite;
    z-index: 1000 !important;
}

/* Battery Indicator Styling (iPhone-style) */
.battery-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 16px;
}

.battery-container {
    position: relative;
    width: 24px;
    height: 12px;
    border: 1.5px solid #718096;
    border-radius: 2px;
    background: transparent;
    display: inline-block;
    transition: border-color 0.3s ease;
}

.battery-container::after {
    content: '';
    position: absolute;
    right: -3px;
    top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 6px;
    background: #718096;
    border-radius: 0 1px 1px 0;
    transition: background-color 0.3s ease;
}

.battery-container.critical {
    border-color: #e53e3e;
    box-shadow: 0 0 0 2px rgba(229, 62, 62, 0.5);
    animation: battery-outline-flash 1s infinite;
}

.battery-container.critical::after {
    background: #e53e3e;
}

@keyframes battery-outline-flash {
    0%, 50% {
        border-color: #e53e3e;
        box-shadow: 0 0 0 2px rgba(229, 62, 62, 0.8);
    }
    25%, 75% {
        border-color: rgba(229, 62, 62, 0.4);
        box-shadow: 0 0 0 2px rgba(229, 62, 62, 0.2);
    }
}

.battery-fill {
    position: absolute;
    left: 1px;
    top: 1px;
    bottom: 1px;
    border-radius: 1px;
    background-color: #48bb78;
    transition: width 0.3s ease, background-color 0.3s ease;
}

.battery-fill.low {
    background-color: #e53e3e;
    animation: battery-flash 1s infinite;
}

@keyframes battery-flash {
    0%, 50% {
        opacity: 1;
    }
    25%, 75% {
        opacity: 0.4;
    }
}

/* Make map full width when floating panel is present */
.dashboard-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.map-container {
    width: 100%;
    flex: 1;
    overflow: hidden;
    border-radius: 12px;
    margin-bottom: 24px;
}

.map {
    height: calc(100vh - 170px);
    min-height: 500px;
    border-radius: 12px;
    overflow: hidden;
}

/* Responsive adjustments for floating panel */
@media (max-width: 768px) {
    .devices-panel-floating {
        width: 280px;
        max-height: calc(100vh - 180px);
    }
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20000;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: modalFadeIn 0.3s ease;
}

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

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px 12px 0 0;
    flex-shrink: 0;
}

.modal-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-header .close-modal {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
}

.modal-header .close-modal:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* Apply hover animation to all modal-close buttons (for inline-styled buttons) */
.modal-close:hover {
    transform: rotate(90deg) !important;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

/* Footer Styles */
.site-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 20px;
    text-align: center;
    font-size: 13px;
    z-index: 999;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.footer-content {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.footer-copyright {
    font-weight: 600;
    letter-spacing: 0.5px;
    font-size: 11px;
}

.footer-divider {
    color: rgba(255, 255, 255, 0.5);
    margin: 0 4px;
}

.footer-link {
    color: white;
    text-decoration: none;
    transition: opacity 0.3s ease;
}

.footer-link:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* Adjust body to account for footer */
body {
    padding-bottom: 50px;
}

/* Responsive footer */
@media (max-width: 768px) {
    .site-footer {
        font-size: 11px;
        padding: 10px 15px;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 4px;
    }
    
    .footer-divider {
        display: none;
    }
    
    body {
        padding-bottom: 70px;
    }
}

/* Team Activity Modal Styles */
.modal-content.large {
    max-width: 1200px;
    width: 95%;
}

/* Confirmation Modal Styles */
.confirm-modal-content {
    max-width: 450px;
    width: 90%;
    text-align: center;
    padding: 0;
}

.confirm-modal-icon {
    padding: 24px 24px 16px;
    color: #f59e0b;
}

.confirm-modal-icon i {
    font-size: 48px;
}

.confirm-modal-content h2 {
    margin: 0 24px 12px;
    font-size: 22px;
    font-weight: 600;
    color: #1f2937;
}

.confirm-modal-content p {
    margin: 0 24px 24px;
    font-size: 15px;
    color: #6b7280;
    line-height: 1.5;
}

.confirm-modal-actions {
    padding: 16px 24px 24px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    border-top: 1px solid #e5e7eb;
}

.confirm-modal-actions .btn {
    min-width: 100px;
    padding: 10px 20px;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.confirm-modal-actions .btn-danger {
    background: #ef4444;
    color: white;
    border: none;
}

.confirm-modal-actions .btn-danger:hover {
    background: #dc2626;
}

.confirm-modal-actions .btn-secondary {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
}

.confirm-modal-actions .btn-secondary:hover {
    background: #e5e7eb;
}

.modal-filters {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 24px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    flex-wrap: wrap;
}

.modal-filters label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
}

.modal-filters select {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: white;
    font-size: 14px;
    color: #111827;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.modal-filters select:hover {
    border-color: #9ca3af;
}

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

/* Team Activity Content Styles */
.team-activity-section {
    margin-bottom: 32px;
}

.team-activity-section:last-child {
    margin-bottom: 0;
}

.team-activity-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 16px 0;
    color: #111827;
    font-size: 18px;
    font-weight: 600;
}

.team-activity-section-title i {
    font-size: 16px;
}

.team-activity-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.team-activity-card {
    padding: 20px;
    border-radius: 8px;
    color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.team-activity-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.team-activity-card-label {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 8px;
}

.team-activity-card-value {
    font-size: 32px;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 8px;
}

.team-activity-card-subtext {
    font-size: 13px;
    opacity: 0.8;
    margin-top: 4px;
}

.team-activity-card.aliases {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.team-activity-card.viewers {
    background: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%);
}

.team-activity-card.logins {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.team-activity-table-container {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}

.team-activity-table {
    width: 100%;
    border-collapse: collapse;
}

.team-activity-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.team-activity-table th {
    padding: 14px 16px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #764ba2;
}

.team-activity-table th.team-activity-sortable-header {
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: background-color 0.2s ease;
    white-space: nowrap;
}

.team-activity-table th.team-activity-sortable-header:hover {
    background: linear-gradient(135deg, #7c8ef5 0%, #8a5fc7 100%);
}

.team-activity-table th.team-activity-sortable-header .sort-icon {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
    opacity: 0.6;
    transition: opacity 0.2s ease, color 0.2s ease;
    display: inline-block;
    margin-left: 6px;
    vertical-align: middle;
}

.team-activity-table th.team-activity-sortable-header:hover .sort-icon {
    opacity: 1;
    color: rgba(255, 255, 255, 1);
}

.team-activity-table th.team-activity-sortable-header.team-activity-sort-asc .sort-icon,
.team-activity-table th.team-activity-sortable-header.team-activity-sort-desc .sort-icon {
    opacity: 1;
    color: rgba(255, 255, 255, 1);
}

.team-activity-table th.team-activity-sortable-header.team-activity-sort-asc .sort-icon::before {
    content: '\f0de'; /* fa-sort-up */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
}

.team-activity-table th.team-activity-sortable-header.team-activity-sort-desc .sort-icon::before {
    content: '\f0dd'; /* fa-sort-down */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
}

.team-activity-table th.center {
    text-align: center;
}

.team-activity-table tbody tr {
    background: #ffffff;
    transition: background 0.2s;
}

.team-activity-table tbody tr:nth-child(even) {
    background: #f9fafb;
}

.team-activity-table tbody tr:hover {
    background: #f3f4f6;
}

.team-activity-table td {
    padding: 12px;
    font-size: 14px;
    color: #111827;
    border-bottom: 1px solid #e5e7eb;
}

.team-activity-table td.center {
    text-align: center;
}

.team-activity-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.team-activity-badge.alias {
    background: #f59e0b;
    color: white;
}

.team-activity-badge.viewer {
    background: #10b981;
    color: white;
}

.team-activity-badge.user {
    background: #5a67d8;
    color: white;
}

.team-activity-empty-state {
    text-align: center;
    padding: 40px;
    color: #6b7280;
    background: #f9fafb;
    border-radius: 8px;
}

.team-activity-empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.team-activity-empty-state p {
    font-size: 16px;
    margin: 0 0 8px 0;
    color: #374151;
}

.team-activity-empty-state p:last-child {
    font-size: 14px;
    color: #6b7280;
    margin-top: 8px;
}

.team-activity-error-state {
    text-align: center;
    padding: 40px;
    color: #ef4444;
}

.team-activity-error-state i {
    font-size: 48px;
    margin-bottom: 16px;
}

.team-activity-error-state p {
    font-size: 16px;
    margin: 0 0 8px 0;
}

.team-activity-error-state p:last-child {
    font-size: 14px;
    color: #6b7280;
    margin-top: 8px;
}

.team-activity-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px;
    color: #6b7280;
}

.team-activity-loading i {
    font-size: 32px;
    margin-bottom: 16px;
    animation: spin 1s linear infinite;
}

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

.team-activity-loading p {
    font-size: 16px;
    margin: 0;
}

.team-activity-username {
    font-weight: 500;
    color: #111827;
}

.team-activity-email {
    color: #6b7280;
}

/* Geofence Modal Styles */
.geofence-modal-content {
    max-width: 1200px;
    width: 95%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.geofence-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.geofence-modal-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #111827;
    display: flex;
    align-items: center;
    gap: 10px;
}

.geofence-modal-header h2 i {
    color: #10b981;
}

.geofence-modal-header .close-modal {
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    font-size: 18px;
    cursor: pointer;
    color: #6b7280;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
    margin: 0;
}

.geofence-modal-header .close-modal:hover {
    background: #ef4444;
    border-color: #ef4444;
    color: white;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
    transform: rotate(90deg);
}

.geofence-modal-header .close-modal:active {
    transform: scale(0.95);
}

.geofence-modal-header .close-modal i {
    color: inherit;
    font-size: 16px;
}

.geofence-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.geofence-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 2px solid #e5e7eb;
}

.geofence-tab {
    padding: 12px 24px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #6b7280;
    transition: all 0.2s;
    margin-bottom: -2px;
}

.geofence-tab:hover {
    color: #10b981;
}

.geofence-tab.active {
    color: #10b981;
    border-bottom-color: #10b981;
}

.geofence-tab-content {
    display: none;
}

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

.geofence-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.geofence-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Compact 2-column layout for form fields */
.geofence-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* Full-width fields (map, actions) */
.geofence-form .form-group.full-width,
.geofence-form .geofence-map-container,
.geofence-form .form-actions {
    grid-column: 1 / -1;
}

/* Responsive: stack on smaller screens */
@media (max-width: 768px) {
    .geofence-form .form-row {
        grid-template-columns: 1fr;
    }
}

.geofence-form .form-group label {
    font-weight: 500;
    color: #374151;
    font-size: 14px;
}

.geofence-form .form-group input,
.geofence-form .form-group select {
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.geofence-form .form-group input:focus,
.geofence-form .form-group select:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.geofence-form .form-group small {
    font-size: 12px;
    color: #6b7280;
    margin-top: -4px;
}

/* Checkbox groups for Status Change alerts */
.geofence-form .checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-top: 8px;
}

.geofence-form .checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: background-color 0.2s;
}

.geofence-form .checkbox-label:hover {
    background: #f3f4f6;
}

.geofence-form .checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    margin: 0;
    flex-shrink: 0;
}

.geofence-form .checkbox-label span {
    font-size: 14px;
    color: #374151;
    line-height: 1.5;
    user-select: none;
}

.geofence-map-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.geofence-map-container label {
    font-weight: 500;
    color: #374151;
    font-size: 14px;
}

.geofence-address-search {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.geofence-address-input-group {
    display: flex;
    gap: 8px;
}

.geofence-address-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.geofence-address-input:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.geofence-address-search-btn {
    padding: 10px 16px;
    background: #10b981;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.geofence-address-search-btn:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
}

.geofence-address-search-btn:active {
    transform: translateY(0);
}

.geofence-address-search-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
}

.geofence-address-status {
    font-size: 13px;
    min-height: 20px;
    padding: 4px 0;
}

.geofence-address-status.success {
    color: #059669;
}

.geofence-address-status.error {
    color: #ef4444;
}

.geofence-address-status.loading {
    color: #6b7280;
}

.geofence-map-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 8px 0;
    color: #6b7280;
    font-size: 12px;
    font-weight: 500;
}

.geofence-map-divider::before,
.geofence-map-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #e5e7eb;
}

.geofence-map-divider span {
    padding: 0 12px;
}

.geofence-map {
    width: 100%;
    height: 400px;
    border-radius: 8px;
    border: 2px solid #d1d5db;
    overflow: hidden;
}

.geofence-map-info {
    padding: 12px;
    background: #f3f4f6;
    border-radius: 6px;
    font-size: 13px;
    color: #6b7280;
}

.geofence-map-info p {
    margin: 0;
}

.geofence-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px;
    color: #6b7280;
}

.geofence-loading i {
    font-size: 32px;
    margin-bottom: 16px;
    animation: spin 1s linear infinite;
}

.geofence-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.geofence-item {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
}

.geofence-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-color: #10b981;
}

.geofence-item-info {
    flex: 1;
}

.geofence-item-name {
    font-weight: 600;
    color: #111827;
    font-size: 16px;
    margin-bottom: 4px;
}

.geofence-item-details {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 13px;
    color: #6b7280;
}

.geofence-item-detail {
    display: flex;
    align-items: center;
    gap: 4px;
}

.geofence-item-detail i {
    color: #10b981;
}

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

.geofence-item-action {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.geofence-item-action:hover {
    background: #f3f4f6;
}

.geofence-item-action.delete {
    color: #ef4444;
    border-color: #ef4444;
}

.geofence-item-action.delete:hover {
    background: #fee2e2;
}

.geofence-item-status {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    margin-left: 8px;
}

.geofence-item-status.active {
    background: #d1fae5;
    color: #065f46;
}

.geofence-item-status.inactive {
    background: #fee2e2;
    color: #991b1b;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #e5e7eb;
}

.geofence-empty {
    text-align: center;
    padding: 60px;
    color: #6b7280;
}

.geofence-empty i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.geofence-empty p {
    font-size: 16px;
    margin: 0;
}

.geofence-error {
    text-align: center;
    padding: 40px;
    color: #ef4444;
}

.geofence-error i {
    font-size: 48px;
    margin-bottom: 16px;
}

.geofence-error p {
    font-size: 16px;
    margin: 0;
}

.team-activity-ip {
    font-family: monospace;
    color: #6b7280;
    font-size: 13px;
}

.team-activity-login-count {
    font-weight: 600;
    color: #111827;
}

.team-activity-timestamp {
    color: #6b7280;
    font-size: 13px;
}

.team-activity-never {
    color: #9ca3af;
    font-style: italic;
}

/* Responsive Team Activity Modal */
@media (max-width: 768px) {
    .modal-content.large {
        width: 98%;
        max-height: 95vh;
    }
    
    .team-activity-cards {
        grid-template-columns: 1fr;
    }
    
    .team-activity-table-container {
        overflow-x: auto;
    }
    
    .team-activity-table {
        min-width: 600px;
    }
    
    .modal-filters {
        flex-direction: column;
        align-items: stretch;
    }
    
    .modal-filters label {
        width: 100%;
    }
    
    .modal-filters select {
        width: 100%;
    }
}

/* Subscription Management Modal Styles */
.subscription-modal {
    display: flex;
    align-items: center;
    justify-content: center;
}

.subscription-modal-content {
    width: 95%;
    max-width: 1400px;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    box-sizing: border-box;
    margin: auto;
    background: white;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.subscription-actions-modal-content {
    width: 90%;
    max-width: 700px;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 85vh;
    box-sizing: border-box;
    margin: auto;
    background: white;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.subscription-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    padding: 20px 24px;
}

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

.subscription-modal-header i {
    font-size: 18px;
}

.subscription-modal-header .close-modal {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
}

.subscription-modal-header .close-modal:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.subscription-modal-header .close-modal i {
    font-size: 16px;
    color: white;
}

.subscription-modal-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    min-height: 0;
    background: #f9fafb;
}

.subscription-filters {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
    background: white;
    padding: 16px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.subscription-search-wrapper {
    position: relative;
    flex: 1;
    min-width: 250px;
}

.subscription-search-input {
    width: 100%;
    padding: 10px 40px 10px 14px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
    font-family: inherit;
}

.subscription-search-input:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.subscription-search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    color: #9ca3af;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    border-radius: 4px;
}

.subscription-search-clear:hover {
    color: #ef4444;
    background: #fee2e2;
}

.subscription-search-clear:active {
    transform: translateY(-50%) scale(0.95);
}

.subscription-filter-select {
    padding: 10px 14px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    min-width: 160px;
}

#subscriptionSortOrder {
    min-width: 120px;
}

.subscription-filter-select:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.subscription-refresh-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.3);
}

.subscription-refresh-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(16, 185, 129, 0.4);
}

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

.subscription-refresh-btn i {
    font-size: 14px;
}

.subscription-create-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

.subscription-create-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.4);
}

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

.subscription-create-btn i {
    font-size: 14px;
}

.subscription-table-container {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow-x: auto;
    overflow-y: auto;
    max-height: calc(90vh - 300px);
}

.subscription-table {
    width: 100%;
    min-width: 1200px;
    border-collapse: collapse;
}

.subscription-table thead {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
}

.subscription-table th {
    padding: 14px 16px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: #166534;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #10b981;
}

.subscription-table th.sortable-header {
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: background-color 0.2s ease;
    white-space: nowrap; /* Prevent text wrapping */
    font-size: 13px; /* Base font size */
}

/* Responsive font sizing to allow text to shrink when needed */
@media (max-width: 1600px) {
    .subscription-table th.sortable-header {
        font-size: 12px;
    }
}

@media (max-width: 1400px) {
    .subscription-table th.sortable-header {
        font-size: 11px;
    }
}

@media (max-width: 1200px) {
    .subscription-table th.sortable-header {
        font-size: 10px;
    }
}

.subscription-table th.sortable-header:hover {
    background-color: rgba(16, 185, 129, 0.1);
}

.subscription-table th.sortable-header .sort-icon {
    font-size: 11px;
    color: #9ca3af;
    opacity: 0.6;
    transition: opacity 0.2s ease, color 0.2s ease;
    display: inline-block;
    margin-left: 6px;
    vertical-align: middle;
}

.subscription-table th.sortable-header:hover .sort-icon {
    opacity: 1;
    color: #166534;
}

.subscription-table th.sortable-header.sort-asc .sort-icon,
.subscription-table th.sortable-header.sort-desc .sort-icon {
    opacity: 1;
    color: #166534;
}

.subscription-table th.sortable-header.sort-asc .sort-icon::before {
    content: '\f0de'; /* fa-sort-up */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
}

.subscription-table th.sortable-header.sort-desc .sort-icon::before {
    content: '\f0dd'; /* fa-sort-down */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
}

/* Device table sortable headers (similar to subscription table) */
#devicesTable th.device-sortable-header {
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: background-color 0.2s ease;
}

#devicesTable th.device-sortable-header:hover {
    background-color: rgba(16, 185, 129, 0.1);
}

#devicesTable th.device-sortable-header .sort-icon {
    font-size: 11px;
    color: #9ca3af;
    opacity: 0.6;
    transition: opacity 0.2s ease, color 0.2s ease;
    display: inline-block;
    margin-left: 6px;
    vertical-align: middle;
}

#devicesTable th.device-sortable-header:hover .sort-icon {
    opacity: 1;
    color: #166534;
}

#devicesTable th.device-sortable-header.device-sort-asc .sort-icon,
#devicesTable th.device-sortable-header.device-sort-desc .sort-icon {
    opacity: 1;
    color: #166534;
}

#devicesTable th.device-sortable-header.device-sort-asc .sort-icon::before {
    content: '\f0de'; /* fa-sort-up */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
}

#devicesTable th.device-sortable-header.device-sort-desc .sort-icon::before {
    content: '\f0dd'; /* fa-sort-down */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
}

.subscription-table th.actions-column {
    text-align: center;
    min-width: 280px;
    width: 280px;
}

.subscription-table tbody tr {
    border-bottom: 1px solid #e5e7eb;
    transition: background 0.15s ease;
}

.subscription-table tbody tr:hover {
    background: #f9fafb;
}

.subscription-table tbody tr:last-child {
    border-bottom: none;
}

.subscription-table td {
    padding: 14px 16px;
    font-size: 14px;
    color: #374151;
    white-space: nowrap; /* Prevent text wrapping */
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Responsive font sizing for table cells to prevent wrapping */
@media (max-width: 1600px) {
    .subscription-table td {
        font-size: 13px;
    }
}

@media (max-width: 1400px) {
    .subscription-table td {
        font-size: 12px;
    }
}

@media (max-width: 1200px) {
    .subscription-table td {
        font-size: 11px;
    }
}

.subscription-table td.actions-column {
    text-align: center;
    min-width: 280px;
    width: 280px;
}

.subscription-table .status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
}

.subscription-table .status-active {
    background: #d1fae5;
    color: #065f46;
}

.subscription-table .status-expired {
    background: #fee2e2;
    color: #991b1b;
}

.subscription-table .status-cancelled {
    background: #f3f4f6;
    color: #374151;
}

.subscription-table .status-pending {
    background: #fef3c7;
    color: #92400e;
}

.subscription-table .action-btn-group {
    display: flex;
    gap: 6px;
    justify-content: center;
    flex-wrap: nowrap;
    min-width: fit-content;
}

.subscription-table .action-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    white-space: nowrap;
}

.subscription-table .action-btn.btn-update {
    background: #3b82f6;
    color: white;
}

.subscription-table .action-btn.btn-update:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

.subscription-table .action-btn.btn-extend {
    background: #10b981;
    color: white;
}

.subscription-table .action-btn.btn-extend:hover {
    background: #059669;
    transform: translateY(-1px);
}

.subscription-table .action-btn.btn-notify {
    background: #f59e0b;
    color: white;
}

.subscription-table .action-btn.btn-notify:hover {
    background: #d97706;
    transform: translateY(-1px);
}

.subscription-loading {
    padding: 40px 20px;
    text-align: center;
    color: #9ca3af;
    font-size: 14px;
}

.subscription-loading i {
    margin-right: 8px;
    color: #10b981;
}

.subscription-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.subscription-pagination-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.subscription-pagination-btn:hover:not(:disabled) {
    background: #f9fafb;
    border-color: #10b981;
    color: #10b981;
}

.subscription-pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.subscription-page-info {
    font-size: 14px;
    font-weight: 600;
    color: #6b7280;
    padding: 0 12px;
}

/* Subscription Actions Modal Content */
#subscriptionActionContent {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.subscription-action-info {
    background: #f0fdf4;
    border: 1px solid #d1fae5;
    border-radius: 8px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.subscription-action-info p {
    margin: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.subscription-action-info strong {
    color: #166534;
    font-weight: 600;
}

.subscription-action-info span {
    color: #374151;
}

.subscription-action-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.subscription-action-section h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    padding-bottom: 12px;
    border-bottom: 2px solid #e5e7eb;
}

.subscription-action-form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.subscription-action-form-group label {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
}

.subscription-action-form-group input,
.subscription-action-form-group select,
.subscription-action-form-group textarea {
    padding: 10px 14px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s ease;
    resize: vertical;
}

.subscription-action-form-group select {
    min-height: auto;
    height: auto;
    line-height: 1.5;
    padding-top: 10px;
    padding-bottom: 10px;
}

.subscription-action-form-group textarea {
    min-height: 80px;
}

.subscription-action-form-group small {
    display: block;
    color: #6b7280;
    font-size: 12px;
    margin-top: 4px;
}

.subscription-action-form-group input:focus,
.subscription-action-form-group select:focus,
.subscription-action-form-group textarea:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.subscription-action-btn {
    padding: 12px 24px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.3);
}

.subscription-action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(16, 185, 129, 0.4);
}

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

.subscription-action-message {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    margin-top: 12px;
}

.subscription-action-message.success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #10b981;
}

.subscription-action-message.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #ef4444;
}

/* Responsive Subscription Modal */
@media (max-width: 768px) {
    .subscription-modal-content {
        width: 98%;
        max-height: 95vh;
    }
    
    .subscription-filters {
        flex-direction: column;
    }
    
    .subscription-search-wrapper {
        width: 100%;
        min-width: unset;
    }
    
    .subscription-search-input,
    .subscription-filter-select {
        width: 100%;
        min-width: unset;
    }
    
    .subscription-table-container {
        overflow-x: auto;
    }
    
    .subscription-table {
        min-width: 800px;
    }
    
    .subscription-pagination {
        flex-direction: column;
        gap: 12px;
    }
    
    .subscription-pagination-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Device Management Modal Styles (similar to subscription modal) */
.device-modal {
    display: flex;
    align-items: center;
    justify-content: center;
}

.device-modal-content {
    width: 95%;
    max-width: 1400px;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    box-sizing: border-box;
    margin: auto;
    background: white;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.device-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    padding: 20px 24px;
}

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

.device-modal-header i {
    font-size: 18px;
}

.device-modal-header .close-modal {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
}

.device-modal-header .close-modal:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.device-modal-header .close-modal i {
    font-size: 16px;
    color: white;
}

.device-modal-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    min-height: 0;
    background: #f9fafb;
}

.device-filters {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
    background: white;
    padding: 16px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.device-search-wrapper {
    position: relative;
    flex: 1;
    min-width: 250px;
}

.device-search-input {
    width: 100%;
    padding: 10px 40px 10px 14px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
    font-family: inherit;
}

.device-search-input:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.device-search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    color: #9ca3af;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    border-radius: 4px;
}

.device-search-clear:hover {
    color: #ef4444;
    background: #fee2e2;
}

.device-search-clear:active {
    transform: translateY(-50%) scale(0.95);
}

.device-create-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

.device-create-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.4);
}

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

.device-create-btn i {
    font-size: 14px;
}

.device-table-container {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow-x: auto;
    overflow-y: auto;
    max-height: calc(90vh - 300px);
}

.device-table {
    width: 100%;
    min-width: 1000px;
    border-collapse: collapse;
}

.device-table thead {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
}

.device-table th {
    padding: 14px 16px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: #166534;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #10b981;
}

.device-table th.device-sortable-header {
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: background-color 0.2s ease;
    white-space: nowrap;
}

.device-table th.device-sortable-header:hover {
    background-color: rgba(16, 185, 129, 0.1);
}

.device-table th.device-sortable-header .sort-icon {
    font-size: 11px;
    color: #9ca3af;
    opacity: 0.6;
    transition: opacity 0.2s ease, color 0.2s ease;
    display: inline-block;
    margin-left: 6px;
    vertical-align: middle;
}

.device-table th.device-sortable-header:hover .sort-icon {
    opacity: 1;
    color: #166534;
}

.device-table th.device-sortable-header.sort-asc .sort-icon,
.device-table th.device-sortable-header.sort-desc .sort-icon {
    opacity: 1;
    color: #166534;
}

.device-table th.device-sortable-header.sort-asc .sort-icon::before {
    content: '\f0de'; /* fa-sort-up */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
}

.device-table th.device-sortable-header.sort-desc .sort-icon::before {
    content: '\f0dd'; /* fa-sort-down */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
}

.device-table tbody tr {
    border-bottom: 1px solid #e5e7eb;
    transition: background-color 0.15s ease;
}

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

.device-table tbody tr:last-child {
    border-bottom: none;
}

.device-table td {
    padding: 14px 16px;
    font-size: 14px;
    color: #374151;
    vertical-align: middle;
}

.device-table th.actions-column {
    text-align: center;
    min-width: 280px;
    width: 280px;
}

.device-table td.actions-column {
    text-align: center;
    min-width: 280px;
    width: 280px;
}

.device-table .action-btn-group {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
}

.device-table .action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.device-table .action-btn.btn-edit {
    background: #10b981;
    color: white;
}

.device-table .action-btn.btn-edit:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.3);
}

.device-table .action-btn.btn-reassign {
    background: #3b82f6;
    color: white;
}

.device-table .action-btn.btn-reassign:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

/* Responsive Device Modal */
@media (max-width: 768px) {
    .device-modal-content {
        width: 98%;
        max-height: 95vh;
    }
    
    .device-filters {
        flex-direction: column;
    }
    
    .device-search-wrapper {
        width: 100%;
        min-width: unset;
    }
    
    .device-search-input {
        width: 100%;
        min-width: unset;
    }
    
    .device-table-container {
        overflow-x: auto;
    }
    
    .device-table {
        min-width: 800px;
    }
}

/* Delete History Modal Styles */
.delete-history-modal-content {
    max-width: 650px;
    animation: modalFadeIn 0.3s ease;
}

.delete-history-modal-header {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    border-radius: 12px 12px 0 0;
}

.delete-history-modal-header h2 {
    color: white;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.delete-history-modal-header h2 i {
    font-size: 20px;
}

.delete-history-modal-body {
    padding: 28px;
}

.delete-history-warning {
    display: flex;
    gap: 16px;
    background: linear-gradient(135deg, #fff3cd 0%, #ffe69c 100%);
    border: 2px solid #ffc107;
    border-radius: 10px;
    padding: 18px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.15);
}

.delete-history-warning .warning-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    background: #ffc107;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
}

.delete-history-warning .warning-content {
    flex: 1;
}

.delete-history-warning .warning-content strong {
    display: block;
    color: #856404;
    font-size: 16px;
    margin-bottom: 6px;
    font-weight: 600;
}

.delete-history-warning .warning-content p {
    color: #856404;
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
}

.delete-history-warning .warning-content p strong {
    display: inline;
    font-weight: 700;
}

.delete-history-modal-body .form-group {
    margin-bottom: 20px;
}

.delete-history-modal-body .form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
    font-size: 14px;
}

.delete-history-modal-body .form-group label i {
    color: #6b7280;
    font-size: 14px;
}

.delete-history-modal-body .form-group label .optional-label {
    font-weight: 400;
    color: #9ca3af;
    font-size: 12px;
}

.delete-history-modal-body .form-group select,
.delete-history-modal-body .form-group input[type="datetime-local"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
    background: white;
    color: #374151;
}

.delete-history-modal-body .form-group select:focus,
.delete-history-modal-body .form-group input[type="datetime-local"]:focus {
    outline: none;
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

.delete-history-modal-body .form-group select:hover,
.delete-history-modal-body .form-group input[type="datetime-local"]:hover {
    border-color: #d1d5db;
}


.form-help-text {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #6b7280;
    font-size: 12px;
    margin-top: 6px;
}

.form-help-text i {
    font-size: 11px;
    opacity: 0.7;
}

.delete-history-info-box {
    display: flex;
    gap: 14px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid #dee2e6;
    border-radius: 10px;
    padding: 16px;
    margin: 24px 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.delete-history-info-box i {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    background: #667eea;
    color: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.delete-history-info-box strong {
    display: block;
    color: #495057;
    font-size: 14px;
    margin-bottom: 4px;
    font-weight: 600;
}

.delete-history-info-box p {
    color: #6c757d;
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
}


.form-error-message {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fee;
    border: 2px solid #fcc;
    border-radius: 8px;
    padding: 12px 16px;
    margin: 16px 0;
    color: #c33;
    font-size: 14px;
    animation: shake 0.4s ease;
}

.form-error-message i {
    font-size: 16px;
    flex-shrink: 0;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.delete-history-submit-btn {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
    font-size: 16px;
    font-weight: 600;
    padding: 14px 28px;
    min-width: 200px;
    transition: all 0.3s ease;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
}

.delete-history-submit-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #c82333 0%, #bd2130 100%);
    box-shadow: 0 6px 16px rgba(220, 53, 69, 0.4);
    transform: translateY(-2px);
}

.delete-history-submit-btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
}

.delete-history-submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.delete-history-submit-btn .btn-loading {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Delete History Confirmation Modal Styles */
.delete-history-confirm-modal-content {
    max-width: 550px;
    animation: modalFadeIn 0.3s ease;
}

.delete-history-confirm-modal-header {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    border-radius: 12px 12px 0 0;
}

.delete-history-confirm-modal-header h2 {
    color: white;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.delete-history-confirm-modal-body {
    padding: 32px 28px 28px;
    text-align: center;
}

.delete-history-confirm-icon {
    margin-bottom: 24px;
}

.confirm-icon-wrapper {
    width: 80px;
    height: 80px;
    margin: 0 auto;
    background: linear-gradient(135deg, #fee 0%, #fcc 100%);
    border: 3px solid #dc3545;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 2s infinite;
}

.confirm-icon-wrapper i {
    font-size: 40px;
    color: #dc3545;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.4);
    }
    50% {
        box-shadow: 0 0 0 12px rgba(220, 53, 69, 0);
    }
}

.delete-history-confirm-message {
    margin-bottom: 24px;
}

.delete-history-confirm-message h3 {
    margin: 0 0 12px 0;
    color: #1f2937;
    font-size: 22px;
    font-weight: 700;
}

.delete-history-confirm-message p {
    color: #6b7280;
    margin: 0;
    line-height: 1.6;
    font-size: 15px;
}

.delete-history-confirm-message p strong {
    color: #dc3545;
    font-weight: 700;
}

.delete-history-confirm-details {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid #dee2e6;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    text-align: left;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.delete-history-confirm-details strong {
    display: block;
    color: #374151;
    font-size: 14px;
    margin-bottom: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 12px;
}

.delete-history-confirm-details ul {
    margin: 0;
    padding-left: 20px;
    list-style: none;
}

.delete-history-confirm-details ul li {
    color: #495057;
    font-size: 14px;
    margin-bottom: 8px;
    padding-left: 24px;
    position: relative;
    line-height: 1.6;
}

.delete-history-confirm-details ul li:before {
    content: "→";
    position: absolute;
    left: 0;
    color: #dc3545;
    font-weight: bold;
}

.delete-history-confirm-details ul li:last-child {
    margin-bottom: 0;
}

.delete-history-confirm-warning {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 24px;
    color: #0369a1;
    font-size: 13px;
}

.delete-history-confirm-warning i {
    font-size: 16px;
    flex-shrink: 0;
}

.delete-history-confirm-actions {
    justify-content: center;
    gap: 12px;
    display: flex;
    flex-wrap: wrap;
}

.delete-history-confirm-btn {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
    font-size: 16px;
    font-weight: 600;
    padding: 14px 28px;
    min-width: 220px;
    transition: all 0.3s ease;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
}

.delete-history-confirm-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #c82333 0%, #bd2130 100%);
    box-shadow: 0 6px 16px rgba(220, 53, 69, 0.4);
    transform: translateY(-2px);
}

.delete-history-confirm-btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
}

.delete-history-confirm-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.delete-history-confirm-btn .btn-loading {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Responsive styles for delete history modals */
@media (max-width: 768px) {
    .delete-history-modal-content,
    .delete-history-confirm-modal-content {
        width: 95%;
        max-width: 95%;
        margin: 20px;
    }
    
    .delete-history-modal-body {
        padding: 20px;
    }
    
    .delete-history-warning {
        flex-direction: column;
        text-align: center;
    }
    
    .delete-history-warning .warning-icon {
        margin: 0 auto;
    }
    
    .delete-history-info-box {
        flex-direction: column;
        text-align: center;
    }
    
    .delete-history-info-box i {
        margin: 0 auto;
    }
    
    .delete-history-confirm-actions {
        flex-direction: column;
    }
    
    .delete-history-submit-btn,
    .delete-history-confirm-btn {
        width: 100%;
        min-width: auto;
    }
}
