/* Preview image styling */
.preview-section img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.preview-section img:hover {
    transform: scale(1.02);
}

/* Ensure preview images maintain proper aspect ratio */
#preview {
    object-fit: contain;
    width: 100%;
    max-height: 300px;
    background-color: #f8f9fa;
    border: 1px solid var(--border-color);
}

/* Thermal state color classes */
.thermal-state-value.thermal-critical {
    color: #dc3545; /* Bootstrap red */
    font-weight: bold;
}
.thermal-state-value.thermal-serious {
    color: #fd7e14; /* Bootstrap orange */
    font-weight: bold;
}
.thermal-state-value.thermal-fair {
    color: #ffc107; /* Bootstrap yellow */
    font-weight: bold;
}
.thermal-state-value.thermal-normal {
    color: #198754; /* Bootstrap green */
    font-weight: bold;
}
/* iPole Device Dashboard Styles */

:root {
    --primary-color: #6c757d;
    --secondary-color: #495057;
    --accent-color: #343a40;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --light-bg: #f8f9fa;
    --white: #ffffff;
    --border-color: #dee2e6;
    --text-muted: #6c757d;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--light-bg);
    color: var(--secondary-color);
}

/* Modern single-line header */
.main-container {
    background: var(--white);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 1rem;
    padding: 1.25rem;
    margin-top: 1rem;
}
.header-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Smart Search Bar Styles */
.smart-search-container {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 12px;
    color: var(--text-muted);
    font-size: 1rem;
    z-index: 10;
}

.smart-search-input {
    padding-left: 2.5rem;
    padding-right: 2.5rem;
    border: 2px solid #e3f2fd;
    border-radius: 25px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    background-color: #fafafa;
	padding-left: 35px !important;
}

.smart-search-input:focus {
    border-color: #2196f3;
    box-shadow: 0 0 0 0.2rem rgba(33, 150, 243, 0.25);
    background-color: var(--white);
    outline: none;
}

.smart-search-input::placeholder {
    color: #9e9e9e;
    font-style: italic;
	position: relative;
}

.search-clear-btn {
    position: absolute;
    right: 8px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    padding: 4px 6px;
    border-radius: 50%;
    transition: all 0.2s ease;
    z-index: 10;
}

.search-clear-btn:hover {
    background-color: #f5f5f5;
    color: var(--danger-color);
}

.search-suggestions {
    margin-top: 0.5rem;
}

.search-tip {
    background-color: #e3f2fd;
    color: #1976d2;
    padding: 2px 8px;
    border-radius: 12px;
    cursor: pointer;
    margin-right: 8px;
    font-size: 0.8rem;
    transition: all 0.2s ease;
    display: inline-block;
    margin-bottom: 4px;
}

.search-tip:hover {
    background-color: #bbdefb;
    transform: translateY(-1px);
}

/* Search highlight styles */
.search-highlight {
    background-color: #fff3cd;
    padding: 1px 3px;
    border-radius: 3px;
    font-weight: 600;
    color: #856404;
}

/* Search results info */
#search-results-info {
    animation: fadeIn 0.3s ease;
}

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

/* Spinning animation for refresh button */
.spin {
    animation: spin 1s linear infinite;
}

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

/* Search active state for device cards */
.device-card.search-match {
    border-color: #2196f3 !important;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.2) !important;
    animation: searchPulse 0.5s ease;
}

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

.device-card.search-hidden {
    display: none !important;
}

/* Search no results state */
.search-no-results {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

.search-no-results i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
    color: #2196f3;
}

/* Filter no results state */
.filter-no-results {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

.filter-no-results i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
    color: var(--primary-color);
}

/* Show All Cameras button styling */
.show-all-cameras-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.5;
    border-radius: 0.25rem;
    transition: all 0.15s ease-in-out;
}

.show-all-cameras-btn i {
    font-size: 1rem !important;
    margin: 0;
    opacity: 1;
}

.show-all-cameras-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.show-all-cameras-btn:hover i {
    opacity: 1;
}

/* Clear Search button styling */
.clear-search-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.5;
    border-radius: 0.25rem;
    transition: all 0.15s ease-in-out;
}

.clear-search-btn i {
    font-size: 1rem !important;
    margin: 0;
    opacity: 1;
}

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

.clear-search-btn:hover i {
    opacity: 1;
}

/* Modal improvements */
.modal-header {
    background-color: var(--light-bg);
    border-bottom: 1px solid var(--border-color);
}

.modal-title i {
    color: var(--primary-color);
    margin-right: 0.5rem;
}

.header-icon {
    color: var(--primary-color);
    font-size: 1.75rem;
    margin-right: 1rem;
}

.dashboard-title {
    color: var(--accent-color);
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.1;
    margin-bottom: 0.2rem !important;
}

.description {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 0;
}

.server-status-compact {
    background-color: var(--light-bg);
    border-radius: 6px;
    padding: 0.5rem 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.status-pill {
    font-size: 0.8rem;
    padding: 0.5rem 0.75rem;
    border-radius: 20px;
}

.device-count {
    color: var(--secondary-color);
    font-size: 0.9rem;
    white-space: nowrap;
}

/* Responsive adjustments for header */
@media (max-width: 992px) {
    .header-wrapper {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .server-status-compact {
        /* margin-top: 1rem; */
        width: 100%;
    }
}

@media (max-width: 576px) {
    .header-icon {
        font-size: 1.5rem;
    }
    
    .dashboard-title {
        font-size: 1.25rem;
    }
}

/* Devices Grid */
.devices-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(430px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
    transition: all 0.3s ease;
}

/* Hide card view when in list mode */
.devices-grid.list-view {
    display: none !important;
}

/* Show table view when in list mode */
.devices-table-container {
    display: none !important;
    margin-bottom: 2rem;
}

.devices-grid.list-view + .devices-table-container {
    display: block !important;
}

/* Professional Table Styling */
.devices-table-container {
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.devices-table {
    margin-bottom: 0;
    font-size: 0.9rem;
}

/* Table Header Styling */
.table-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 2px solid var(--border-color);
}

.table-header th {
    border: none;
    padding: 1rem 0.75rem;
    font-weight: 600;
    color: var(--secondary-color);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    vertical-align: middle;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
}

.table-header th:hover {
    background-color: rgba(108, 117, 125, 0.1);
}

.table-header th.sortable {
    cursor: pointer;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    white-space: nowrap;
}

.header-content i.sort-icon {
    font-size: 0.7rem;
    color: var(--text-muted);
    opacity: 0.6;
    transition: all 0.2s ease;
}

.table-header th:hover .sort-icon {
    opacity: 1;
    color: var(--primary-color);
}

.table-header th.sorted-asc .sort-icon::before {
    content: "\f143"; /* bi-chevron-up */
    color: var(--primary-color);
}

.table-header th.sorted-desc .sort-icon::before {
    content: "\f140"; /* bi-chevron-down */
    color: var(--primary-color);
}

/* Table Body Styling */
.devices-table tbody tr {
    border-bottom: 1px solid #f1f3f4;
    transition: all 0.2s ease;
}

.devices-table tbody tr:hover {
    background-color: #f8f9fa;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.devices-table tbody tr.online {
    border-left: 4px solid var(--success-color);
}

.devices-table tbody tr.offline {
    border-left: 4px solid var(--text-muted);
    opacity: 0.9;
}

.devices-table tbody tr.recording {
    border-left: 4px solid var(--danger-color);
    animation: pulse-border-left 2s infinite;
}

@keyframes pulse-border-left {
    0% { border-left-color: var(--danger-color); }
    50% { border-left-color: #ff6b6b; }
    100% { border-left-color: var(--danger-color); }
}

.devices-table tbody td {
    padding: 1rem 0.75rem;
    vertical-align: middle;
    border: none;
}

/* Device Name Cell */
.device-name-cell {
    min-width: 200px;
}

.device-name-container {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.camera-name-input {
    border: none !important;
    background: transparent !important;
    font-weight: 600 !important;
    font-size: 1rem !important;
    color: var(--accent-color) !important;
    padding: 4px 6px !important;
    margin: 0 !important;
    transition: all 0.2s ease;
    min-width: 140px;
    border-radius: 4px !important;
}

.camera-name-input:hover {
    background-color: rgba(0, 0, 0, 0.05) !important;
}

.camera-name-input:focus {
    background-color: var(--white) !important;
    border: 1px solid var(--primary-color) !important;
    box-shadow: 0 0 0 0.15rem rgba(108, 117, 125, 0.15) !important;
}

.device-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Status Cell */
.status-cell {
    text-align: center;
    min-width: 100px;
}

.status-badge {
    font-size: 0.8rem;
    padding: 0.4rem 0.75rem;
    border-radius: 20px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.status-badge.online {
    background-color: var(--success-color) !important;
    color: white;
}

.status-badge.offline {
    background-color: var(--text-muted) !important;
    color: white;
}

.status-badge i {
    font-size: 0.6rem;
}

/* General table styling */
.devices-table td {
    vertical-align: middle;
    padding: 0.75rem 0.5rem;
}

.devices-table tbody tr {
    border-bottom: 1px solid var(--border-color);
}

/* Status Item Inline */
.status-item-inline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
}

.status-item-inline i {
    font-size: 1rem;
    flex-shrink: 0;
}

/* Battery Cell */
.battery-cell {
    text-align: center;
    min-width: 90px;
}

.battery-value {
    font-weight: 600;
}

.battery-low { color: var(--danger-color) !important; }
.battery-medium { color: var(--warning-color) !important; }
.battery-high { color: var(--success-color) !important; }

/* Recording Cell */
.recording-cell {
    text-align: center;
    min-width: 100px;
}

.recording-icon.recording {
    color: var(--danger-color) !important;
    animation: pulse-icon 1.5s infinite;
}

.recording-status {
    font-weight: 500;
}

/* Duration Cell */
.duration-cell {
    text-align: center;
    min-width: 90px;
}

.duration-value.recording {
    color: var(--danger-color) !important;
    font-weight: 600;
    animation: pulse-text 1.5s infinite;
}

/* Thermal Cell */
.thermal-cell {
    text-align: center;
    min-width: 100px;
}

.thermal-state-value {
    font-weight: 500;
    text-transform: capitalize;
}

.thermal-state-value.thermal-critical { color: var(--danger-color) !important; }
.thermal-state-value.thermal-serious { color: #fd7e14 !important; }
.thermal-state-value.thermal-fair { color: var(--warning-color) !important; }
.thermal-state-value.thermal-normal { color: var(--success-color) !important; }

/* Camera Cell */
.camera-cell {
    min-width: 180px;
}




/* Network Cell */
.network-cell {
    text-align: center;
    min-width: 100px;
}

.network-badge {
    font-size: 0.8rem;
    padding: 0.3rem 0.6rem;
    border-radius: 15px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

/* Actions Cell */
.actions-cell {
    min-width: 250px;
    text-align: center;
    padding: 0.75rem 0.5rem;
    vertical-align: middle;
}

.actions-cell .btn-group {
    gap: 0.375rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    height: 100%;
}

.actions-cell .btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    min-width: 36px;
    border: 1px solid transparent;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    vertical-align: middle;
}

.actions-cell .btn i {
    font-size: 1rem;
    margin: 0;
}

.actions-cell .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

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

.actions-cell .record-btn {
    background-color: var(--success-color);
    border-color: var(--success-color);
    color: white;
}

.actions-cell .record-btn:hover {
    background-color: #218838;
    border-color: #218838;
    color: white;
}

.actions-cell .record-btn.recording {
    background-color: var(--danger-color);
    border-color: var(--danger-color);
    animation: pulse-button 1.5s infinite;
    color: white;
}

.actions-cell .record-btn.recording:hover {
    background-color: #c82333;
    border-color: #c82333;
    color: white;
}

.actions-cell .record-btn.offline {
    background-color: var(--text-muted);
    border-color: var(--text-muted);
    opacity: 0.6;
    cursor: not-allowed;
}

.actions-cell .display-off-btn {
    background-color: #343a40;
    border-color: #343a40;
    color: white;
}

.actions-cell .display-off-btn:hover {
    background-color: #23272b;
    border-color: #23272b;
    color: white;
}


.actions-cell .logs-btn {
    background-color: #17a2b8;
    border-color: #17a2b8;
    color: white;
    text-decoration: none;
}

.actions-cell .logs-btn:hover {
    background-color: #138496;
    border-color: #138496;
    color: white;
    text-decoration: none;
}

.actions-cell .delete-btn {
    background-color: transparent;
    border-color: var(--danger-color);
    color: var(--danger-color);
}

.actions-cell .delete-btn:hover {
    background-color: var(--danger-color);
    border-color: var(--danger-color);
    color: white;
}

.actions-cell .btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Pulse animation for recording button */
@keyframes pulse-button {
    0% { box-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 0 0 0 rgba(220, 53, 69, 0.4); }
    70% { box-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 0 0 8px rgba(220, 53, 69, 0); }
    100% { box-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 0 0 0 rgba(220, 53, 69, 0); }
}

/* View Mode Toggle Styles */
.view-mode-toggle .btn-group {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.view-mode-toggle .btn {
    border-radius: 0;
    padding: 0.6rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-color: var(--primary-color);
    transition: all 0.2s ease;
}

.view-mode-toggle .btn:first-child {
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
}

.view-mode-toggle .btn:last-child {
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
}

.view-mode-toggle .btn.active {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
    transform: translateY(1px);
}

.view-mode-toggle .btn:not(.active) {
    background-color: transparent;
    color: var(--primary-color);
}

.view-mode-toggle .btn:not(.active):hover {
    background-color: rgba(108, 117, 125, 0.1);
    transform: translateY(-1px);
}

/* Responsive Design for Table View */
@media (max-width: 1400px) {
    .thermal-header,
    .thermal-cell {
        display: none;
    }
}

@media (max-width: 1200px) {
    .network-header,
    .network-cell {
        display: none;
    }
    
    .duration-header,
    .duration-cell {
        display: none;
    }
}

@media (max-width: 992px) {
    .devices-table-container {
        border-radius: 8px;
    }
    
    .table-header th {
        padding: 0.75rem 0.5rem;
        font-size: 0.8rem;
    }
    
    .devices-table tbody td {
        padding: 0.75rem 0.5rem;
    }
    
    .camera-header,
    .camera-cell {
        display: none;
    }
    
    .actions-cell .btn {
        padding: 0.25rem 0.375rem;
        font-size: 0.75rem;
    }
}

@media (max-width: 768px) {
    /* Switch to mobile card layout for very small screens */
    .devices-table-container {
        display: none !important;
    }
    
    .devices-grid.list-view {
        display: block !important;
    }
    
    .devices-grid.list-view .device-card {
        margin-bottom: 1rem;
    }
    
    .devices-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    /* Hide text labels on small screens for view toggle */
    .view-mode-toggle .btn span {
        display: none !important;
    }
}

/* Animation for table rows */
.device-list-item {
    animation: slideInTable 0.3s ease;
}

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

/* Search highlight styles for table view */
.device-list-item.search-match {
    background-color: rgba(33, 150, 243, 0.05) !important;
    border-left-color: #2196f3 !important;
    animation: searchPulseTable 0.5s ease;
}

@keyframes searchPulseTable {
    0% { transform: translateY(0); }
    25% { transform: translateY(-2px); }
    75% { transform: translateY(2px); }
    100% { transform: translateY(0); }
}

.device-list-item.search-hidden {
    display: none !important;
}

.device-list-item.filter-hidden {
    display: none !important;
}

/* Table empty state */
.devices-table-container .empty-state {
    text-align: center;
    padding: 3rem 2rem;
    background: var(--white);
    border-radius: 8px;
    margin: 2rem 0;
}

@media (max-width: 768px) {
    .devices-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    /* Mobile responsiveness for table actions */
    .actions-cell {
        min-width: 200px;
    }
    
    .actions-cell .btn {
        min-height: 32px;
        min-width: 32px;
        padding: 0.375rem 0.5rem;
    }
    
    .actions-cell .btn i {
        font-size: 0.875rem;
    }
}

/* Stack buttons vertically on very small screens */
@media (max-width: 480px) {
    .actions-cell .btn-group {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .actions-cell .btn {
        width: 100%;
        min-width: auto;
    }
}

/* Device Card Styling */
.device-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    animation: slideIn 0.5s ease;
}

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

.device-card .card {
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    height: 100%;
}

.device-card.online .card {
    border-color: var(--success-color);
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.15);
}

.device-card.offline .card {
    border-color: var(--border-color);
    opacity: 0.8;
    background-color: #fff9f9;
}

.device-card.recording .card {
    border-color: var(--danger-color);
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.2);
    animation: pulse-border 2s infinite;
}

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

.device-card .card-header, .camera-card .card-header {
    background-color: var(--white);
    border-bottom: 1px solid var(--border-color);
}

.device-card .card-title, .camera-card .card-title {
    color: var(--accent-color);
    font-size: 1.1rem;
    margin-bottom: 0;
    display: flex;
}

.device-card .card-title i , .camera-card .card-title i {
    color: var(--primary-color);
    margin-right: 0.5rem;
    display: flex;
    align-items: center;
}

.device-card .device-actions {
    display: flex;
    align-items: center;
}

/* Status Badge */
.status-badge {
    font-size: 0.8rem;
    height: fit-content;
}

.status-badge.online {
    background-color: var(--success-color) !important;
}

.status-badge.offline {
    background-color: var(--text-muted) !important;
}

.status-badge i {
    font-size: 0.6rem;
    margin-right: 0.25rem;
}

/* Status Grid - Updated to single row */
.status-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* Changed from 2 to 4 columns */
    gap: 0.5rem; /* Reduced gap size */
}

.status-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0.5rem; /* Reduced padding for compactness */
    background: var(--light-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    transition: transform 0.2s ease;
}

.status-item:hover {
    transform: translateY(-1px);
}

.status-item i {
    font-size: 1rem; /* Smaller icon size */
    color: var(--primary-color);
    margin-bottom: 0.2rem;
}

.status-item .recording-icon.recording {
    color: var(--danger-color);
    animation: pulse-icon 1.5s infinite;
}

@keyframes pulse-icon {
    0% { opacity: 1; }
    50% { opacity: 0.6; }
    100% { opacity: 1; }
}

.status-label {
    font-size: 0.65rem; /* Smaller label size */
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.1rem;
}

.status-value {
    font-size: 0.85rem; /* Smaller value size */
    font-weight: 600;
    color: var(--accent-color);
}

/* Responsive adjustments for status grid */
@media (max-width: 576px) {
    .status-grid {
        grid-template-columns: repeat(2, 1fr); /* On small screens, use 2 columns */
        gap: 0.5rem;
    }
    
    .main-container {
        padding: 1rem;
    }
    
    .dashboard-title {
        font-size: 1.5rem;
    }
    
    .status-item {
        padding: 0.5rem;
    }
}

/* Recording duration status */
.duration-value.recording {
    color: var(--danger-color) !important;
    animation: pulse-text 1.5s infinite;
}

@keyframes pulse-text {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

/* Battery Status Colors */
.battery-low { color: var(--danger-color) !important; }
.battery-medium { color: var(--warning-color) !important; }
.battery-high { color: var(--success-color) !important; }

/* Temperature Status Colors */
.temp-normal { color: var(--success-color) !important; }
.temp-warm { color: var(--warning-color) !important; }
.temp-hot { color: var(--danger-color) !important; }

/* Device Name Input */
.camera-name-input {
    border: none !important;
    background: transparent !important;
    min-width: 120px !important;
    padding: 0 !important;
    margin: 0 !important;
    font-size: inherit !important;
    font-weight: inherit !important;
    color: inherit !important;
    transition: background-color 0.2s ease, border 0.2s ease;
    outline: none !important;
    box-shadow: none !important;
    border: 1px solid transparent !important;
    padding: 2px 6px !important;
}

.camera-name-input:hover {
    background-color: rgba(0, 0, 0, 0.05) !important;
    border-radius: 3px !important;
}

.camera-name-input:focus {
    background-color: var(--white) !important;
    border: 1px solid var(--primary-color) !important;
    border-radius: 3px !important;
    box-shadow: 0 0 0 0.2rem rgba(108, 117, 125, 0.15) !important;
}

/* Empty State */
.empty-state {
    margin: 3rem 0;
}

.empty-state .card {
    border: 2px dashed var(--border-color);
    background-color: var(--white);
    padding: 2rem;
}

/* Activity Log */
.activity-log {
    margin: 2rem 0;
}

.activity-log .card {
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.activity-log .card-title {
    color: var(--accent-color);
    font-size: 1.1rem;
}

.activity-log .card-title i {
    color: var(--primary-color);
    margin-right: 0.5rem;
}

.log {
    background-color: #2d3748;
    color: #e2e8f0;
    border-radius: 6px;
    padding: 1rem;
    height: 200px;
    overflow-y: auto;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Consolas', monospace;
    font-size: 0.8rem;
    line-height: 1.4;
}

.log::-webkit-scrollbar {
    width: 6px;
}

.log::-webkit-scrollbar-track {
    background: #4a5568;
    border-radius: 3px;
}

.log::-webkit-scrollbar-thumb {
    background: #718096;
    border-radius: 3px;
}

.log::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* List View Preview Thumbnails */
.preview-cell { vertical-align: middle; text-align: center; width: 150px; }
.preview-cell .preview-wrapper { display: inline-flex; align-items: center; justify-content: center; background: var(--white); border: 1px solid var(--border-color); border-radius: 6px; padding: 4px; min-height: 72px; max-width: 140px; position: relative; }
.preview-cell .preview-placeholder { display: inline-block; font-size: 0.65rem; letter-spacing: .5px; text-transform: uppercase; opacity: .6; }
img.list-preview-img { display: block; width: 100%; height: auto; max-height: 70px; object-fit: contain; border-radius: 4px; background: #f8f9fa; box-shadow: 0 1px 2px rgba(0,0,0,0.08); }
img.list-preview-img.updated { animation: previewFlash 0.6s ease-in-out; }

img.list-preview-img.updated {
    animation: previewFlash 0.6s ease-in-out;
}

@keyframes previewFlash {
    0% { box-shadow: 0 0 0 0 rgba(0,123,255,0.7); }
    70% { box-shadow: 0 0 0 6px rgba(0,123,255,0); }
    100% { box-shadow: 0 0 0 0 rgba(0,123,255,0); }
}

/* Animation for new device cards */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

/* Clean, minimal focus states */
.btn:focus {
    box-shadow: 0 0 0 0.2rem rgba(108, 117, 125, 0.25);
}

/* Camera Controls in Dashboard */
.camera-card {
    background-color: var(--light-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.75rem;
}

.camera-card .form-label {
    color: var(--secondary-color);
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.record-btn{
    color: var(--white);
    background-color: var(--success-color);
    border-color: var(--success-color);
}

.record-btn:hover{
    color: var(--white);
    background-color: darkgreen;
    border-color: darkgreen;
}

.record-btn.offline{
    background-color: var(-text-muted);
    border-color: var(-text-muted);
}

/* Motion Control Button Styles */
.motion-btn {
    color: var(--white);
    background-color: #6c757d;
    border-color: #6c757d;
}

.motion-btn:hover {
    color: var(--white);
    background-color: #5a6268;
    border-color: #5a6268;
}

.motion-btn.recording {
    color: var(--white);
    background-color: #fd7e14;
    border-color: #fd7e14;
    animation: pulse-motion 1.5s infinite;
}

.motion-btn.recording:hover {
    color: var(--white);
    background-color: #e8690b;
    border-color: #e8690b;
}

.motion-btn.offline {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Motion Calibration Button Styles */
.calibrate-btn {
    color: var(--white);
    background-color: #6c757d;
    border-color: #6c757d;
}

.calibrate-btn:hover {
    color: var(--white);
    background-color: #5a6268;
    border-color: #5a6268;
}

.calibrate-btn.recording {
    color: var(--white);
    background-color: #fd7e14;
    border-color: #fd7e14;
    animation: pulse-motion 1.5s infinite;
}

.calibrate-btn.recording:hover {
    color: var(--white);
    background-color: #e8690b;
    border-color: #e8690b;
}

.calibrate-btn.offline {
    opacity: 0.6;
    cursor: not-allowed;
}

@keyframes pulse-motion {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.02); opacity: 0.85; }
    100% { transform: scale(1); opacity: 1; }
}

.record-btn.recording{
    color: var(--white);
    background-color: var(--danger-color);
    border-color: var(--danger-color);
    animation: pulse-button 1.5s infinite;
}

.record-btn.recording:hover{
    background-color: darkred;
    border-color: darkred;
}

@keyframes pulse-button {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.02); opacity: 0.9; }
    100% { transform: scale(1); opacity: 1; }
}

.zoom-value {
    font-size: 0.75rem;
    font-weight: 500;
}

.form-range::-webkit-slider-thumb {
    background-color: var(--primary-color);
}

.form-range::-moz-range-thumb {
    background-color: var(--primary-color);
    border: none;
}

/* Storage Management Styles */
.storage-info {
    background-color: #f8f9fa;
    border-radius: 4px;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    border: 1px solid #e9ecef;
}

.storage-info .d-flex {
    margin-bottom: 0.25rem;
}

.storage-info .d-flex:last-child {
    margin-bottom: 0;
}

.storage-location {
    font-size: 0.75rem;
    max-width: 100px;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

.storage-file-count {
    font-size: 0.75rem;
}

.icloud-status {
    font-size: 0.75rem;
}

.icloud-status.bg-success {
    background-color: var(--success-color) !important;
}

.icloud-status.bg-secondary {
    background-color: var(--text-muted) !important;
}

.migrate-icloud-btn,
.migrate-local-btn {
    font-size: 0.75rem;
    padding: 0.375rem 0.5rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.migrate-icloud-btn:hover:not(:disabled) {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.migrate-local-btn:hover:not(:disabled) {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
    color: white;
}

.migrate-icloud-btn:disabled,
.migrate-local-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Storage location badge states */
.storage-location.bg-success {
    background-color: var(--success-color) !important;
    color: white !important;
}

.storage-location.bg-danger {
    background-color: var(--danger-color) !important;
    color: white !important;
}

/* Local Files Section Styling */
.local-files-container {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    background-color: #f8f9fa;
}

.local-files-list {
    padding: 8px;
}

.local-files-list .border {
    border: 1px solid #e9ecef !important;
    transition: all 0.2s ease;
}

.local-files-list .border:hover {
    border-color: #007bff !important;
    background-color: #f0f8ff;
}

.local-files-list .btn-outline-success {
    border-width: 1px;
    padding: 2px 6px;
    font-size: 0.75rem;
}

.local-files-list .btn-outline-success:hover {
    transform: scale(1.05);
}

.local-files-list .btn-outline-danger {
    border-width: 1px;
    padding: 2px 6px;
    font-size: 0.75rem;
}

.local-files-list .btn-outline-danger:hover {
    transform: scale(1.05);
}
/* Camera Controls */
.camera-card .form-label {
    color: var(--secondary-color);
    font-weight: 500;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.camera-card .badge {
    font-size: 0.75rem;
    font-weight: 500;
}

/* Professional Toggle Switch Styling */

/* Recording Reason Badge Styling */
.recording-reason-section {
    text-align: center;
}

.recording-reason-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.recording-reason-badge i {
    font-size: 1rem;
}

/* Recording Reason States */
.recording-reason-badge.reason-manual {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
    border: 2px solid #bd2130;
}

.recording-reason-badge.reason-motion {
    background: linear-gradient(135deg, #ffc107 0%, #ffb300 100%);
    color: #000;
    border: 2px solid #ff8f00;
}

.recording-reason-badge.reason-follow {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
    color: white;
    border: 2px solid #117a8b;
}

.recording-reason-badge.reason-stopped {
    background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
    color: white;
    border: 2px solid #545b62;
}

/* Pulse animation for active recording */
.recording-reason-badge.reason-manual,
.recording-reason-badge.reason-motion,
.recording-reason-badge.reason-follow {
    animation: pulse-reason 2s ease-in-out infinite;
}

@keyframes pulse-reason {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    }
}
.camera-card .card-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid var(--border-color);
    border-radius: 6px 6px 0 0;
    padding: 0.5rem 0.75rem;
}

.camera-card .card-title {
    color: var(--accent-color);
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
}

.camera-card .card-title i {
    color: var(--primary-color);
    margin-right: 0.5rem;
    font-size: 1rem;
}

/* Professional toggle switch styling */
.form-check-input:checked {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

.form-check-input:focus {
    border-color: #86b7fe;
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Smooth slide animations */
@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        max-height: 500px;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 1;
        max-height: 500px;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        max-height: 0;
        transform: translateY(-10px);
    }
}

/* Enhanced card styling for toggleable sections */
.camera-card.has-toggle {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.camera-card.has-toggle:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* ===== CAMERA MANAGEMENT STYLES ===== */

/* Camera Section Layout */
.camera-section {
    transition: all 0.3s ease;
	max-height: 500px;
    overflow: auto;
}

.camera-section.hidden {
    display: none;
}

.camera-cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    padding: 1rem 0;
}

/* Camera Cards */
.camera-card {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
    cursor: grab; /* Grabbing hand cursor for clickable card */
}

.camera-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Interactive elements that should NOT trigger card click */
.camera-card .form-select,
.camera-card .btn,
.camera-card a,
.camera-card input,
.camera-card .drag-handle {
    cursor: pointer;
}

.camera-card .camera-field-label,
.camera-card .camera-field-value {
    cursor: text;
}

/* Override for specific interactive elements */
.camera-card .course-selector,
.camera-card .location-selector {
    cursor: pointer;
}

/* Camera Details Modal Styling */
.camera-details-modal {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.camera-details-modal .card {
    border: 1px solid #e9ecef;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.camera-details-modal .card-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    font-weight: 600;
}

.camera-details-modal p {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.camera-details-modal p strong {
    color: #495057;
    min-width: 120px;
    display: inline-block;
}

.camera-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    background: #f8f9fa;
}

.camera-card-header .camera-title-container {
    flex: 1;
}

.camera-card-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--secondary-color);
    line-height: 1.2;
}

.camera-card-id {
    margin: 0.25rem 0 0 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.camera-card-header .controls-container {
    display: flex;
    gap: 0.5rem;
    margin-left: 1rem;
}

.camera-card-header .btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    border-radius: 4px;
    border: 1px solid #dee2e6;
    background: #fff;
    color: #6c757d;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    text-decoration: none;
}

.camera-card-header .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.camera-card-header .btn i {
    font-size: 0.9rem;
}

.camera-card-header .view-btn {
    background: #e3f2fd;
    border-color: #2196f3;
    color: #1976d2;
}

.camera-card-header .view-btn:hover {
    background: #bbdefb;
    border-color: #1976d2;
}

.camera-card-header .edit-btn {
    background: #fff3e0;
    border-color: #ff9800;
    color: #f57c00;
}

.camera-card-header .edit-btn:hover {
    background: #ffe0b2;
    border-color: #f57c00;
}

.camera-card-body {
    padding: 1rem;
}

/* Camera Fields */
.camera-field {
    display: flex;
    align-items: center;
    padding: 8px 0;
    margin-bottom: 8px;
}

.camera-field:last-child {
    margin-bottom: 0;
}

.camera-field-label {
    font-weight: 600;
    color: #343a40;
    font-size: 0.9rem;
    min-width: 80px;
    flex-shrink: 0;
    margin-right: 15px;
}

.camera-field-value {
    color: #495057;
    font-size: 0.9rem;
    flex: 1;
    font-weight: 400;
}

/* Course Selector in Camera Cards */
.camera-field-value select.course-selector {
    border: 1px solid #e9ecef;
    background-color: transparent;
    color: #495057;
    font-size: 0.8rem !important;
    padding: 0.2rem 0.4rem !important;
    transition: all 0.15s ease;
    width: 100%;
    border-radius: 0.2rem;
    font-weight: 400;
    cursor: pointer;
}

.camera-field-value select.course-selector {
    border: 1px solid #ced4da;
    background-color: #ffffff;
    color: #495057;
    font-size: 0.85rem;
    padding: 6px 10px;
    transition: all 0.15s ease;
    width: 100%;
    border-radius: 4px;
    font-weight: 400;
    cursor: pointer;
    margin: 0;
}

.camera-field-value select.course-selector:hover {
    border-color: #80bdff;
}

.camera-field-value select.course-selector:focus {
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    outline: none;
}

/* Location Selector Styling */
.camera-field-value select.location-selector {
    border: 1px solid #ced4da;
    background-color: #ffffff;
    color: #495057;
    font-size: 0.85rem;
    padding: 6px 10px;
    transition: all 0.15s ease;
    width: 100%;
    border-radius: 4px;
    font-weight: 400;
    cursor: pointer;
    margin: 0;
}

.camera-field-value select.location-selector:hover {
    border-color: #80bdff;
}

.camera-field-value select.location-selector:focus {
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    outline: none;
}

/* Camera Empty State */
.camera-empty-state {
    margin: 2rem 0;
}

.camera-empty-state .card {
    border: 2px dashed var(--border-color);
    background: transparent;
}

.camera-empty-state .card-body {
    padding: 3rem 2rem;
}

/* Section Header Styles */
.section-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--secondary-color);
}

.section-description {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.header-icon {
    font-size: 1.8rem;
    color: var(--primary-color);
}

/* Toggle Switch Styling */
.form-check-input:checked {
    background-color: var(--success-color);
    border-color: var(--success-color);
}

.form-check-input:focus {
    border-color: var(--success-color);
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(40, 167, 69, 0.25);
}

/* Modal Styles */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1050;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 8px;
    padding: 2rem;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.add-camera-modal {
    width: 400px;
}

.edit-camera-modal {
    width: 800px;
}

.btn-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #aaa;
    cursor: pointer;
    z-index: 1051;
}

/* Secondary header under main card header */
.device-card .secondary-header {
    background: #f1f3f5;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}
.device-card .secondary-header .btn { 
    padding: 2px 10px; 
    font-size: 0.7rem; 
    line-height: 1.1; 
}
.device-card .secondary-header .btn i { font-size: .85rem; }
.device-card .secondary-header .btn:hover { transform: translateY(-1px); }

/* ========================= PROFESSIONAL MODAL SYSTEM ========================= */

/* Modern backdrop with smooth animation */
.professional-modal-backdrop {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 20, 40, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: modalBackdropFadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalBackdropFadeIn {
    from { opacity: 0; backdrop-filter: blur(0px); }
    to { opacity: 1; backdrop-filter: blur(4px); }
}

/* Professional modal container */
.professional-modal {
    background: white;
    border-radius: 16px;
    box-shadow: 0 24px 64px rgba(0, 20, 40, 0.25), 0 8px 32px rgba(0, 20, 40, 0.15);
    max-width: 90vw;
    max-height: 90vh;
    width: 100%;
    overflow: hidden;
    animation: modalSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-origin: center;
    position: relative;
    display: flex;
    flex-direction: column;
}

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

/* Modal sizes */
.modal-sm { max-width: 400px; }
.modal-md { max-width: 600px; }
.modal-lg { max-width: 900px; }
.modal-xl { max-width: 1200px; }

/* Modal header */
.professional-modal-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 2px solid #e9ecef;
    padding: 24px 32px;
    position: relative;
    flex-shrink: 0;
}

.professional-modal-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #343a40;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.professional-modal-title i {
    font-size: 1.3rem;
    color: #6c757d;
}

.professional-modal-subtitle {
    font-size: 0.9rem;
    color: #6c757d;
    margin: 8px 0 0 0;
    font-weight: normal;
}

.professional-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(108, 117, 125, 0.1);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #6c757d;
    font-size: 1.2rem;
}

.professional-modal-close:hover {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
    transform: rotate(90deg);
}

/* Modal body */
.professional-modal-body {
    padding: 32px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.professional-modal-body::-webkit-scrollbar { width: 8px; }
.professional-modal-body::-webkit-scrollbar-track { background: #f8f9fa; border-radius: 4px; }
.professional-modal-body::-webkit-scrollbar-thumb { background: #dee2e6; border-radius: 4px; }
.professional-modal-body::-webkit-scrollbar-thumb:hover { background: #adb5bd; }

/* Modal footer */
.professional-modal-footer {
    padding: 20px 32px 32px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    flex-shrink: 0;
}

/* Tabbed interface */
.modal-tabs {
    display: flex;
    border-bottom: 2px solid #e9ecef;
    margin: -16px -32px 24px -32px;
    padding: 0 32px;
    background: #f8f9fa;
}

.modal-tab {
    padding: 12px 20px;
    border: none;
    background: none;
    color: #6c757d;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    border-radius: 8px 8px 0 0;
}

.modal-tab:hover {
    background: rgba(13, 110, 253, 0.1);
    color: #0d6efd;
}

.modal-tab.active {
    color: #0d6efd;
    background: white;
    border-bottom: 2px solid #0d6efd;
}

.modal-tab-content {
    display: none;
    animation: tabFadeIn 0.2s ease;
}

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

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

/* Form enhancements */
.professional-form-group {
    margin-bottom: 24px;
}

.professional-form-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.professional-form-label i {
    color: #6c757d;
    font-size: 0.9rem;
}

.professional-form-control {
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    background: #fff;
}

.professional-form-control:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
    outline: none;
    background: #fff;
}

.professional-form-control:invalid {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.15);
}

.professional-form-help {
    font-size: 0.85rem;
    color: #6c757d;
    margin-top: 6px;
}

/* Professional buttons */
.btn-professional {
    padding: 12px 24px;
    font-weight: 500;
    border-radius: 8px;
    border: 2px solid transparent;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    cursor: pointer;
    font-size: 0.95rem;
}

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

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

.btn-professional.btn-primary {
    background: linear-gradient(135deg, #0d6efd 0%, #0056d3 100%);
    color: white;
    border-color: #0d6efd;
}

.btn-professional.btn-success {
    background: linear-gradient(135deg, #198754 0%, #146c43 100%);
    color: white;
    border-color: #198754;
}

.btn-professional.btn-secondary {
    background: #f8f9fa;
    color: #6c757d;
    border-color: #dee2e6;
}

.btn-professional.btn-secondary:hover {
    background: #e9ecef;
    border-color: #adb5bd;
    color: #495057;
}

.btn-professional.btn-danger {
    background: linear-gradient(135deg, #dc3545 0%, #b02a37 100%);
    color: white;
    border-color: #dc3545;
}

.btn-professional:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Loading state */
.btn-loading {
    position: relative;
    pointer-events: none;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: buttonSpin 1s linear infinite;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
}

@keyframes buttonSpin {
    from { transform: translateY(-50%) rotate(0deg); }
    to { transform: translateY(-50%) rotate(360deg); }
}

/* Info cards */
.info-card {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.info-card-header {
    font-weight: 600;
    color: #495057;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-card-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid #e9ecef;
}

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

.info-card-label {
    font-weight: 500;
    color: #6c757d;
}

.info-card-value {
    color: #495057;
    font-weight: 500;
}

/* Status indicators */
.status-online {
    color: #198754;
    font-weight: 600;
}

.status-offline {
    color: #dc3545;
    font-weight: 600;
}

/* Copy button */
.copy-btn {
    background: rgba(13, 110, 253, 0.1);
    border: 1px solid rgba(13, 110, 253, 0.3);
    color: #0d6efd;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.copy-btn:hover {
    background: rgba(13, 110, 253, 0.2);
}

/* Toast notifications */
.professional-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border-radius: 8px;
    padding: 16px 20px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    border-left: 4px solid;
    z-index: 1060;
    animation: toastSlideIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 400px;
}

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

.professional-toast.success {
    border-left-color: #198754;
}

.professional-toast.error {
    border-left-color: #dc3545;
}

.professional-toast.info {
    border-left-color: #0d6efd;
}

.professional-toast i {
    font-size: 1.2rem;
}

.professional-toast.success i {
    color: #198754;
}

.professional-toast.error i {
    color: #dc3545;
}

.professional-toast.info i {
    color: #0d6efd;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .professional-modal {
        margin: 10px;
        max-width: calc(100vw - 20px);
        max-height: calc(100vh - 20px);
        border-radius: 12px;
    }
    
    .professional-modal-header,
    .professional-modal-body {
        padding: 20px;
    }
    
    .professional-modal-footer {
        padding: 16px 20px 20px;
        flex-direction: column-reverse;
    }
    
    .btn-professional {
        width: 100%;
        justify-content: center;
    }
    
    .modal-tabs {
        margin: -12px -20px 20px -20px;
        padding: 0 20px;
        overflow-x: auto;
    }
    
    .modal-tab {
        padding: 10px 16px;
        white-space: nowrap;
    }
}

.btn-close:hover {
    color: #000;
}

/* Form Styling in Modals */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
}

.form-control, .form-select {
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus, .form-select:focus {
    border-color: #86b7fe;
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .camera-cards-container {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        padding: 0.75rem 0;
    }

    .camera-card-header {
        padding: 0.75rem;
        flex-direction: column;
        align-items: flex-start;
    }

    .camera-card-header .controls-container {
        margin-left: 0;
        margin-top: 0.5rem;
        width: 100%;
        justify-content: flex-end;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 1rem;
    }

    .section-header .d-flex:last-child {
        width: 100%;
        justify-content: space-between;
    }

    .modal-content {
        margin: 1rem;
        padding: 1.5rem;
    }

    .edit-camera-modal {
        width: auto;
    }
}

/* ===== DRAG AND DROP STYLES ===== */

.drag-handle {
    cursor: grab;
    color: #6c757d;
    transition: color 0.2s ease;
    padding: 2px;
    display: flex;
    align-items: center;
}

.drag-handle:hover {
    color: #495057;
}

.drag-handle:active {
    cursor: grabbing;
}

.sortable-ghost {
    opacity: 0.4;
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
}

.sortable-chosen {
    transform: rotate(5deg);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.sortable-drag {
    transform: rotate(5deg);
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
}

/* ===== CAMERA VISIBILITY STYLES ===== */

.camera-hidden {
    opacity: 0.5;
    position: relative;
}

.camera-hidden::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 10px,
        rgba(255,255,255,0.1) 10px,
        rgba(255,255,255,0.1) 20px
    );
    pointer-events: none;
    border-radius: inherit;
}

.toggle-visibility-btn {
    transition: all 0.2s ease;
}

.toggle-visibility-btn:hover {
    transform: scale(1.1);
}

/* ===== CAMERA CARD ENHANCEMENTS ===== */

.camera-card {
    transition: all 0.3s ease;
    margin-bottom: 1rem;
}

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

.camera-title-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.controls-container {
    display: flex;
    gap: 0.25rem;
}

.controls-container .btn {
    padding: 0.25rem 0.5rem;
}

/* Responsive drag handle */
@media (max-width: 768px) {
    .drag-handle {
        font-size: 1.2rem;
        padding: 4px;
    }
    
    .controls-container .btn {
        padding: 0.2rem 0.4rem;
        font-size: 0.875rem;
    }
}


/* Drag and Drop styles */
.device-card .drag-handle {
    cursor: grab;
    user-select: none;
}

.device-card .drag-handle:hover {
    cursor: grab;
    background-color: rgba(0, 0, 0, 0.02);
}

.device-card .drag-handle:active {
    cursor: grabbing;
}

.device-card.dragging {
  opacity: 0.7;
  transform: scale(0.95);
  z-index: 1000;
}

.device-card.drag-over {
  border: 2px dashed #0d6efd;
  background-color: rgba(13, 110, 253, 0.05);
}

/* Style for collapsed card during drag */
.device-card.compact-mode .card-body > *:not(.status-grid) {
  display: none !important;
}

.device-card.compact-mode .card {
  min-height: auto;
}

.device-card.compact-mode .card-header {
  padding: 0.5rem;
}

.device-card.compact-mode .status-grid {
  margin-bottom: 0;
}

.drag-ghost {
    pointer-events: none;
    z-index: -1;
}

/* Ensure compact-mode is applied to dragging cards */
.device-card.dragging.compact-mode .card-body > *:not(.status-grid) {
    display: none !important;
}

/* Fix for Firefox and other browsers - remove general draggable cursor since only header is draggable */
.device-card .card-body {
    cursor: default;
}

.device-card.dragging {
    cursor: grabbing;
}

/* Make compact mode more specific to ensure it works */
.device-card.compact-mode .card-body > *:not(.status-grid),
.device-card.dragging.compact-mode .card-body > *:not(.status-grid) {
    display: none !important;
}

.device-card.compact-mode .card,
.device-card.dragging.compact-mode .card {
    min-height: auto;
}

.device-card.compact-mode .card-header,
.device-card.dragging.compact-mode .card-header {
    padding: 0.5rem;
}

.device-card.compact-mode .status-grid,
.device-card.dragging.compact-mode .status-grid {
    margin-bottom: 0;
}

/* Camera Remote State Styling */
.camera-state-container {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background-color: #f8f9fa;
    padding: 15px;
    max-height: 400px;
    overflow-y: auto;
}

.camera-state-json {
    font-family: 'Monaco', 'Consolas', 'Courier New', monospace;
}

.state-toggle {
    cursor: pointer;
    padding: 8px;
    background-color: #e9ecef;
    border-radius: 4px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s ease;
}

.state-toggle:hover {
    background-color: #dee2e6;
}

.state-toggle i {
    transition: transform 0.2s ease;
    font-size: 0.9rem;
    color: #6c757d;
}

.state-content {
    transition: all 0.3s ease;
    overflow: hidden;
}

.state-content.show {
    max-height: 1000px;
    opacity: 1;
}

.state-content:not(.show) {
    max-height: 0;
    opacity: 0;
}

.state-json {
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 12px;
    margin: 0;
    font-size: 0.85rem;
    line-height: 1.4;
    color: #495057;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-x: auto;
}

.camera-state-description {
    font-size: 0.9rem;
    font-style: italic;
}

/* Comparison selection highlight */
.device-card.compare-selected .card {
    box-shadow: 0 0 0 2px #0d6efd inset;
}

/* Info Card Components for Modal Content */
.info-card {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.2s ease;
}

.info-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.info-card-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 12px 16px;
    font-weight: 600;
    font-size: 0.9rem;
    color: #495057;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-card-header i {
    color: #6c757d;
}

.info-card-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid #f8f9fa;
    min-height: 42px;
}

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

.info-card-label {
    font-weight: 500;
    color: #6c757d;
    font-size: 0.875rem;
    min-width: 120px;
}

.info-card-value {
    color: #343a40;
    font-size: 0.875rem;
    text-align: right;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
}

/* Status Indicators */
.status-online {
    color: #198754 !important;
    font-weight: 500;
}

.status-offline {
    color: #dc3545 !important;
    font-weight: 500;
}

.status-online i {
    color: #198754;
    font-size: 0.75rem;
    animation: pulse-green 2s infinite;
}

.status-offline i {
    color: #dc3545;
    font-size: 0.75rem;
}

@keyframes pulse-green {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Copy Button Enhancement */
.copy-btn {
    padding: 6px 12px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    font-size: 0.875rem;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.copy-btn:hover {
    background: #e9ecef;
    color: #495057;
    border-color: #dee2e6;
}

.copy-btn:active {
    background: #dee2e6;
    transform: translateY(1px);
}

/* Form Enhancements */
.form-group {
    margin-bottom: 1rem;
}

.form-label.required::after {
    content: " *";
    color: #dc3545;
    font-weight: bold;
}

.input-group-text {
    background: #f8f9fa;
    border-color: #e9ecef;
    color: #6c757d;
    min-width: 45px;
    justify-content: center;
}

/* Enhanced Form Validation */
.was-validated .form-control:valid {
    border-color: #198754;
    box-shadow: 0 0 0 0.2rem rgba(25, 135, 84, 0.1);
}

.was-validated .form-control:invalid {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.1);
}

/* Professional Modal Content Enhancements */
.professional-modal-body {
    padding: 1.5rem;
}

.professional-modal-header {
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 1px solid #e9ecef;
}

.professional-modal-footer {
    padding: 1rem 1.5rem;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.professional-modal-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #212529;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.professional-modal-subtitle {
    color: #6c757d;
    font-size: 0.9rem;
    margin-top: 0.25rem;
    margin-bottom: 0;
}

.professional-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #6c757d;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
    transition: color 0.2s ease;
}

.professional-modal-close:hover {
    color: #495057;
}

/* Form Control Enhancements */
.form-control-lg {
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border-radius: 0.5rem;
}

.form-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #495057;
}

.form-text {
    color: #6c757d;
    font-size: 0.875rem;
}

/* Button Loading State */
.btn.btn-loading {
    position: relative;
    color: transparent !important;
}

.btn.btn-loading::after {
    content: "";
    position: absolute;
    width: 1rem;
    height: 1rem;
    top: 50%;
    left: 50%;
    margin-left: -0.5rem;
    margin-top: -0.5rem;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.8s linear infinite;
}

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



#areaFilterContainer{
    margin-bottom: 1.5rem;
}

#eventNameDisplay{
    margin-bottom: 2rem;
}


/* ========== Area Status Styles ========== */
.area-status-container {
    margin-bottom: 1.5rem;
}

.area-status-container .card {
    border: 1px solid #e3f2fd;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
}

.area-status-container .card-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 1px solid #e3f2fd;
    padding: 0.75rem 1rem;
}

.area-status-card {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.area-status-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.area-status-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #f1f3f4;
}

.area-status-header .area-name {
    font-size: 0.95rem;
    color: #2c3e50;
    font-weight: 600;
}

.status-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.area-status-details .status-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.5rem;
    font-size: 0.85rem;
}

.area-status-details .status-item .label {
    color: #6c757d;
    font-weight: 500;
    margin-right: 0.5rem;
}

.area-status-details .status-item .value {
    color: #2c3e50;
    font-weight: 600;
}

/* Status-specific styling */
.area-status-card.status-complete {
    border-left: 4px solid #28a745;
}

.area-status-card.status-complete .status-badge {
    background-color: #d4edda;
    color: #155724;
}

.area-status-card.status-processing {
    border-left: 4px solid #17a2b8;
}

.area-status-card.status-processing .status-badge {
    background-color: #d1ecf1;
    color: #0c5460;
}

.area-status-card.status-error {
    border-left: 4px solid #dc3545;
}

.area-status-card.status-error .status-badge {
    background-color: #f8d7da;
    color: #721c24;
}

.area-status-card.status-waiting {
    border-left: 4px solid #ffc107;
}

.area-status-card.status-waiting .status-badge {
    background-color: #fff3cd;
    color: #856404;
}

.area-status-card.status-unknown {
    border-left: 4px solid #6c757d;
}

.area-status-card.status-unknown .status-badge {
    background-color: #e2e3e5;
    color: #383d41;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .area-status-card {
        padding: 0.75rem;
    }
    
    .area-status-header .area-name {
        font-size: 0.9rem;
    }
    
    .area-status-details .status-item {
        font-size: 0.8rem;
    }
    
    .status-badge {
        font-size: 0.7rem;
        padding: 0.2rem 0.4rem;
    }
}

/* Animation for processing status */
.area-status-card.status-processing .bi-gear-fill {
    animation: rotate 2s linear infinite;
}

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

/* Fade in animation for area status cards */
.area-status-card {
    animation: fadeInUp 0.3s ease-out;
}

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