* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

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

@keyframes latency-blink {
    0% { opacity: 1; transform: scale(1.3); }
    100% { opacity: 0.4; transform: scale(1); }
}
.latency-blink {
    animation: latency-blink 0.4s ease-out;
}

@keyframes slideUp {
    from { transform: translateX(-50%) translateY(40px); opacity: 0; }
    to   { transform: translateX(-50%) translateY(0); opacity: 1; }
}

/* Device group selection checkbox */
.device-select-checkbox input[type="checkbox"] {
    transition: transform 0.15s ease;
}
.device-select-checkbox input[type="checkbox"]:checked {
    transform: scale(1.15);
}
.device-item:has(.device-group-select:checked) {
    border-color: #2563eb !important;
    background: #eff6ff !important;
}

/* Modal Overlay Styles */
.modal-overlay,
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 15px;
    padding: 24px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalFadeIn 0.3s ease;
}

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

html, body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 10px; /* Mobile first - will be overridden for desktop */
    direction: rtl;
    overflow-x: hidden !important; /* Prevent horizontal scroll */
    max-width: 100vw;
    width: 100%;
    margin: 0;
    box-sizing: border-box;
}

* {
    box-sizing: border-box;
}

/* Desktop padding */
@media (min-width: 769px) {
    body {
        padding: 20px;
    }
}

#app {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
}

.container {
    max-width: 100%; /* Mobile first */
    width: 100%; /* Mobile first - full width */
    margin: 0 auto;
    background: white;
    border-radius: 8px; /* Mobile first */
    padding: 20px 15px; /* Mobile first */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    overflow-x: hidden;
}

/* Desktop container */
@media screen and (min-width: 769px) {
    .container {
        max-width: 600px;
        width: auto;
        border-radius: 10px;
        padding: 30px;
    }
}

.screen {
    display: none !important;
    width: 100%;
    max-width: 100%;
}

.screen.active {
    display: block !important;
}

#dashboard-screen {
    width: 100%;
    max-width: 100%;
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
}

h2 {
    color: #555;
    margin-bottom: 20px;
    font-size: 1.5em;
}

h3 {
    color: #666;
    margin-bottom: 15px;
    font-size: 1.2em;
}

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

label {
    display: block;
    margin-bottom: 5px;
    color: #555;
    font-weight: 500;
}

/* עיצוב קלאסי וסטנדרטי לשדות קוד */
#register-otp,
#login-otp,
#whatsapp-code-input,
#pairing-code-input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    text-align: center;
    letter-spacing: 2px;
    font-family: 'Courier New', monospace;
    background: white;
    color: #333;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-shadow: none;
}

#pairing-code-input {
    text-transform: uppercase;
    letter-spacing: 3px;
}

#register-otp:focus,
#login-otp:focus,
#whatsapp-code-input:focus,
#pairing-code-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#register-otp::placeholder,
#login-otp::placeholder,
#whatsapp-code-input::placeholder,
#pairing-code-input::placeholder {
    color: #999;
    letter-spacing: normal;
    text-transform: none;
}

input[type="text"],
input[type="tel"],
input[type="file"],
select {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    transition: border-color 0.3s;
}

input:focus,
select:focus {
    outline: none;
    border-color: #667eea;
}

.btn-primary,
.btn-secondary {
    padding: 12px 24px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s;
    width: 100%;
    margin-top: 10px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    opacity: 0.9;
}

.btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.form-group .btn-secondary {
    width: auto;
    margin-top: 5px;
    margin-right: 10px;
}

.card {
    background: #f9f9f9;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    overflow: visible; /* Ensure form buttons are not cut off */
}

.card form {
    overflow: visible; /* Ensure form content is not cut off */
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #eee;
    position: relative;
}

#logout-btn,
.logout-btn-top-left {
    position: relative;
    left: auto;
    top: auto;
    z-index: 1000;
    background: white;
    background-color: white;
    color: #333;
    border: 1px solid #ddd;
    border-width: 1px;
    border-radius: 4px;
    padding: 8px 15px;
    margin: 0;
    font-size: 14px;
    cursor: pointer;
    display: inline-block;
    text-decoration: none;
    box-shadow: none;
    transition: all 0.2s ease;
    white-space: nowrap;
    width: auto;
    min-width: auto;
    max-width: none;
    flex: none;
    align-items: unset;
    justify-content: unset;
    gap: 0;
}

#logout-btn:hover,
#logout-btn:active,
#logout-btn:focus,
.logout-btn-top-left:hover,
.logout-btn-top-left:active,
.logout-btn-top-left:focus {
    background: #f5f5f5;
    background-color: #f5f5f5;
    transform: none;
    box-shadow: none;
    border: 1px solid #bbb;
    border-width: 1px;
    color: #333;
    text-decoration: none;
}

/* Desktop styling - buttons are already styled above */
@media (min-width: 769px) {
    #logout-btn,
    .logout-btn-top-left {
        /* Styles already applied above */
    }
}

#user-info {
    background: #e8f4f8;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
}

#user-info p {
    margin: 5px 0;
    color: #555;
}

#users-list,
#devices-list {
    margin-top: 20px;
}

.user-item,
.device-item {
    background: white;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 10px;
    border: 1px solid #ddd;
}

.user-item h4,
.device-item h4 {
    margin-bottom: 10px;
    color: #333;
}

.user-item p,
.device-item p {
    color: #666;
    font-size: 14px;
    margin: 5px 0;
}

/* ── Device item expand/collapse (all layouts) ── */
.device-item .device-item-header {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    touch-action: manipulation;
}

.device-item .device-expand-arrow {
    transition: transform 0.2s ease;
}

.device-item.expanded .device-expand-arrow {
    transform: rotate(180deg);
}

.device-item.expanded .device-item-details {
    display: block !important;
}

/* ── Device card header: consistent layout ── */
.device-item-header .device-header-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.device-item-header .device-name {
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

.device-item-header .device-owner-badge {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
    white-space: nowrap;
    flex-shrink: 0;
}

@media (max-width: 480px) {
    .device-item-header .device-name {
        max-width: 120px;
        font-size: 13px;
    }
    .device-item-header .device-owner-badge {
        font-size: 10px;
        padding: 2px 6px;
    }
}

.error {
    background: #fee;
    color: #c33;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 15px;
}

.success {
    background: #efe;
    color: #3c3;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 15px;
}

.hidden {
    display: none;
}

#contacts-preview {
    margin-top: 15px;
    max-height: 200px;
    overflow-y: auto;
    background: white;
    padding: 10px;
    border-radius: 5px;
}

.contact-item {
    padding: 5px;
    border-bottom: 1px solid #eee;
}

#contacts-list {
    max-height: 300px;
    overflow-y: auto;
}

#contacts-list .contact-item {
    transition: background-color 0.2s;
}

#contacts-list .contact-item:hover {
    background-color: #f5f5f5;
}

.remove-contact-btn:hover {
    opacity: 0.8;
}

a {
    color: #667eea;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

#settlement-map {
    border: 2px solid #ddd;
}

.pac-container {
    direction: rtl;
    text-align: right;
    z-index: 10003 !important; /* Higher than modal z-index */
}

.pac-item {
    padding: 10px;
    cursor: pointer;
}

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

#selected-settlement-info {
    animation: fadeIn 0.3s;
}

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

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.7);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(102, 126, 234, 0);
    }
}


/* ============================================
   RESPONSIVE DESIGN - MOBILE & DESKTOP
   ============================================ */

/* Mobile First - Base styles for mobile */
@media screen and (max-width: 768px) {
    html, body {
        padding: 0 !important;
        margin: 0 !important;
        width: 100vw !important;
        max-width: 100vw !important;
        overflow-x: hidden !important;
        position: relative;
    }
    
    #app {
        width: 100vw !important;
        max-width: 100vw !important;
        overflow-x: hidden !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .container {
        max-width: 100% !important;
        width: 100% !important;
        padding: 20px 15px !important;
        border-radius: 0 !important;
        margin: 0 !important;
        box-sizing: border-box !important;
    }
    
    h1 {
        font-size: 1.5em;
        margin-bottom: 20px;
    }
    
    h2 {
        font-size: 1.3em;
        margin-bottom: 15px;
    }
    
    h3 {
        font-size: 1.1em;
        margin-bottom: 10px;
    }
    
    .form-group {
        margin-bottom: 15px;
    }
    
    input[type="text"],
    input[type="tel"],
    input[type="file"],
    select,
    textarea {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 10px;
    }
    
    .btn-primary,
    .btn-secondary {
        padding: 12px 20px;
        font-size: 16px;
    }
    
    .card {
        padding: 15px;
        margin-bottom: 15px;
    }
    
    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
        padding-bottom: 15px;
    }
    
    header h1 {
        width: 100%;
        margin-bottom: 0;
    }
    
    /* Mobile logout button styling */
    #logout-btn,
    .logout-btn-top-left {
        position: relative !important;
        left: auto !important;
        top: auto !important;
        width: auto !important;
        min-width: auto !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 6px 12px !important;
        background: white !important;
        background-color: white !important;
        border: 1px solid #ddd !important;
        border-width: 1px !important;
        border-radius: 4px !important;
        box-shadow: none !important;
        color: #333 !important;
        text-decoration: none !important;
        font-size: 12px !important;
        z-index: 1000 !important;
        display: inline-block !important;
        flex: none !important;
        align-items: unset !important;
        justify-content: unset !important;
        gap: 0 !important;
        white-space: nowrap !important;
        cursor: pointer !important;
    }
    
    #logout-btn:hover,
    #logout-btn:active,
    #logout-btn:focus,
    .logout-btn-top-left:hover,
    .logout-btn-top-left:active,
    .logout-btn-top-left:focus {
        width: auto !important;
        background: #f5f5f5 !important;
        background-color: #f5f5f5 !important;
        transform: none !important;
        box-shadow: none !important;
        border: 1px solid #bbb !important;
        border-width: 1px !important;
        color: #333 !important;
        text-decoration: none !important;
    }
    
    #user-info {
        padding: 12px;
    }
    
    /* Modal adjustments for mobile */
    #load-contacts-modal > div,
    #role-selection-modal > div {
        max-width: 95%;
        padding: 20px 15px;
        max-height: 95vh;
    }
    
    /* QR code smaller on mobile */
    #qr-code-container img {
        width: 150px !important;
        height: 150px !important;
    }
    
    /* Map adjustments */
    #settlement-map {
        height: 300px !important;
    }
    
    /* Contacts list */
    #contacts-list {
        max-height: 200px;
    }
    
    /* Settlement autocomplete */
    #settlement-autocomplete {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    /* Country code selector */
    #login-country-code,
    #register-country-code {
        font-size: 14px;
        padding: 8px;
    }
    
    /* Dashboard sections */
    #admin-sections {
        margin-top: 15px;
    }
    
    /* Device form */
    #add-device-form {
        padding-bottom: 20px; /* Ensure submit button is visible */
        min-height: auto;
        overflow: visible; /* Prevent content from being cut off */
    }
    
    #add-device-form .form-group {
        margin-bottom: 15px;
    }
    
    #xiaomi-integration {
        overflow: visible !important; /* Ensure all content is visible */
        padding-bottom: 20px !important; /* Extra padding at bottom */
    }
    
    #xiaomi-integration p {
        word-wrap: break-word;
        overflow-wrap: break-word;
        white-space: normal;
    }
}

/* Tablet - Medium screens */
@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        max-width: 700px;
        padding: 25px;
    }
    
    #load-contacts-modal > div,
    #role-selection-modal > div {
        max-width: 600px;
    }
    
    #settlement-map {
        height: 400px !important;
    }
}

/* Desktop - Large screens */
@media (min-width: 1025px) {
    body {
        padding: 30px;
    }
    
    .container {
        max-width: 900px;
        padding: 40px;
    }
    
    /* Dashboard layout - two columns on desktop */
    #dashboard-screen {
        display: grid;
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    #admin-sections {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 20px;
    }
    
    #admin-sections > section {
        margin-bottom: 0;
    }
    
    /* Modal larger on desktop */
    #load-contacts-modal > div,
    #role-selection-modal > div {
        max-width: 600px;
        padding: 40px;
    }
    
    /* Map larger on desktop */
    #settlement-map {
        height: 500px !important;
    }
    
    /* Contacts list taller on desktop */
    #contacts-list {
        max-height: 400px;
    }
    
    /* Form groups side by side where appropriate */
    .form-group-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 15px;
    }
    
    /* Header with more space */
    header {
        padding-bottom: 25px;
    }
}

/* Very large screens */
@media (min-width: 1400px) {
    .container {
        max-width: 1200px;
    }
    
    #admin-sections {
        grid-template-columns: 1fr 1fr 1fr;
    }
}

/* Landscape mobile */
@media (max-width: 768px) and (orientation: landscape) {
    body {
        padding: 5px;
    }
    
    .container {
        padding: 15px 10px;
    }
    
    #settlement-map {
        height: 250px !important;
    }
    
    #contacts-list {
        max-height: 150px;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .btn-primary,
    .btn-secondary,
    button.btn-primary,
    button.btn-secondary,
    button[class*="btn"] {
        min-height: 44px !important; /* iOS recommended touch target */
        height: auto;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    input[type="text"],
    input[type="tel"],
    select {
        min-height: 44px;
    }
    
    /* Remove hover effects on touch devices */
    .btn-primary:hover,
    .btn-secondary:hover {
        opacity: 1;
    }
}

/* Mobile buttons - ensure consistent height */
@media (max-width: 768px) {
    .btn-primary,
    .btn-secondary,
    button.btn-primary,
    button.btn-secondary,
    button[class*="btn"],
    .test-camera-btn,
    .view-stream-btn,
    .delete-device-btn,
    .touch-control-btn,
    .switch-stream-source-btn {
        min-height: 44px !important;
        height: auto;
        padding: 12px 15px !important;
        display: flex;
        align-items: center;
        justify-content: center;
        box-sizing: border-box;
    }
}

/* Country code selector responsive */
@media (max-width: 768px) {
    #login-country-code,
    #register-country-code {
        width: 100px !important;
        font-size: 12px;
        padding: 8px 4px;
    }
    
    #login-phone,
    #register-phone {
        flex: 1;
        min-width: 0;
    }
}

/* Modal buttons responsive */
@media (max-width: 768px) {
    #role-selection-modal .btn-primary,
    #role-selection-modal .btn-secondary {
        width: 100%;
        margin-top: 10px;
    }
    
    #load-contacts-modal button {
        font-size: 14px;
        padding: 12px;
    }
}

/* Dashboard header responsive */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.3em;
    }
    
    /* Mobile logout button - already styled above */
}

/* Form inputs responsive */
@media (max-width: 768px) {
    textarea {
        font-size: 16px; /* Prevents zoom on iOS */
        min-height: 100px;
    }
    
    #manual-contacts-modal {
        font-size: 16px;
    }
}

/* Print styles */
@media print {
    body {
        background: white;
        padding: 0;
    }
    
    .screen:not(.active) {
        display: none !important;
    }
    
    .btn-primary,
    .btn-secondary,
    button {
        display: none;
    }
}

/* Toast Notification Styles */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    max-width: 400px;
}

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

.toast.success {
    border-right-color: #4caf50;
}

.toast.error {
    border-right-color: #f44336;
}

.toast.warning {
    border-right-color: #ff9800;
}

.toast.info {
    border-right-color: #2196f3;
}

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

.toast-content {
    flex: 1;
    color: #333;
    font-size: 14px;
    line-height: 1.5;
}

.toast-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.toast-close:hover {
    color: #333;
}

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

.toast.fade-out {
    animation: slideOutRight 0.3s ease-out forwards;
}

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

/* Confirm Dialog Styles */
.confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
}

.confirm-dialog {
    background: white;
    border-radius: 12px;
    padding: 24px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.3s ease-out;
}

.confirm-title {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 12px;
    color: #333;
}

.confirm-message {
    font-size: 14px;
    color: #666;
    margin-bottom: 20px;
    line-height: 1.6;
    text-align: right;
}

.confirm-message strong {
    color: #333;
    font-weight: 600;
}

.confirm-message small {
    display: block;
    margin-top: 12px;
    font-size: 12px;
    line-height: 1.4;
}

.confirm-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.confirm-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.confirm-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.confirm-btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.confirm-btn-secondary {
    background: #f5f5f5;
    color: #333;
}

.confirm-btn-secondary:hover {
    background: #e0e0e0;
}

/* Mission Launch Modal */
.mission-launch-overlay {
    z-index: 10001;
    background: rgba(0, 0, 0, 0.6);
}

.mission-launch-dialog {
    max-width: 460px;
    direction: rtl;
}

.mission-launch-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ml-status-banner {
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.5;
    text-align: right;
}

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

.ml-status-warn {
    background: #fff3e0;
    color: #e65100;
    border: 1px solid #ffcc80;
}

.ml-settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.ml-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ml-field label {
    font-size: 12px;
    font-weight: 600;
    color: #555;
}

.ml-field small {
    font-size: 10px;
    color: #999;
    line-height: 1.3;
}

.ml-field input,
.ml-field select {
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    background: #fafafa;
    transition: border-color 0.2s;
    direction: ltr;
    text-align: center;
}

.ml-field select {
    direction: rtl;
    text-align: right;
}

.ml-field input:focus,
.ml-field select:focus {
    outline: none;
    border-color: #667eea;
    background: #fff;
}

.ml-safety-msg {
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.5;
    text-align: right;
}

.ml-safety-ok {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

.ml-safety-warn {
    background: #fff3e0;
    color: #e65100;
    border: 1px solid #ffcc80;
}

.ml-safety-block {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ef9a9a;
}

.ml-fly-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.ml-fly-btn {
    min-width: 160px;
    white-space: nowrap;
}

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

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

@media (max-width: 768px) {
    #toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .toast {
        min-width: auto;
        max-width: none;
    }
    
    .confirm-dialog {
        margin: 20px;
        width: calc(100% - 40px);
    }

    .ml-settings-grid {
        grid-template-columns: 1fr;
    }

    .mission-launch-dialog {
        max-width: none;
    }
}

/* Toggle Switch Styles */
#alerts-enabled-toggle {
    opacity: 0;
    width: 0;
    height: 0;
}

#alerts-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

#alerts-toggle-slider:hover {
    background-color: #bbb;
}

#alerts-toggle-slider-inner {
    position: absolute;
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

#alerts-enabled-toggle:checked + #alerts-toggle-slider {
    background-color: #4caf50;
}

#alerts-enabled-toggle:checked + #alerts-toggle-slider:hover {
    background-color: #45a049;
}

#alerts-enabled-toggle:checked + #alerts-toggle-slider #alerts-toggle-slider-inner {
    transform: translateX(26px);
}

#alerts-enabled-toggle:focus + #alerts-toggle-slider {
    box-shadow: 0 0 1px #4caf50;
}

/* Push Notifications Toggle */
#push-notifications-toggle {
    opacity: 0;
    width: 0;
    height: 0;
}

#push-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

#push-toggle-slider-inner {
    position: absolute;
    content: '';
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

#push-notifications-toggle:checked + #push-toggle-slider {
    background-color: #4caf50;
}

#push-notifications-toggle:checked + #push-toggle-slider #push-toggle-slider-inner {
    transform: translateX(26px);
}

/* ============================================= */
/* Grid Size Selector Buttons                    */
/* ============================================= */
.grid-size-selector {
    display: flex;
    gap: 4px;
    align-items: center;
    background: rgba(30, 41, 59, 0.7);
    border-radius: 10px;
    padding: 4px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.grid-size-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 42px;
    height: 32px;
    border: 1px solid transparent;
    border-radius: 7px;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0 8px;
    font-size: 0;
}

.grid-size-btn:hover {
    background: rgba(100, 116, 139, 0.2);
    color: #e2e8f0;
    border-color: rgba(100, 116, 139, 0.3);
}

.grid-size-btn.active {
    background: #2563eb;
    color: white;
    border-color: #3b82f6;
    box-shadow: 0 1px 4px rgba(37, 99, 235, 0.4);
}

.grid-size-btn svg {
    pointer-events: none;
    flex-shrink: 0;
}

.grid-size-label {
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    pointer-events: none;
}

@media (max-width: 768px) {
    .grid-size-selector {
        gap: 3px;
        padding: 3px;
        border-radius: 8px;
    }

    .grid-size-btn {
        min-width: 38px;
        height: 30px;
        padding: 0 6px;
        border-radius: 6px;
    }

    .grid-size-btn svg {
        width: 14px;
        height: 14px;
    }

    .grid-size-label {
        font-size: 11px;
    }
}

/* ============================================= */
/* Stream Placeholders (no-stream panels)        */
/* ============================================= */
.stream-placeholder {
    text-align: center;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 10px;
}

.stream-placeholder-icon {
    color: #94a3b8;
    opacity: 0.7;
    transition: opacity 0.3s;
}

.stream-placeholder-text {
    font-size: 12px;
    color: #94a3b8;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.stream-placeholder.empty-slot .stream-placeholder-icon {
    opacity: 0.35;
}

.stream-placeholder.empty-slot .stream-placeholder-text {
    color: #b0b8c4;
}

/* Override black background on stream items */
.desktop-video-stream-item.empty {
    background: linear-gradient(135deg, #f0f2f5 0%, #e8ecf1 100%) !important;
    border: 1px dashed #d1d5db !important;
}

.desktop-video-stream-item:not(.empty) .stream-media-container {
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8ee 100%);
}

/* When stream is active, use dark background for contrast */
.desktop-video-stream-item:not(.empty) .stream-media-container:has(video),
.desktop-video-stream-item:not(.empty) .stream-media-container:has(img[src]) {
    background: #1a1a2e;
}

/* Layout Switcher Styles */
#layout-switcher {
    position: relative;
    z-index: 1001;
}

#layout-menu {
    animation: fadeIn 0.2s ease-out;
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 5px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1002;
    min-width: 200px;
    padding: 8px;
    max-height: 400px;
    overflow-y: auto;
}

.layout-option {
    transition: background-color 0.2s;
    display: block;
    width: 100%;
    padding: 12px;
    text-align: right;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 5px;
    margin-bottom: 3px;
    font-size: 14px;
    color: #333;
}

.layout-option:hover {
    background-color: #f5f5f5 !important;
}

.layout-option.active {
    background-color: #e8f4f8 !important;
    color: #667eea;
    font-weight: bold;
}

.layout-switcher-button {
    width: auto !important;
    padding: 8px 15px !important;
    font-size: 14px !important;
    margin: 0 !important;
    background: white !important;
    color: #333 !important;
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
    cursor: pointer !important;
    box-shadow: none !important;
    transition: all 0.2s ease !important;
}

.layout-switcher-button:hover {
    background: #f5f5f5 !important;
    transform: none !important;
    box-shadow: none !important;
    border: 1px solid #bbb !important;
}

.layout-menu-header {
    padding: 8px;
    border-bottom: 1px solid #eee;
    margin-bottom: 5px;
}

.layout-menu-header strong {
    font-size: 12px;
    color: #666;
}

#layout-switcher-btn {
    cursor: pointer;
    user-select: none;
}

/* Layout Styles */
.dashboard-layout-classic {
    /* Default layout - no changes */
}

.dashboard-layout-compact .card {
    padding: 12px;
    margin-bottom: 12px;
}

.dashboard-layout-compact h2 {
    font-size: 1.2em;
    margin-bottom: 12px;
}

.dashboard-layout-compact .form-group {
    margin-bottom: 12px;
}

.dashboard-layout-compact #user-info {
    padding: 10px;
}

.dashboard-layout-compact #user-info p {
    margin: 3px 0;
    font-size: 14px;
}

.dashboard-layout-compact .device-item,
.dashboard-layout-compact .user-item {
    padding: 10px;
    margin-bottom: 8px;
}

.dashboard-layout-compact .btn-primary,
.dashboard-layout-compact .btn-secondary {
    padding: 10px 16px;
    font-size: 14px;
}

.dashboard-layout-detailed .card {
    padding: 25px;
    margin-bottom: 25px;
}

.dashboard-layout-detailed h2 {
    font-size: 1.6em;
    margin-bottom: 20px;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

.dashboard-layout-detailed .form-group {
    margin-bottom: 25px;
}

.dashboard-layout-detailed .form-group label {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.dashboard-layout-detailed #user-info {
    padding: 20px;
    background: linear-gradient(135deg, #e8f4f8 0%, #f0f7ff 100%);
    border-radius: 10px;
    border: 2px solid #667eea;
}

.dashboard-layout-detailed #user-info p {
    margin: 8px 0;
    font-size: 16px;
}

.dashboard-layout-detailed .device-item,
.dashboard-layout-detailed .user-item {
    padding: 20px;
    margin-bottom: 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.dashboard-layout-grid .card {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    padding: 20px;
}

.dashboard-layout-grid .card > h2 {
    grid-column: 1 / -1;
    margin-bottom: 15px;
}

.dashboard-layout-grid #dashboard-stats-cards {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.dashboard-layout-grid #user-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.dashboard-layout-grid .device-item,
.dashboard-layout-grid .user-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
}

.dashboard-layout-grid #devices-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
}

/* Minimal Layout */
.dashboard-layout-minimal .card {
    padding: 15px;
    margin-bottom: 15px;
    background: white;
    border: 1px solid #e0e0e0;
    box-shadow: none;
}

.dashboard-layout-minimal h2 {
    font-size: 1.3em;
    margin-bottom: 15px;
    font-weight: 500;
}

.dashboard-layout-minimal #user-info {
    background: white;
    border: 1px solid #e0e0e0;
    padding: 12px;
}

.dashboard-layout-minimal .device-item,
.dashboard-layout-minimal .user-item {
    border: 1px solid #e0e0e0;
    box-shadow: none;
    padding: 12px;
}

.dashboard-layout-minimal .btn-primary,
.dashboard-layout-minimal .btn-secondary {
    border: 1px solid #ddd;
}

/* Cards Layout */
.dashboard-layout-cards .card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 20px;
    margin-bottom: 20px;
    border: none;
}

.dashboard-layout-cards .device-item,
.dashboard-layout-cards .user-item {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 18px;
    margin-bottom: 15px;
    border: none;
    transition: transform 0.2s, box-shadow 0.2s;
}

.dashboard-layout-cards .device-item:hover,
.dashboard-layout-cards .user-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.dashboard-layout-cards #user-info {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.dashboard-layout-cards #user-info p {
    color: white;
}

.dashboard-layout-cards #dashboard-stats-cards .stat-card {
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Sidebar Layout */
.dashboard-layout-sidebar {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 20px;
}

.dashboard-layout-sidebar #user-info {
    position: sticky;
    top: 20px;
    height: fit-content;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

.dashboard-layout-sidebar .card {
    margin-bottom: 20px;
}

@media (max-width: 1024px) {
    .dashboard-layout-sidebar {
        grid-template-columns: 1fr;
    }
    
    .dashboard-layout-sidebar #user-info {
        position: relative;
        top: 0;
        max-height: none;
    }
}

/* Modern Layout */
.dashboard-layout-modern .card {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 16px;
    padding: 25px;
    margin-bottom: 25px;
    border: none;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    position: relative;
    overflow: hidden;
}

.dashboard-layout-modern .card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.dashboard-layout-modern h2 {
    font-size: 1.6em;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
}

.dashboard-layout-modern #user-info {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
    position: relative;
    overflow: hidden;
}

.dashboard-layout-modern #user-info::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: rotate 20s linear infinite;
}

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

.dashboard-layout-modern #user-info p {
    color: white;
    font-weight: 500;
    position: relative;
    z-index: 1;
}

.dashboard-layout-modern .device-item,
.dashboard-layout-modern .user-item {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    border: 2px solid #f0f0f0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}

.dashboard-layout-modern .device-item:hover,
.dashboard-layout-modern .user-item:hover {
    border-color: #667eea;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.2);
    transform: translateY(-2px);
}

.dashboard-layout-modern .btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    border: none;
}

.dashboard-layout-modern .btn-primary:hover {
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
    transform: translateY(-2px);
}

.dashboard-layout-modern #dashboard-stats-cards .stat-card {
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.dashboard-layout-modern #dashboard-stats-cards .stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

/* Layout Switcher Button Hover */
#layout-switcher-btn:hover {
    background: rgba(102, 126, 234, 1) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* Fullwidth Layout - תבנית פרוש (ללא מסגרות צד) */
.dashboard-layout-fullwidth .container {
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
}

.dashboard-layout-fullwidth #dashboard-screen {
    padding: 0 !important;
    margin: 0 !important;
    background: white !important;
}

.dashboard-layout-fullwidth .screen {
    background: white !important;
}

/* Override body and html background when fullwidth layout is active */
body.dashboard-layout-fullwidth,
html.dashboard-layout-fullwidth {
    padding: 0 !important;
    margin: 0 !important;
    background: white !important;
    background-image: none !important;
}

.dashboard-layout-fullwidth header {
    padding: 15px 20px;
    margin-bottom: 0;
    border-radius: 0;
    border-bottom: none !important;
    background: transparent !important;
}

/* הסתר את המילה "דשבורד" גם בדסקטופ */
.dashboard-layout-fullwidth header h1 {
    display: none !important;
}

.dashboard-layout-fullwidth .card {
    border-radius: 0 !important;
    margin-bottom: 0 !important;
    border: none !important;
    border-right: none !important;
    border-left: none !important;
    border-top: none !important;
    border-bottom: none !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 15px 20px;
}

.dashboard-layout-fullwidth .card:not(:last-child) {
    border-bottom: none !important;
}

/* Responsive adjustments for fullwidth layout */
@media screen and (min-width: 769px) {
    .dashboard-layout-fullwidth .container {
        padding: 0 !important;
    }
    
    .dashboard-layout-fullwidth header {
        padding: 20px 30px;
    }
    
    .dashboard-layout-fullwidth .card {
        padding: 20px 30px;
    }
}

@media screen and (max-width: 768px) {
    .dashboard-layout-fullwidth .container {
        padding: 0 !important;
    }
    
    .dashboard-layout-fullwidth header {
        padding: 15px;
    }
    
    .dashboard-layout-fullwidth .card {
        padding: 15px;
    }
    
    /* הסתר את המילה "דשבורד" במובייל */
    .dashboard-layout-fullwidth header h1 {
        display: none !important;
    }
    
    /* ודא שהכפתורים והלוגו באותה שורה במובייל */
    .dashboard-layout-fullwidth header {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        flex-wrap: nowrap !important;
    }
    
    .dashboard-layout-fullwidth header > div:first-child {
        flex-direction: row !important;
        margin-bottom: 0 !important;
    }
}

/* Desktop Layout - תבנית דסקטופ */
.dashboard-layout-desktop {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Desktop Layout - מתוח עם רקע לבן (כמו תבנית פרוש) */
.dashboard-layout-desktop .container {
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
}

.dashboard-layout-desktop #dashboard-screen {
    padding: 0 !important;
    margin: 0 !important;
    background: white !important;
}

.dashboard-layout-desktop .screen {
    background: white !important;
}

/* Override body and html background when desktop layout is active */
body.dashboard-layout-desktop,
html.dashboard-layout-desktop {
    padding: 0 !important;
    margin: 0 !important;
    background: white !important;
    background-image: none !important;
}

.dashboard-layout-desktop header {
    border-bottom: none !important;
    background: transparent !important;
}

.dashboard-layout-desktop .card {
    border-radius: 0 !important;
    margin-bottom: 0 !important;
    border: none !important;
    border-right: none !important;
    border-left: none !important;
    border-top: none !important;
    border-bottom: none !important;
    background: transparent !important;
    box-shadow: none !important;
}

.dashboard-layout-desktop .card:not(:last-child) {
    border-bottom: none !important;
}

/* מסגרות וחוצצים לכל האלמנטים בתבנית דסקטופ */
.dashboard-layout-desktop #dashboard-stats-section {
    border: 1px solid #ddd !important;
}

.dashboard-layout-desktop .desktop-stats-grid-container {
    gap: 15px !important;
}

.dashboard-layout-desktop .desktop-top-section {
    gap: 15px !important;
}

.dashboard-layout-desktop .desktop-top-section > * {
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
}

.dashboard-layout-desktop .desktop-main-grid {
    gap: 15px !important;
}

.dashboard-layout-desktop .desktop-main-grid > * {
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
}

.dashboard-layout-desktop .desktop-bottom-grid {
    gap: 15px !important;
}

.dashboard-layout-desktop .desktop-bottom-grid > * {
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
}

.dashboard-layout-desktop .desktop-devices-section {
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
}

.dashboard-layout-desktop #devices-map-section {
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
}

.dashboard-layout-desktop .desktop-video-streams-section {
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
}

.dashboard-layout-desktop .desktop-alerts-section,
.dashboard-layout-desktop .desktop-quick-actions,
.dashboard-layout-desktop .desktop-contacts-section,
.dashboard-layout-desktop .desktop-whatsapp-invite-section {
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
}

.dashboard-layout-desktop header {
    background: white;
    border-radius: 12px;
    padding: 15px 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dashboard-layout-desktop header h1 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.dashboard-layout-desktop header h1::before {
    content: '🛡️';
    font-size: 1.2em;
}

.dashboard-layout-desktop #user-info {
    display: none; /* נסתיר את user-info בתבנית זו */
}

/* סטטיסטיקות מהירות בשורה אחת */
.dashboard-layout-desktop #dashboard-stats-section {
    background: #f8f9fa;
    color: #333;
    border-radius: 8px;
    padding: 15px 20px;
    margin-bottom: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e0e0e0;
}

.dashboard-layout-desktop #dashboard-stats-section h2 {
    display: none;
}

.dashboard-layout-desktop #dashboard-stats-cards {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 0;
    grid-template-columns: none;
}

.dashboard-layout-desktop #dashboard-stats-cards .stat-card {
    background: white;
    border-radius: 6px;
    padding: 12px 15px;
    color: #333;
    border: 1px solid #e0e0e0;
    flex: 0 0 auto; /* Don't grow or shrink */
    width: 100%;
    aspect-ratio: 1 / 1 !important; /* Force perfect square - override any content */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    box-sizing: border-box;
    overflow: hidden; /* Prevent content from breaking the square */
    position: relative;
    margin: 0; /* הסר margin כדי שהחוצצים יהיו רק מה-gap */
}

.dashboard-layout-desktop #dashboard-stats-cards .stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    border-color: #d0d0d0;
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.45); /* Even more opaque on hover */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.dashboard-layout-desktop #dashboard-stats-cards .stat-card h3 {
    font-size: 9px; /* Even smaller text to fit in square */
    opacity: 1; /* Full opacity - not pale */
    margin-bottom: 4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    line-height: 1.2;
    flex-shrink: 0;
}

.dashboard-layout-desktop #dashboard-stats-cards .stat-card p {
    font-size: 18px; /* Smaller number */
    font-weight: bold;
    margin: 0;
    line-height: 1.1;
    flex-shrink: 0;
}

.dashboard-layout-desktop #dashboard-stats-cards .stat-card ul {
    font-size: 7px; /* Much smaller sub-items to fit in square */
    opacity: 0.95;
    margin-top: 4px;
    padding-right: 0;
    list-style: none;
    text-align: center;
    line-height: 1.2;
    flex: 1;
    overflow-y: auto; /* Allow scrolling if needed */
    max-height: 100%;
    width: 100%;
}

.dashboard-layout-desktop #dashboard-stats-cards .stat-card ul li {
    margin-bottom: 2px;
    line-height: 1.2;
}

/* סטטיסטיקות עם וידאו משמאל - וידאו גדול יותר */
.dashboard-layout-desktop .desktop-stats-grid-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
    align-items: stretch; /* Stretch both columns to same height */
}

/* Ensure both columns stretch to same height */
.dashboard-layout-desktop .desktop-stats-grid-container > * {
    display: flex;
    flex-direction: column;
    min-height: 100%; /* Ensure both stretch to container height */
}

.dashboard-layout-desktop .desktop-stats-grid-container #dashboard-stats-section {
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    height: 100%; /* Match video section height */
    min-height: 500px; /* Same as video section */
}

/* Ensure video section header matches stats section start */
.dashboard-layout-desktop .desktop-stats-video-section > div:first-child {
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    height: auto;
}

.dashboard-layout-desktop .desktop-stats-grid-container #dashboard-stats-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-top: 0;
    align-items: start; /* Align to start to prevent stretching */
    flex: 1; /* Fill remaining space */
}

/* Ensure cards maintain square aspect ratio - force same size */
.dashboard-layout-desktop .desktop-stats-grid-container #dashboard-stats-cards .stat-card {
    width: 100%;
    aspect-ratio: 1 / 1 !important; /* Force perfect square - override content */
    max-width: 100%;
    height: auto; /* Let aspect-ratio control height */
    min-height: 0; /* Remove min-height constraint */
}

/* Video streams section in stats area (left side) */
.dashboard-layout-desktop .desktop-stats-video-section {
    background: #f9f9f9;
    border-radius: 12px;
    padding: 15px;
    border: 2px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    height: 500px;
    max-height: 500px;
    overflow: hidden;
    box-sizing: border-box;
}

.dashboard-layout-desktop .desktop-stats-video-section h3 {
    font-size: 1.1em;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.dashboard-layout-desktop .desktop-stats-video-streams-grid {
    display: grid;
    /* Columns will be set dynamically via JavaScript based on grid size */
    grid-template-columns: repeat(2, 1fr); /* Default: 2 columns */
    gap: 10px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden; /* הסתר scrollbar אופקי */
}

.dashboard-layout-desktop .desktop-stats-video-streams-grid .desktop-video-stream-item {
    min-height: 0;
    overflow: hidden;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.dashboard-layout-desktop .desktop-stats-video-section .grid-size-selector {
    background: #f1f3f5;
    border-color: #e5e7eb;
}

.dashboard-layout-desktop .desktop-stats-video-section .grid-size-btn {
    color: #6b7280;
    transition: all 0.2s ease;
}

.dashboard-layout-desktop .desktop-stats-video-section .grid-size-btn:hover {
    background: #e5e7eb !important;
    color: #374151 !important;
    border-color: #d1d5db !important;
}

.dashboard-layout-desktop .desktop-stats-video-section .grid-size-btn.active {
    background: #667eea !important;
    color: white !important;
    border-color: #667eea !important;
}

.dashboard-layout-desktop .desktop-stats-video-section .grid-size-btn:active {
    transform: scale(0.95);
}

/* Top section - מפה ומכשירים */
.dashboard-layout-desktop .desktop-top-section {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 20px;
}


/* Video streams grid - משמאל למפה (moved to stats area) */
.dashboard-layout-desktop .desktop-video-streams-section {
    background: #f9f9f9;
    border-radius: 12px;
    padding: 15px;
    border: 2px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    height: 500px;
    overflow: hidden;
}

.dashboard-layout-desktop .desktop-video-streams-section h3 {
    font-size: 1.2em;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.dashboard-layout-desktop .desktop-video-streams-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr 1fr 1fr;
    gap: 10px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden; /* הסתר scrollbar אופקי */
}

.dashboard-layout-desktop .desktop-video-stream-item {
    position: relative;
    background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf1 100%);
    border-radius: 8px;
    overflow: hidden;
    /* aspect-ratio removed - will be controlled by grid layout */
    border: 1px solid #e2e8f0;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
}

.dashboard-layout-desktop .desktop-video-stream-item:hover {
    border-color: #667eea;
    transform: scale(1.02);
}

.dashboard-layout-desktop .desktop-video-stream-item video,
.dashboard-layout-desktop .desktop-video-stream-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dashboard-layout-desktop .desktop-video-stream-item .stream-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
    color: white;
    padding: 8px;
    font-size: 12px;
    text-align: center;
    font-weight: bold;
}

.dashboard-layout-desktop .desktop-video-stream-item.empty .stream-label {
    background: none;
    color: #64748b;
    font-weight: 500;
}

.dashboard-layout-desktop .desktop-video-stream-item .stream-status {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(76, 175, 80, 0.9);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: bold;
}

.dashboard-layout-desktop .desktop-video-stream-item.empty {
    background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf1 100%);
    border: 1px dashed #d1d5db;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 12px;
}

/* Grid עיקרי - מכשירים בלבד (המפה כבר למעלה) */
.dashboard-layout-desktop .desktop-main-grid {
    display: block;
    margin-bottom: 20px;
}

/* מפה גדולה */
.dashboard-layout-desktop #devices-map-section {
    margin-bottom: 0;
    min-height: 400px;
    height: auto;
    display: flex;
    flex-direction: column;
    border: 2px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-radius: 12px;
    padding: 15px;
    overflow: hidden;
    box-sizing: border-box;
}

.dashboard-layout-desktop #devices-map-section h2 {
    font-size: 1.2em;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.dashboard-layout-desktop #devices-map-section h2::before {
    content: '📍';
}

.dashboard-layout-desktop #devices-map-section > p {
    flex-shrink: 0;
    margin-bottom: 10px;
}

.dashboard-layout-desktop #devices-map-section #devices-map-list {
    flex-shrink: 0;
}

.dashboard-layout-desktop #devices-map {
    flex: 1;
    min-height: 400px;
    border-radius: 12px;
    overflow: hidden;
    margin-top: 0;
}

/* מכשירים שלי */
.dashboard-layout-desktop #devices-list {
    flex: 1;
    overflow-y: auto;
    padding-right: 5px;
}

.dashboard-layout-desktop .desktop-devices-section {
    margin-bottom: 0;
    height: 500px;
    display: flex;
    flex-direction: column;
    border: 2px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-radius: 12px;
    padding: 15px;
    overflow: hidden;
    box-sizing: border-box;
}

.dashboard-layout-desktop .desktop-devices-section h2 {
    font-size: 1.2em;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.dashboard-layout-desktop .desktop-devices-section h2::before {
    content: '📋';
}

.dashboard-layout-desktop .desktop-devices-section #devices-search-input {
    flex-shrink: 0;
    margin-bottom: 10px;
}

.dashboard-layout-desktop .desktop-devices-section #devices-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-right: 5px;
}

/* Grid תחתון - התראות, פעולות, אנשי קשר ו-WhatsApp */
.dashboard-layout-desktop .desktop-bottom-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
}

/* התראות */
.dashboard-layout-desktop .desktop-alerts-section {
    background: #f9f9f9;
    border-radius: 12px;
    padding: 20px;
    min-height: 200px;
    border: 2px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.dashboard-layout-desktop .desktop-alerts-section h3 {
    font-size: 1.2em;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dashboard-layout-desktop .desktop-alerts-section h3::before {
    content: '🔔';
}

/* פעולות מהירות */
.dashboard-layout-desktop .desktop-quick-actions {
    background: #f9f9f9;
    border-radius: 12px;
    padding: 20px;
    min-height: 200px;
    border: 2px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.dashboard-layout-desktop .desktop-quick-actions h3 {
    font-size: 1.2em;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dashboard-layout-desktop .desktop-quick-actions h3::before {
    content: '⚙️';
}

.dashboard-layout-desktop .desktop-quick-actions .btn-primary,
.dashboard-layout-desktop .desktop-quick-actions .btn-secondary {
    width: 100%;
    margin-bottom: 10px;
    margin-top: 0;
}

/* אנשי קשר */
.dashboard-layout-desktop .desktop-contacts-section {
    background: #f9f9f9;
    border-radius: 12px;
    padding: 20px;
    min-height: 200px;
    border: 2px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.dashboard-layout-desktop .desktop-contacts-section h3 {
    font-size: 1.2em;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dashboard-layout-desktop .desktop-contacts-section h3::before {
    content: '📱';
}

.dashboard-layout-desktop .desktop-contacts-section .btn-primary {
    width: 100%;
    margin-top: 10px;
}

/* WhatsApp והזמנות */
.dashboard-layout-desktop .desktop-whatsapp-invite-section {
    background: #f9f9f9;
    border-radius: 12px;
    padding: 20px;
    min-height: 200px;
    border: 2px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.dashboard-layout-desktop .desktop-whatsapp-invite-section h3 {
    font-size: 1.2em;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dashboard-layout-desktop .desktop-whatsapp-invite-section h3::before {
    content: '💬';
}

/* Search and Filters - Compact styling */
#search-filters-section {
    margin-bottom: 15px;
}

#search-filters-section .card {
    padding: 10px 15px;
}

/* הסתרת אלמנטים לא רלוונטיים בתבנית דסקטופ */
.dashboard-layout-desktop #search-filters-section {
    display: none;
}

/* Mobile adjustments for search filters */
@media (max-width: 768px) {
    #search-filters-section > div {
        flex-direction: column;
    }
    
    #search-filters-section > div > div {
        min-width: 100% !important;
    }
}

/* Hide admin sections that are not needed in desktop layout */
.dashboard-layout-desktop #admin-sections > section:not(#devices-map-section):not(.desktop-devices-section):not(#admin-tools-section) {
    display: none;
}

/* הסתרת כפתורי פעולות מהירות ב-devices section כי יש אותם בתחתית */
.dashboard-layout-desktop .desktop-devices-section > div:first-of-type {
    display: none !important; /* הסתרת שורת הכפתורים */
}

/* הסתרת הכפתורים עצמם גם אם ה-div לא נסתר */
.dashboard-layout-desktop .desktop-devices-section #show-add-device-btn,
.dashboard-layout-desktop .desktop-devices-section #generate-pairing-code-btn,
.dashboard-layout-desktop .desktop-devices-section #show-pairing-code-btn {
    display: none !important;
}

/* אבל נשאיר את admin-sections עצמו גלוי אם יש בו משהו חשוב */
.dashboard-layout-desktop #admin-sections {
    display: block;
}

/* הסתרת biometric section בתבנית דסקטופ (אפשר להוסיף אותו אחר כך אם צריך) */
.dashboard-layout-desktop #biometric-section {
    display: none;
}

/* Biometric fingerprint button on login screen */
#biometric-login-btn:hover {
    background: #6d5410 !important;
    box-shadow: 0 2px 12px rgba(139, 105, 20, 0.4);
}
#biometric-login-btn:active {
    transform: scale(0.98);
}

/* התאמה למובייל */
@media (max-width: 1024px) {
    .dashboard-layout-desktop .desktop-top-section {
        grid-template-columns: 1fr;
    }
    
    .dashboard-layout-desktop .desktop-stats-grid-container {
        grid-template-columns: 1fr;
    }
    
    .dashboard-layout-desktop .desktop-stats-video-streams-grid {
        grid-template-columns: 1fr;
    }
    
    .dashboard-layout-desktop .desktop-stats-video-section {
        min-height: 300px;
    }
    
    .dashboard-layout-desktop .desktop-main-grid {
        grid-template-columns: 1fr;
    }
    
    .dashboard-layout-desktop .desktop-bottom-grid {
        grid-template-columns: 1fr;
    }
    
    .dashboard-layout-desktop #devices-map-section {
        height: 400px;
    }
    
    .dashboard-layout-desktop .desktop-video-streams-section {
        height: 400px;
    }
    
    .dashboard-layout-desktop .desktop-devices-section {
        height: auto;
        min-height: 300px;
    }
    
    /* במובייל נחזיר את הכפתורים ב-devices section */
    .dashboard-layout-desktop .desktop-devices-section > div:first-of-type {
        display: flex !important;
    }
    
    .dashboard-layout-desktop .desktop-devices-section #show-add-device-btn,
    .dashboard-layout-desktop .desktop-devices-section #generate-pairing-code-btn,
    .dashboard-layout-desktop .desktop-devices-section #show-pairing-code-btn {
        display: inline-block !important;
    }
    
    /* במובייל נחזיר את הכפתורים ב-devices section */
    .dashboard-layout-desktop .desktop-devices-section > div:first-of-type {
        display: flex !important;
    }
}

/* ============================================
   תבנית מינימליסטית - פחות צבעונית מהדסקטופ
   ============================================ */

.dashboard-layout-minimal {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* תבנית מינימליסטית - רקע לבן נקי */
.dashboard-layout-minimal .container {
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
}

.dashboard-layout-minimal #dashboard-screen {
    padding: 0 !important;
    margin: 0 !important;
    background: #fafafa !important;
}

.dashboard-layout-minimal .screen {
    background: #fafafa !important;
}

/* Override body and html background when minimal layout is active */
body.dashboard-layout-minimal,
html.dashboard-layout-minimal {
    padding: 0 !important;
    margin: 0 !important;
    background: #fafafa !important;
    background-image: none !important;
}

.dashboard-layout-minimal header {
    border-bottom: 1px solid #e5e5e5 !important;
    background: #ffffff !important;
    border-radius: 0 !important;
    padding: 15px 20px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    margin-bottom: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dashboard-layout-minimal header h1 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #2c3e50;
    font-size: 1.3em;
}

.dashboard-layout-minimal header h1::before {
    content: '🛡️';
    font-size: 1.2em;
}

.dashboard-layout-minimal #user-info {
    display: none;
}

.dashboard-layout-minimal .card {
    border-radius: 6px !important;
    margin-bottom: 0 !important;
    border: 1px solid #e5e5e5 !important;
    background: #ffffff !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08) !important;
}

.dashboard-layout-minimal .card:not(:last-child) {
    border-bottom: 1px solid #e5e5e5 !important;
}

/* סטטיסטיקות - רקע אפור בהיר מאוד */
.dashboard-layout-minimal #dashboard-stats-section {
    background: #f8f9fa !important;
    color: #495057 !important;
    border-radius: 6px;
    padding: 15px 20px;
    margin-bottom: 0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e5e5 !important;
}

.dashboard-layout-minimal #dashboard-stats-section h2 {
    display: none;
}

.dashboard-layout-minimal #dashboard-stats-cards {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 0;
    grid-template-columns: none;
}

.dashboard-layout-minimal #dashboard-stats-cards .stat-card {
    background: #ffffff !important;
    border-radius: 6px;
    padding: 12px 15px;
    color: #495057 !important;
    border: 1px solid #e0e0e0 !important;
    flex: 0 0 auto;
    width: 100%;
    aspect-ratio: 1 / 1 !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    box-sizing: border-box;
    overflow: hidden;
    position: relative;
    margin: 0;
}

.dashboard-layout-minimal #dashboard-stats-cards .stat-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
    border-color: #d0d0d0 !important;
    background: #ffffff !important;
}

.dashboard-layout-minimal #dashboard-stats-cards .stat-card h3 {
    font-size: 9px;
    opacity: 0.8;
    margin-bottom: 4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    line-height: 1.2;
    flex-shrink: 0;
    color: #6c757d !important;
}

.dashboard-layout-minimal #dashboard-stats-cards .stat-card p {
    font-size: 18px;
    font-weight: bold;
    margin: 0;
    line-height: 1.1;
    flex-shrink: 0;
    color: #2c3e50 !important;
}

.dashboard-layout-minimal #dashboard-stats-cards .stat-card ul {
    font-size: 7px;
    opacity: 0.7;
    margin-top: 4px;
    padding-right: 0;
    list-style: none;
    text-align: center;
    line-height: 1.2;
    flex: 1;
    overflow-y: auto;
    max-height: 100%;
    width: 100%;
    color: #6c757d !important;
}

.dashboard-layout-minimal #dashboard-stats-cards .stat-card ul li {
    margin-bottom: 2px;
    line-height: 1.2;
}

/* Grid container - כמו דסקטופ אבל פחות צבעוני */
.dashboard-layout-minimal .desktop-stats-grid-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
    align-items: stretch;
}

.dashboard-layout-minimal .desktop-stats-grid-container > * {
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.dashboard-layout-minimal .desktop-stats-grid-container #dashboard-stats-section {
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 500px;
}

.dashboard-layout-minimal .desktop-stats-grid-container #dashboard-stats-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 0;
    align-items: start;
    flex: 1;
}

.dashboard-layout-minimal .desktop-stats-grid-container #dashboard-stats-cards .stat-card {
    width: 100%;
    aspect-ratio: 1 / 1 !important;
    max-width: 100%;
    height: auto;
    min-height: 0;
}

/* Video streams section - רקע לבן נקי */
.dashboard-layout-minimal .desktop-stats-video-section {
    background: #ffffff !important;
    border: 1px solid #e5e5e5 !important;
    border-radius: 6px;
    padding: 15px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.dashboard-layout-minimal .desktop-stats-video-section h3 {
    color: #495057 !important;
    font-size: 1em;
    margin-bottom: 10px;
}

.dashboard-layout-minimal .desktop-stats-video-streams-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.dashboard-layout-minimal .desktop-stats-video-streams-grid .desktop-video-stream-item {
    border: 1px solid #e5e5e5 !important;
    border-radius: 4px;
    background: #f8f9fa !important;
}

.dashboard-layout-minimal .desktop-stats-video-section .grid-size-selector {
    background: #f1f3f5;
    border-color: #e5e7eb;
}

.dashboard-layout-minimal .desktop-stats-video-section .grid-size-btn {
    background: transparent !important;
    color: #6c757d !important;
    border: 1px solid transparent !important;
}

.dashboard-layout-minimal .desktop-stats-video-section .grid-size-btn:hover {
    background: #e9ecef !important;
    color: #374151 !important;
    border-color: #d0d0d0 !important;
}

.dashboard-layout-minimal .desktop-stats-video-section .grid-size-btn.active {
    background: #667eea !important;
    color: white !important;
    border-color: #667eea !important;
}

.dashboard-layout-minimal .desktop-stats-video-section .grid-size-btn:active {
    transform: scale(0.95);
}

/* Top section */
.dashboard-layout-minimal .desktop-top-section {
    gap: 12px !important;
}

.dashboard-layout-minimal .desktop-top-section > * {
    border: 1px solid #e5e5e5 !important;
    border-radius: 6px !important;
    background: #ffffff !important;
}

/* Main grid */
.dashboard-layout-minimal .desktop-main-grid {
    gap: 12px !important;
}

.dashboard-layout-minimal .desktop-main-grid > * {
    border: 1px solid #e5e5e5 !important;
    border-radius: 6px !important;
    background: #ffffff !important;
}

/* Bottom grid */
.dashboard-layout-minimal .desktop-bottom-grid {
    gap: 12px !important;
}

.dashboard-layout-minimal .desktop-bottom-grid > * {
    border: 1px solid #e5e5e5 !important;
    border-radius: 6px !important;
    background: #ffffff !important;
}

/* Devices section */
.dashboard-layout-minimal .desktop-devices-section {
    border: 1px solid #e5e5e5 !important;
    border-radius: 6px !important;
    background: #ffffff !important;
}

.dashboard-layout-minimal #devices-map-section {
    border: 1px solid #e5e5e5 !important;
    border-radius: 6px !important;
    background: #ffffff !important;
}

.dashboard-layout-minimal .desktop-video-streams-section {
    border: 1px solid #e5e5e5 !important;
    border-radius: 6px !important;
    background: #ffffff !important;
}

.dashboard-layout-minimal .desktop-alerts-section,
.dashboard-layout-minimal .desktop-quick-actions,
.dashboard-layout-minimal .desktop-contacts-section,
.dashboard-layout-minimal .desktop-whatsapp-invite-section {
    border: 1px solid #e5e5e5 !important;
    border-radius: 6px !important;
    background: #ffffff !important;
}

/* Headers - צבע אפור עדין */
.dashboard-layout-minimal #devices-map-section h2,
.dashboard-layout-minimal .desktop-devices-section h2,
.dashboard-layout-minimal .desktop-video-streams-section h3,
.dashboard-layout-minimal .desktop-alerts-section h3,
.dashboard-layout-minimal .desktop-quick-actions h3,
.dashboard-layout-minimal .desktop-contacts-section h3,
.dashboard-layout-minimal .desktop-whatsapp-invite-section h3 {
    color: #495057 !important;
    font-weight: 600;
}

.dashboard-layout-minimal #devices-map-section h2::before,
.dashboard-layout-minimal .desktop-devices-section h2::before,
.dashboard-layout-minimal .desktop-video-streams-section h3::before,
.dashboard-layout-minimal .desktop-alerts-section h3::before,
.dashboard-layout-minimal .desktop-quick-actions h3::before,
.dashboard-layout-minimal .desktop-contacts-section h3::before,
.dashboard-layout-minimal .desktop-whatsapp-invite-section h3::before {
    opacity: 0.7;
}

/* Buttons - צבעים עדינים */
.dashboard-layout-minimal .desktop-quick-actions .btn-primary,
.dashboard-layout-minimal .desktop-quick-actions .btn-secondary {
    background: #6c757d !important;
    color: white !important;
    border-color: #6c757d !important;
}

.dashboard-layout-minimal .desktop-quick-actions .btn-primary:hover,
.dashboard-layout-minimal .desktop-quick-actions .btn-secondary:hover {
    background: #5a6268 !important;
    border-color: #5a6268 !important;
}

.dashboard-layout-minimal .desktop-contacts-section .btn-primary {
    background: #6c757d !important;
    color: white !important;
    border-color: #6c757d !important;
}

.dashboard-layout-minimal .desktop-contacts-section .btn-primary:hover {
    background: #5a6268 !important;
    border-color: #5a6268 !important;
}

/* ============================================
   תבנית מקצועית (Pro) — מודרנית קלאסית ונקייה
   ============================================ */

/* --- Color Variables (via class scope) ---
   Primary:    #3b82f6 (blue-500)
   Background: #111827 (gray-900)
   Surface:    #1f2937 (gray-800)
   Surface-2:  #374151 (gray-700)
   Text-1:     #f3f4f6 (gray-100)
   Text-2:     #9ca3af (gray-400)
   Border:     #374151 (gray-700)
   Hover-bg:   #2d3748 (gray-700 lighter)
   Accent:     #3b82f6 (blue-500)
   ------------------------------------------- */

.dashboard-layout-pro {
    display: flex;
    flex-direction: column;
    gap: 16px;
    font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* --- Body / HTML background --- */
body.dashboard-layout-pro,
html.dashboard-layout-pro {
    padding: 0 !important;
    margin: 0 !important;
    background: #111827 !important;
    background-image: none !important;
}

/* --- Container --- */
.dashboard-layout-pro .container {
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
}

.dashboard-layout-pro #dashboard-screen {
    padding: 0 !important;
    margin: 0 !important;
    background: #111827 !important;
}

.dashboard-layout-pro .screen {
    background: #111827 !important;
}

/* --- Header (top bar) --- */
.dashboard-layout-pro header {
    background: #1f2937 !important;
    border-bottom: 1px solid #374151 !important;
    border-radius: 0 !important;
    padding: 12px 24px !important;
    margin-bottom: 0 !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2) !important;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dashboard-layout-pro header h1 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #f3f4f6;
    font-size: 1.15em;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.dashboard-layout-pro header h1::before {
    content: '🛡️';
    font-size: 1.1em;
}

/* --- Hide user-info box (shown in sidebar if needed) --- */
.dashboard-layout-pro #user-info {
    display: none;
}

/* --- Cards (generic) --- */
.dashboard-layout-pro .card {
    background: #1f2937 !important;
    border: 1px solid #374151 !important;
    border-radius: 10px !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2) !important;
    margin-bottom: 0 !important;
    padding: 20px !important;
}

/* Remove the modern-layout colored bar */
.dashboard-layout-pro .card::before {
    display: none !important;
}

/* --- Typography --- */
.dashboard-layout-pro h2 {
    color: #f3f4f6 !important;
    font-size: 1.1em !important;
    font-weight: 600 !important;
    margin-bottom: 16px !important;
    letter-spacing: -0.01em;
    -webkit-text-fill-color: #f3f4f6 !important;
    background: none !important;
    -webkit-background-clip: unset !important;
    background-clip: unset !important;
}

.dashboard-layout-pro h3 {
    color: #d1d5db !important;
    font-size: 0.95em !important;
    font-weight: 600 !important;
    letter-spacing: -0.005em;
}

/* --- Stats Section --- */
.dashboard-layout-pro #dashboard-stats-section {
    background: #1f2937 !important;
    border: 1px solid #374151 !important;
    border-radius: 10px !important;
    padding: 20px !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2) !important;
}

.dashboard-layout-pro #dashboard-stats-section h2 {
    display: none;
}

.dashboard-layout-pro #dashboard-stats-cards {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 0;
    grid-template-columns: none;
}

.dashboard-layout-pro #dashboard-stats-cards .stat-card {
    background: #111827 !important;
    border: 1px solid #374151 !important;
    border-radius: 10px !important;
    padding: 18px 16px !important;
    color: #f3f4f6 !important;
    flex: 0 0 auto;
    width: 100%;
    aspect-ratio: 1 / 1 !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15) !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    box-sizing: border-box;
    overflow: hidden;
    position: relative;
    margin: 0;
}

.dashboard-layout-pro #dashboard-stats-cards .stat-card:hover {
    border-color: #3b82f6 !important;
    box-shadow: 0 4px 12px rgba(59,130,246,0.15) !important;
    transform: none;
    background: #1f2937 !important;
}

/* Force override ALL inline colors/opacity inside stat cards */
.dashboard-layout-pro #dashboard-stats-cards .stat-card,
.dashboard-layout-pro #dashboard-stats-cards .stat-card div,
.dashboard-layout-pro #dashboard-stats-cards .stat-card span {
    color: #f3f4f6 !important;
    -webkit-text-fill-color: #f3f4f6 !important;
    opacity: 1 !important;
}

.dashboard-layout-pro #dashboard-stats-cards .stat-card h3 {
    font-size: 13px !important;
    color: #9ca3af !important;
    -webkit-text-fill-color: #9ca3af !important;
    margin: 0 0 6px 0 !important;
    font-weight: 600;
    letter-spacing: 0.3px;
    line-height: 1.3;
    flex-shrink: 0;
    opacity: 1 !important;
}

/* Main number (first p) */
.dashboard-layout-pro #dashboard-stats-cards .stat-card p {
    font-size: 28px !important;
    font-weight: 700 !important;
    margin: 4px 0 !important;
    line-height: 1.2;
    flex-shrink: 0;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
    opacity: 1 !important;
}

/* Detail lines (smaller info paragraphs after the main number) */
.dashboard-layout-pro #dashboard-stats-cards .stat-card p ~ p {
    font-size: 12px !important;
    font-weight: 500 !important;
    color: #9ca3af !important;
    -webkit-text-fill-color: #9ca3af !important;
    margin: 3px 0 0 0 !important;
    line-height: 1.4;
    opacity: 1 !important;
}

/* Big emoji icon on the right side — make it very subtle */
.dashboard-layout-pro #dashboard-stats-cards .stat-card > div > div:last-child {
    opacity: 0.12 !important;
    font-size: 36px !important;
}

.dashboard-layout-pro #dashboard-stats-cards .stat-card ul {
    font-size: 11px;
    color: #94a3b8 !important;
    -webkit-text-fill-color: #94a3b8 !important;
    opacity: 1 !important;
    margin-top: 6px;
    padding-right: 0;
    list-style: none;
    text-align: center;
    line-height: 1.4;
    flex: 1;
    overflow-y: auto;
    max-height: 100%;
    width: 100%;
}

.dashboard-layout-pro #dashboard-stats-cards .stat-card ul li {
    margin-bottom: 2px;
    color: #94a3b8 !important;
    -webkit-text-fill-color: #94a3b8 !important;
    opacity: 1 !important;
}

/* Active camera indicator badge */
.dashboard-layout-pro #dashboard-stats-cards .stat-card .active-camera-indicator {
    background: #16a34a !important;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
    font-size: 11px !important;
    border-radius: 12px !important;
    padding: 3px 8px !important;
}

/* --- Stats + Video Grid Container --- */
.dashboard-layout-pro .desktop-stats-grid-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
    align-items: stretch;
}

.dashboard-layout-pro .desktop-stats-grid-container > * {
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.dashboard-layout-pro .desktop-stats-grid-container #dashboard-stats-section {
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 500px;
}

.dashboard-layout-pro .desktop-stats-grid-container #dashboard-stats-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    margin-top: 0;
    align-items: start;
    flex: 1;
}

.dashboard-layout-pro .desktop-stats-grid-container #dashboard-stats-cards .stat-card {
    width: 100%;
    aspect-ratio: 1 / 1 !important;
    max-width: 100%;
    height: auto;
    min-height: 0;
}

/* --- Video Streams (in stats area) --- */
.dashboard-layout-pro .desktop-stats-video-section {
    background: #1f2937 !important;
    border: 1px solid #374151 !important;
    border-radius: 10px !important;
    padding: 16px !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2) !important;
    display: flex;
    flex-direction: column;
    height: 500px;
    max-height: 500px;
    overflow: hidden;
}

.dashboard-layout-pro .desktop-stats-video-section h3 {
    color: #e2e8f0 !important;
    font-size: 0.95em !important;
    margin-bottom: 12px !important;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.dashboard-layout-pro .desktop-stats-video-streams-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.dashboard-layout-pro .desktop-stats-video-streams-grid .desktop-video-stream-item {
    border: 1px solid #374151 !important;
    border-radius: 8px !important;
    min-height: 0;
    overflow: hidden;
}

.dashboard-layout-pro .desktop-stats-video-section .grid-size-selector {
    background: rgba(17, 24, 39, 0.8);
    border-color: #374151;
}

.dashboard-layout-pro .desktop-stats-video-section .grid-size-btn {
    background: transparent !important;
    color: #94a3b8 !important;
    border: 1px solid transparent !important;
    border-radius: 6px !important;
    transition: all 0.15s ease;
}

.dashboard-layout-pro .desktop-stats-video-section .grid-size-btn:hover {
    background: #1e2940 !important;
    border-color: #374151 !important;
    color: #e2e8f0 !important;
}

.dashboard-layout-pro .desktop-stats-video-section .grid-size-btn.active {
    background: #2563eb !important;
    color: white !important;
    border-color: #3b82f6 !important;
}

/* --- Top Section (Map + Device List) --- */
.dashboard-layout-pro .desktop-top-section {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.dashboard-layout-pro .desktop-top-section > * {
    border: 1px solid #374151 !important;
    border-radius: 10px !important;
    background: #1f2937 !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2) !important;
}


/* --- Map Section --- */
.dashboard-layout-pro #devices-map-section {
    border: 1px solid #374151 !important;
    border-radius: 10px !important;
    background: #1f2937 !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2) !important;
    padding: 16px !important;
    min-height: 400px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.dashboard-layout-pro #devices-map-section h2 {
    font-size: 1em !important;
    margin-bottom: 10px !important;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.dashboard-layout-pro #devices-map-section h2::before {
    content: '📍';
}

.dashboard-layout-pro #devices-map {
    flex: 1;
    min-height: 400px;
    border-radius: 8px !important;
    overflow: hidden;
    margin-top: 0;
}

/* --- Main Grid --- */
.dashboard-layout-pro .desktop-main-grid {
    display: block;
    margin-bottom: 16px;
}

.dashboard-layout-pro .desktop-main-grid > * {
    border: 1px solid #374151 !important;
    border-radius: 10px !important;
    background: #1f2937 !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2) !important;
}

/* --- Devices Section --- */
.dashboard-layout-pro .desktop-devices-section {
    border: 1px solid #374151 !important;
    border-radius: 10px !important;
    background: #1f2937 !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2) !important;
    padding: 16px !important;
    margin-bottom: 0;
    height: 500px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.dashboard-layout-pro .desktop-devices-section h2 {
    font-size: 1em !important;
    margin-bottom: 10px !important;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.dashboard-layout-pro .desktop-devices-section h2::before {
    content: '📋';
}

.dashboard-layout-pro .desktop-devices-section #devices-search-input {
    flex-shrink: 0;
    margin-bottom: 10px;
    border: 1px solid #374151 !important;
    border-radius: 8px !important;
    padding: 10px 14px !important;
    font-size: 14px !important;
    background: #111827 !important;
    color: #e2e8f0 !important;
    transition: border-color 0.15s ease;
}

.dashboard-layout-pro .desktop-devices-section #devices-search-input:focus {
    border-color: #2563eb !important;
    outline: none;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.15) !important;
    background: #1f2937 !important;
}

.dashboard-layout-pro .desktop-devices-section #devices-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-right: 4px;
}

/* --- Video Streams Section (standalone) --- */
.dashboard-layout-pro .desktop-video-streams-section {
    border: 1px solid #374151 !important;
    border-radius: 10px !important;
    background: #1f2937 !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2) !important;
    padding: 16px !important;
    display: flex;
    flex-direction: column;
    height: 500px;
    overflow: hidden;
}

.dashboard-layout-pro .desktop-video-streams-section h3 {
    font-size: 1em !important;
    margin-bottom: 12px !important;
    flex-shrink: 0;
}

.dashboard-layout-pro .desktop-video-streams-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr 1fr 1fr;
    gap: 10px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.dashboard-layout-pro .desktop-video-stream-item {
    position: relative;
    background: linear-gradient(135deg, #111827 0%, #1f2937 100%);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #374151 !important;
    cursor: pointer;
    transition: border-color 0.15s ease;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
}

.dashboard-layout-pro .desktop-video-stream-item:hover {
    border-color: #2563eb !important;
    transform: none;
}

.dashboard-layout-pro .desktop-video-stream-item video,
.dashboard-layout-pro .desktop-video-stream-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dashboard-layout-pro .desktop-video-stream-item .stream-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(15,23,42,0.85), transparent);
    color: #f8fafc;
    padding: 8px 10px;
    font-size: 11px;
    text-align: center;
    font-weight: 500;
}

.dashboard-layout-pro .desktop-video-stream-item.empty .stream-label {
    background: none;
    color: #64748b;
}

.dashboard-layout-pro .desktop-video-stream-item .stream-status {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(34,197,94,0.9);
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
}

.dashboard-layout-pro .desktop-video-stream-item.empty {
    background: #111827;
    border: 1px dashed #374151 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #475569;
    font-size: 12px;
}

/* --- Bottom Grid (Alerts, Actions, Contacts, WhatsApp) --- */
.dashboard-layout-pro .desktop-bottom-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 16px;
}

.dashboard-layout-pro .desktop-bottom-grid > * {
    border: 1px solid #374151 !important;
    border-radius: 10px !important;
    background: #1f2937 !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2) !important;
}

/* Alerts */
.dashboard-layout-pro .desktop-alerts-section {
    padding: 20px !important;
    min-height: 200px;
}

.dashboard-layout-pro .desktop-alerts-section h3 {
    font-size: 1em !important;
    margin-bottom: 14px !important;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dashboard-layout-pro .desktop-alerts-section h3::before {
    content: '🔔';
    opacity: 0.8;
}

/* Quick Actions */
.dashboard-layout-pro .desktop-quick-actions {
    padding: 20px !important;
    min-height: 200px;
}

.dashboard-layout-pro .desktop-quick-actions h3 {
    font-size: 1em !important;
    margin-bottom: 14px !important;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dashboard-layout-pro .desktop-quick-actions h3::before {
    content: '⚙️';
    opacity: 0.8;
}

/* Buttons in Pro layout — solid, no gradients */
.dashboard-layout-pro .desktop-quick-actions .btn-primary,
.dashboard-layout-pro .desktop-contacts-section .btn-primary {
    background: #2563eb !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 8px !important;
    font-weight: 500 !important;
    box-shadow: 0 1px 2px rgba(37,99,235,0.2) !important;
    transition: background 0.15s ease, box-shadow 0.15s ease;
    width: 100%;
    margin-bottom: 10px;
    margin-top: 0;
}

.dashboard-layout-pro .desktop-quick-actions .btn-primary:hover,
.dashboard-layout-pro .desktop-contacts-section .btn-primary:hover {
    background: #1d4ed8 !important;
    box-shadow: 0 2px 6px rgba(37,99,235,0.3) !important;
}

.dashboard-layout-pro .desktop-quick-actions .btn-secondary {
    background: #111827 !important;
    color: #e2e8f0 !important;
    border: 1px solid #374151 !important;
    border-radius: 8px !important;
    font-weight: 500 !important;
    transition: background 0.15s ease;
    width: 100%;
    margin-bottom: 10px;
    margin-top: 0;
}

.dashboard-layout-pro .desktop-quick-actions .btn-secondary:hover {
    background: #1e2940 !important;
    border-color: #2563eb !important;
}

/* Contacts */
.dashboard-layout-pro .desktop-contacts-section {
    padding: 20px !important;
    min-height: 200px;
}

.dashboard-layout-pro .desktop-contacts-section h3 {
    font-size: 1em !important;
    margin-bottom: 14px !important;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dashboard-layout-pro .desktop-contacts-section h3::before {
    content: '📱';
    opacity: 0.8;
}

/* WhatsApp / Invites */
.dashboard-layout-pro .desktop-whatsapp-invite-section {
    padding: 20px !important;
    min-height: 200px;
}

.dashboard-layout-pro .desktop-whatsapp-invite-section h3 {
    font-size: 1em !important;
    margin-bottom: 14px !important;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dashboard-layout-pro .desktop-whatsapp-invite-section h3::before {
    content: '💬';
    opacity: 0.8;
}

/* --- Hide search filters & admin surplus in pro layout --- */
.dashboard-layout-pro #search-filters-section {
    display: none;
}

.dashboard-layout-pro #admin-sections > section:not(#devices-map-section):not(.desktop-devices-section):not(#admin-tools-section) {
    display: none;
}

.dashboard-layout-pro #admin-sections {
    display: block;
}

/* Hide device action buttons (duplicated in quick-actions) */
.dashboard-layout-pro .desktop-devices-section > div:first-of-type {
    display: none !important;
}

.dashboard-layout-pro .desktop-devices-section #show-add-device-btn,
.dashboard-layout-pro .desktop-devices-section #generate-pairing-code-btn,
.dashboard-layout-pro .desktop-devices-section #show-pairing-code-btn {
    display: none !important;
}

/* --- Scrollbar styling (subtle dark) --- */
.dashboard-layout-pro ::-webkit-scrollbar {
    width: 6px;
}

.dashboard-layout-pro ::-webkit-scrollbar-track {
    background: #111827;
}

.dashboard-layout-pro ::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 3px;
}

.dashboard-layout-pro ::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* --- General dark text overrides for pro layout --- */
.dashboard-layout-pro p,
.dashboard-layout-pro span,
.dashboard-layout-pro label,
.dashboard-layout-pro td,
.dashboard-layout-pro th,
.dashboard-layout-pro li {
    color: #cbd5e1;
}

.dashboard-layout-pro .device-item,
.dashboard-layout-pro .device-item span,
.dashboard-layout-pro .device-item p,
.dashboard-layout-pro .device-item small {
    color: #e2e8f0 !important;
}

.dashboard-layout-pro .device-item {
    background: #111827 !important;
    border: 1px solid #374151 !important;
    margin-bottom: 6px !important;
    padding: 0 !important;
}

.dashboard-layout-pro .device-item .device-item-header:hover {
    background: #162033 !important;
}

.dashboard-layout-pro .device-item.expanded {
    border-color: #2563eb !important;
}

.dashboard-layout-pro .device-item.expanded .device-expand-arrow {
    transform: rotate(180deg);
}

.dashboard-layout-pro .device-item.expanded .device-item-details {
    display: block !important;
}

.dashboard-layout-pro .device-item .device-item-details {
    border-top-color: #374151 !important;
}

.dashboard-layout-pro .device-item .device-item-details strong {
    color: #94a3b8 !important;
}

.dashboard-layout-pro .device-item .device-item-details p {
    color: #cbd5e1 !important;
}

.dashboard-layout-pro .logout-btn-top-left {
    background: #374151 !important;
    color: #e2e8f0 !important;
    border: 1px solid #334155 !important;
}

.dashboard-layout-pro .logout-btn-top-left:hover {
    background: #334155 !important;
}

.dashboard-layout-pro .layout-switcher-button {
    background: #374151 !important;
    color: #e2e8f0 !important;
    border: 1px solid #334155 !important;
}

.dashboard-layout-pro #layout-menu {
    background: #1f2937 !important;
    border: 1px solid #374151 !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4) !important;
}

.dashboard-layout-pro .layout-option {
    color: #e2e8f0 !important;
    background: transparent !important;
}

.dashboard-layout-pro .layout-option:hover {
    background: #1e2940 !important;
}

.dashboard-layout-pro .layout-menu-header {
    color: #94a3b8 !important;
    border-bottom-color: #374151 !important;
}

.dashboard-layout-pro .btn-secondary {
    background: #374151 !important;
    color: #e2e8f0 !important;
    border: 1px solid #334155 !important;
}

.dashboard-layout-pro .btn-secondary:hover {
    background: #334155 !important;
}

/* --- Pro Layout Auth Screen Override (keep light for login) --- */
body.dashboard-layout-pro #auth-screen .container,
.dashboard-layout-pro #auth-screen .container {
    background: #ffffff !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05) !important;
    max-width: 420px !important;
    padding: 32px !important;
}

/* Keep auth screen text dark */
body.dashboard-layout-pro #auth-screen p,
body.dashboard-layout-pro #auth-screen span,
body.dashboard-layout-pro #auth-screen label,
body.dashboard-layout-pro #auth-screen h1,
body.dashboard-layout-pro #auth-screen h2 {
    color: #333 !important;
}

/* --- Mobile Responsive --- */
@media (max-width: 1024px) {
    .dashboard-layout-pro .desktop-top-section {
        grid-template-columns: 1fr;
    }

    .dashboard-layout-pro .desktop-stats-grid-container {
        grid-template-columns: 1fr;
    }

    .dashboard-layout-pro .desktop-stats-video-streams-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-layout-pro .desktop-stats-video-section {
        min-height: 300px;
    }

    .dashboard-layout-pro .desktop-main-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-layout-pro .desktop-bottom-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-layout-pro #devices-map-section {
        height: 400px;
    }

    .dashboard-layout-pro .desktop-video-streams-section {
        height: 400px;
    }

    .dashboard-layout-pro .desktop-devices-section {
        height: auto;
        min-height: 300px;
    }

    /* On mobile, restore device action buttons */
    .dashboard-layout-pro .desktop-devices-section > div:first-of-type {
        display: flex !important;
    }

    .dashboard-layout-pro .desktop-devices-section #show-add-device-btn,
    .dashboard-layout-pro .desktop-devices-section #generate-pairing-code-btn,
    .dashboard-layout-pro .desktop-devices-section #show-pairing-code-btn {
        display: inline-block !important;
    }
}

/* --- Layout Switcher button override (keep subtle in pro) --- */
.dashboard-layout-pro .layout-switcher-button {
    background: #f8fafc !important;
    color: #334155 !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 8px !important;
    font-weight: 500 !important;
    font-size: 13px !important;
}

.dashboard-layout-pro .layout-switcher-button:hover {
    background: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
    box-shadow: none !important;
    transform: none !important;
}

.dashboard-layout-pro #logout-btn,
.dashboard-layout-pro .logout-btn-top-left {
    background: #f8fafc !important;
    color: #334155 !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 8px !important;
    font-weight: 500 !important;
    font-size: 13px !important;
    transition: background 0.15s ease;
}

.dashboard-layout-pro #logout-btn:hover,
.dashboard-layout-pro .logout-btn-top-left:hover {
    background: #fee2e2 !important;
    color: #dc2626 !important;
    border-color: #fecaca !important;
}

/* ── Mission Scenarios ─────────────────────────── */
.scenario-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 14px 16px;
    transition: box-shadow 0.2s;
}
.scenario-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.scenario-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}
.scenario-card-name {
    font-weight: 600;
    font-size: 15px;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.scenario-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}
.scenario-badge.draft      { background: #f1f5f9; color: #64748b; }
.scenario-badge.ready      { background: #dbeafe; color: #2563eb; }
.scenario-badge.armed      { background: #dcfce7; color: #16a34a; }
.scenario-badge.triggered  { background: #fef3c7; color: #d97706; }
.scenario-badge.completed  { background: #e0e7ff; color: #4338ca; }
.scenario-badge.disabled   { background: #f1f5f9; color: #94a3b8; }

.scenario-card-body {
    margin-top: 8px;
    font-size: 13px;
    color: #666;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}
.scenario-card-actions {
    display: flex;
    gap: 6px;
    margin-top: 10px;
}
.scenario-card-actions button {
    padding: 5px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.15s;
}
.scenario-card-actions button:hover {
    background: #f8f9fa;
}

/* Scenario wizard steps */
.scenario-step {
    flex: 1;
    text-align: center;
    padding: 12px 4px;
    font-size: 13px;
    font-weight: 500;
    color: #94a3b8;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
    cursor: default;
    white-space: nowrap;
}
.scenario-step span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #e2e8f0;
    color: #94a3b8;
    font-weight: 700;
    font-size: 12px;
    margin-left: 6px;
    vertical-align: middle;
}
.scenario-step.active {
    color: #2563eb;
    border-color: #2563eb;
}
.scenario-step.active span {
    background: #2563eb;
    color: #fff;
}
.scenario-step.done {
    color: #16a34a;
    border-color: #16a34a;
}
.scenario-step.done span {
    background: #16a34a;
    color: #fff;
}

.scenario-trigger-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.15s;
    user-select: none;
}
.scenario-trigger-option:hover {
    background: #f0f7ff;
    border-color: #93c5fd;
}
.scenario-trigger-option:has(input:checked) {
    background: #eff6ff;
    border-color: #3b82f6;
    box-shadow: 0 0 0 1px #3b82f6;
}
.scenario-trigger-option input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #2563eb;
}

.scenario-action-row {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 14px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    flex-wrap: wrap;
}
.scenario-action-row select,
.scenario-action-row input {
    padding: 10px 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
}

.scenario-device-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 13px;
}
.scenario-device-row.online  { background: #f0fdf4; }
.scenario-device-row.offline { background: #fef2f2; }

/* Dark theme support for pro layout */
.dashboard-layout-pro .scenario-card {
    background: #1f2937;
    border-color: #374151;
}
.dashboard-layout-pro .scenario-card-name { color: #f3f4f6; }
.dashboard-layout-pro .scenario-card-body { color: #9ca3af; }
.dashboard-layout-pro .scenario-card-actions button {
    background: #374151;
    border-color: #4b5563;
    color: #e5e7eb;
}
.dashboard-layout-pro .scenario-card-actions button:hover {
    background: #4b5563;
}
.dashboard-layout-pro .scenario-trigger-option {
    border-color: #374151;
    color: #e5e7eb;
}
.dashboard-layout-pro .scenario-trigger-option:hover {
    background: #1e3a5f;
    border-color: #60a5fa;
}
.dashboard-layout-pro .scenario-action-row {
    background: #374151;
    color: #e5e7eb;
}
.dashboard-layout-pro #scenario-review-summary {
    background: #374151;
    color: #e5e7eb;
}

/* ── Fullscreen video container ──── */
[id^="screen-video-container"]:fullscreen,
[id^="screen-video-container"]:-webkit-full-screen {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: #000 !important;
    overflow: hidden !important;
}

[id^="screen-video-container"]:fullscreen > img,
[id^="screen-video-container"]:-webkit-full-screen > img {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
}

.modal:fullscreen,
.modal:-webkit-full-screen {
    background: #000 !important;
}

.modal:fullscreen .modal-content,
.modal:-webkit-full-screen .modal-content {
    max-width: 100% !important;
    max-height: 100% !important;
    width: 100% !important;
    height: 100% !important;
    border-radius: 0 !important;
}

.modal:fullscreen img[id^="android-stream-img"],
.modal:-webkit-full-screen img[id^="android-stream-img"] {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
}

/* ── Drone modal mobile responsive ──── */
@media screen and (max-width: 768px) {
    [id^="drone-main-layout"] {
        flex-direction: column !important;
    }
    .drone-panel-side {
        display: none !important;
    }
    .drone-panel-side.mobile-visible {
        display: flex !important;
        width: 100% !important;
        max-height: 40vh !important;
        margin: 0 !important;
        border-radius: 0 !important;
    }
    [id^="screen-video-container"] {
        min-height: 40vh !important;
        border-radius: 0 !important;
    }
    .drone-mobile-toggle-bar {
        display: flex !important;
    }
    .modal-overlay .modal-content {
        padding: 4px !important;
        border-radius: 0 !important;
        max-width: 100% !important;
        max-height: 100vh !important;
    }
    .modal-overlay .modal-content > div:first-child {
        padding: 4px 8px !important;
        margin-bottom: 2px !important;
    }
    .modal-overlay .modal-content > div:first-child h2 {
        font-size: 12px !important;
        padding: 0 4px !important;
    }
    .modal-overlay .modal-content > div:first-child [id^="fullscreen-android-view-dropdown"] {
        display: none !important;
    }
    .modal-overlay .modal-content > div:first-child [id^="streaming-mode-toggle"] {
        display: none !important;
    }
    .modal-overlay .modal-content > div:last-child {
        margin-top: 2px !important;
    }
}
@media screen and (max-width: 768px) and (orientation: landscape) {
    [id^="drone-main-layout"] {
        flex-direction: row !important;
    }
    .drone-panel-side {
        display: none !important;
    }
    .drone-panel-side.mobile-visible {
        display: flex !important;
        width: 200px !important;
        max-height: 100% !important;
    }
    [id^="screen-video-container"] {
        min-height: auto !important;
        flex: 1 !important;
    }
}
@media screen and (min-width: 769px) {
    .drone-mobile-toggle-bar {
        display: none !important;
    }
}

/* ── Scenario Wizard (full-screen overlay) ──── */
.scenario-wizard-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10001;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px;
}
.scenario-wizard-panel {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 960px;
    max-height: calc(100vh - 32px);
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalFadeIn 0.25s ease;
    overflow: hidden;
}
.scenario-wizard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}
.scenario-wizard-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
}
.scenario-wizard-close {
    width: 36px;
    height: 36px;
    border: none;
    background: #f1f5f9;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.scenario-wizard-close:hover {
    background: #e2e8f0;
}
.scenario-wizard-steps {
    display: flex;
    gap: 0;
    padding: 0 24px;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}
.scenario-wizard-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}
.scenario-step-title {
    font-size: 17px;
    font-weight: 700;
    margin: 0 0 16px;
    color: #1e293b;
}
.scenario-wizard-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
    background: #fafbfc;
}
#scenario-map-wrapper {
    position: relative;
}
#scenario-map {
    transition: height 0.3s ease;
}

/* Dark theme wizard */
.dashboard-layout-pro .scenario-wizard-panel {
    background: #1f2937;
}
.dashboard-layout-pro .scenario-wizard-header {
    border-color: #374151;
}
.dashboard-layout-pro .scenario-wizard-header h2 {
    color: #f3f4f6;
}
.dashboard-layout-pro .scenario-wizard-close {
    background: #374151;
    color: #e5e7eb;
}
.dashboard-layout-pro .scenario-wizard-close:hover {
    background: #4b5563;
}
.dashboard-layout-pro .scenario-wizard-steps {
    border-color: #374151;
}
.dashboard-layout-pro .scenario-wizard-body {
    color: #e5e7eb;
}
.dashboard-layout-pro .scenario-step-title {
    color: #f3f4f6;
}
.dashboard-layout-pro .scenario-wizard-footer {
    border-color: #374151;
    background: #111827;
}

/* Wizard mobile responsive */
@media (max-width: 600px) {
    .scenario-wizard-overlay {
        padding: 0;
    }
    .scenario-wizard-panel {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
    .scenario-wizard-header {
        padding: 14px 16px;
    }
    .scenario-wizard-steps {
        padding: 0 12px;
        overflow-x: auto;
    }
    .scenario-wizard-body {
        padding: 16px;
    }
    .scenario-wizard-footer {
        padding: 12px 16px;
    }
    #scenario-map {
        height: 45vh !important;
        min-height: 280px !important;
    }
}

/* Mobile: hide full scenario list, show compact trigger */
@media (max-width: 768px) {
    #scenarios-section #scenarios-list,
    #scenarios-section #scenarios-empty {
        display: none !important;
    }
    #scenarios-section {
        padding: 12px 15px !important;
    }
}

/* Mobile adjustments for layouts */
@media (max-width: 768px) {
    #layout-switcher {
        position: relative;
    }
    
    #layout-switcher-btn {
        font-size: 12px;
        padding: 6px 10px;
    }
    
    #layout-menu {
        left: auto;
        right: 0;
        min-width: 150px;
        max-height: 300px;
    }
    
    .dashboard-layout-grid .card {
        grid-template-columns: 1fr;
    }
    
    .dashboard-layout-grid #devices-list {
        grid-template-columns: 1fr;
    }
    
    .dashboard-layout-grid #user-info {
        grid-template-columns: 1fr;
    }
    
    .dashboard-layout-sidebar {
        grid-template-columns: 1fr;
    }
    
    .dashboard-layout-modern .card {
        padding: 15px;
    }
    
    .dashboard-layout-modern h2 {
        font-size: 1.3em;
    }
}

/* ─── Loading Skeleton Placeholders ─── */
@keyframes skeleton-pulse {
    0% { opacity: 0.4; }
    50% { opacity: 1; }
    100% { opacity: 0.4; }
}
@keyframes skeleton-slide {
    0% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}

.skeleton-line {
    height: 14px;
    border-radius: 6px;
    background: #e2e8f0;
    animation: skeleton-pulse 1.4s ease-in-out infinite;
    margin-bottom: 8px;
}
.skeleton-line.tall { height: 32px; margin-top: 6px; }
.skeleton-line.w80 { width: 80%; }
.skeleton-line.w60 { width: 60%; }
.skeleton-line.w40 { width: 40%; }

.skeleton-card {
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
    padding: 20px;
    border-radius: 10px;
    min-height: 90px;
}

.skeleton-rows { display: flex; flex-direction: column; gap: 12px; }
.skeleton-row {
    background: #f8fafc;
    padding: 14px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.skeleton-device {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}
.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e2e8f0;
    flex-shrink: 0;
    animation: skeleton-pulse 1.4s ease-in-out infinite;
}

.skeleton-map {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e8edf3;
    border-radius: 5px;
    overflow: hidden;
    color: #94a3b8;
    font-size: 16px;
}
.skeleton-map .skeleton-shimmer {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.4) 50%, transparent 100%);
    animation: skeleton-slide 1.8s ease-in-out infinite;
}

/* Dark theme skeletons */
body.dark-theme .skeleton-line { background: #334155; }
body.dark-theme .skeleton-card { background: linear-gradient(135deg, #1e293b, #334155); }
body.dark-theme .skeleton-row,
body.dark-theme .skeleton-device { background: #1e293b; border-color: #334155; }
body.dark-theme .skeleton-avatar { background: #334155; }
body.dark-theme .skeleton-map { background: #1e293b; color: #64748b; }

/* Stream-stopped overlay (shown over frozen frame) */
.stream-stopped-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    pointer-events: none;
    color: #fff;
    font-size: 14px;
    text-align: center;
    gap: 6px;
    backdrop-filter: blur(2px);
}
.stream-stopped-overlay .stream-stopped-icon {
    font-size: 32px;
    animation: stream-stopped-pulse 2s ease-in-out infinite;
}
@keyframes stream-stopped-pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* WebRTC live stream indicator in grid tiles */
.webrtc-live-indicator {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    position: relative;
    overflow: hidden;
    cursor: pointer;
}
.webrtc-live-pulse {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(231, 76, 60, 0.15) 0%, transparent 70%);
    animation: webrtc-pulse 2s ease-in-out infinite;
}
.webrtc-live-icon {
    font-size: 36px;
    z-index: 1;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.3));
}
.webrtc-live-text {
    color: #e74c3c;
    font-weight: 700;
    font-size: 14px;
    margin-top: 8px;
    z-index: 1;
    letter-spacing: 1px;
}
.webrtc-live-hint {
    color: rgba(255,255,255,0.5);
    font-size: 11px;
    margin-top: 4px;
    z-index: 1;
}
@keyframes webrtc-pulse {
    0%, 100% { opacity: 0.5; transform: scale(0.95); }
    50% { opacity: 1; transform: scale(1.05); }
}

/* ══════════════════════════════════════════════════════════════
   Interceptor PiP — Inline floating video overlay
   ══════════════════════════════════════════════════════════════ */

.interceptor-pip {
    position: fixed;
    bottom: 80px;
    left: 20px;
    width: 340px;
    z-index: 10001;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,255,255,0.08);
    background: #0e0e1c;
    transition: box-shadow 0.3s;
    resize: both;
    min-width: 240px;
    min-height: 180px;
    max-width: 600px;
}

.interceptor-pip:hover {
    box-shadow: 0 12px 40px rgba(0,0,0,0.8), 0 0 0 1px rgba(211,47,47,0.3);
}

.interceptor-pip-header {
    display: flex;
    align-items: center;
    padding: 6px 10px;
    background: rgba(211,47,47,0.85);
    color: #fff;
    cursor: grab;
    user-select: none;
    direction: rtl;
    gap: 6px;
}

.interceptor-pip-header:active {
    cursor: grabbing;
}

.interceptor-pip-video-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    overflow: hidden;
}

.interceptor-pip-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: none;
}

.interceptor-pip-detection-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.interceptor-pip-status {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    background: rgba(14,14,28,0.95);
    color: #ccc;
    font-size: 10px;
    direction: rtl;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.interceptor-pip-minimized .interceptor-pip-video-container,
.interceptor-pip-minimized .interceptor-pip-status {
    display: none;
}

.interceptor-pip-minimized {
    min-height: auto;
    resize: none;
}

@keyframes pip-handoff-pulse {
    0% { box-shadow: 0 8px 32px rgba(0,0,0,0.7), 0 0 0 2px rgba(46,125,50,0.8); }
    50% { box-shadow: 0 8px 40px rgba(46,125,50,0.5), 0 0 20px rgba(46,125,50,0.6), 0 0 0 3px rgba(46,125,50,1); }
    100% { box-shadow: 0 8px 32px rgba(0,0,0,0.7), 0 0 0 2px rgba(46,125,50,0.8); }
}

.interceptor-pip-handoff-success {
    box-shadow: 0 8px 32px rgba(0,0,0,0.7), 0 0 0 2px rgba(46,125,50,0.8) !important;
}

.interceptor-pip-handoff-success .interceptor-pip-status {
    background: rgba(46,125,50,0.15);
    color: #81c784;
}

.interceptor-pip-target-relayed {
    box-shadow: 0 8px 32px rgba(0,0,0,0.7), 0 0 0 2px rgba(255,152,0,0.6) !important;
}

.interceptor-pip-target-relayed .interceptor-pip-status {
    background: rgba(255,152,0,0.1);
    color: #ffb74d;
}

@media (max-width: 768px) {
    .interceptor-pip {
        left: 0;
        bottom: 0;
        width: 100%;
        max-width: 100%;
        border-radius: 10px 10px 0 0;
        resize: none;
    }
}

