/* Layout structure for 70/30 split */
.dashboard-container {
    display: flex;
    flex-direction: row;
    gap: 15px;
    width: 100%;
}

.main-content-area {
    flex: 7;
    min-width: 0; /* Important for responsive layouts */
}

.alert-sidebar {
    flex: 3;
    min-width: 300px;
    max-width: 30%;
}

/* Alert list container */
.alerts-container {
    max-height: calc(100vh - 180px);
    overflow-y: auto;
    overflow-x: hidden;
}

/* Alert item styling */
.alert-item {
    position: relative;
    margin-bottom: 15px;
    background-color: #fff;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.12);
    transition: all 0.3s ease;
    overflow: hidden;
}

.alert-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
}

/* Severity left borders */
.severity-high {
    border-left: 5px solid #dc3545;
}

.severity-medium {
    border-left: 5px solid #ffc107;
}

.severity-low {
    border-left: 5px solid #28a745;
}

/* Two-column layout for alert items */
.alert-item-content {
    display: flex;
    height: 100%;
}

/* Left column - Alert thumbnail - UPDATED to 40% width */
.alert-thumb {
    width: 40%;
    flex: 0 0 40%;
    background-color: #000;
    min-height: 90px;
}

.alert-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.alert-thumb img:hover {
    opacity: 0.8;
}

/* Right column - Info and actions */
.alert-right-column {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Alert information */
.alert-info {
    flex-grow: 1;
    padding: 10px 12px 5px;
    background-color: #fff;
}

.alert-time, .alert-level, .alert-status {
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;  
    align-items: center;  
}
.alert-event {
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;  
    align-items: center;
    font-size: 1.4rem; 
}
.alert-camerat {
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;  
    align-items: center;
    font-size: 1.2rem; 
}

.alert-meta i {
    width: 20px;
    text-align: center;
    margin-right: 5px;
    color: #333;
    flex-shrink: 0;  
}

/* Detailed alert info style */
.alert-detail-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.alert-detail-info strong {
    margin-right: 5px;
    font-weight: 600;
}

/* Alert action buttons */
.alert-actions {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    background-color: #fff;
    border-top: 1px solid #f0f0f0;
}

/* Alert action buttons - enlarged for better visibility */
.alert-actions .btn {
    padding: 6px 12px;
    font-size: 1rem; /* Increased from 0.85rem/0.95rem */
    font-weight: 500;
    min-width: 80px;
}
/* Make modal action buttons larger */
.modal-footer .btn,
.action-buttons .btn {
    padding: 8px 15px;
    font-size: 1.1rem;
    min-width: 100px;
}

/* Add some more spacing between buttons */
.alert-actions .btn + .btn {
    margin-left: 8px;
}

/* Ensure buttons have good contrast */
.btn-success {
    background-color: #28a745;
    border-color: #28a745;
}

.btn-warning {
    background-color: #ffc107;
    border-color: #ffc107;
    color: #212529;
}

.btn-danger {
    background-color: #dc3545;
    border-color: #dc3545;
}

/* Hover states for better interactivity */
.btn-success:hover {
    background-color: #218838;
    border-color: #1e7e34;
}

.btn-warning:hover {
    background-color: #e0a800;
    border-color: #d39e00;
}

.btn-danger:hover {
    background-color: #c82333;
    border-color: #bd2130;
}

/* Modal styles */
.video-container {
    position: relative;
    padding-top: 56.25%; /* 16:9 aspect ratio */
    background-color: #000;
    border-radius: 4px;
    overflow: hidden;
}

.video-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Animation for new alerts */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.new-alert-animation {
    animation: fadeIn 0.5s ease-out;
}

/* Alert details in modal */
.alert-details {
    background-color: #f8f9fa;
    border-radius: 5px;
}

/* New alert modal animation */
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7); }
    70% { box-shadow: 0 0 0 15px rgba(220, 53, 69, 0); }
    100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0); }
}

#newAlertModal .modal-content {
    animation: pulse 2s infinite;
}

/* Pagination styles */
.alerts-pagination {
    padding: 10px;
    border-top: 1px solid #dee2e6;
}

.pagination .page-link {
    color: #2c7bef;
    padding: 0.3rem 0.5rem;
}

.pagination .page-item.active .page-link {
    background-color: #2c7bef;
    border-color: #2c7bef;
}

/* Info boxes for dashboard stats */
.info-box {
    display: flex;
    min-height: 80px;
    background: #fff;
    width: 100%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    border-radius: 0.25rem;
    margin-bottom: 1rem;
}

.info-box-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 70px;
    color: #fff;
    font-size: 1.875rem;
    border-radius: 0.25rem 0 0 0.25rem;
}

.info-box-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0 10px;
}

.info-box-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #6c757d;
}

.info-box-number {
    font-weight: 700;
    font-size: 1.25rem;
}

.bg-info {
    background-color: #17a2b8;
}

.bg-warning {
    background-color: #ffc107;
}

/* Responsive adjustments */
@media (max-width: 992px) {
    .dashboard-container {
        flex-direction: column;
    }
    
    .alert-sidebar {
        max-width: 100%;
    }
    
    /* Maintain 40% width even on mobile */
    .alert-thumb {
        width: 40%;
        flex: 0 0 40%;
        min-height: 80px;
    }
}

/* Badge colors for consistency */
/* Badge colors and sizing for better visibility */
.badge {
    font-size: 0.9rem;
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
    font-weight: 500;
}

.alert-level .badge,
.alert-status .badge {
    display: inline-block;
    min-width: 70px;
    text-align: center;
}

.modal .badge {
    font-size: 1rem;
    padding: 0.45rem 0.7rem;
    min-width: 80px;
}

.badge.bg-warning {
    color: #000 !important;
    background-color: #ffc107 !important;
}

.badge.bg-danger {
    background-color: #dc3545 !important;
}

.badge.bg-success {
    background-color: #28a745 !important;
}

.badge.bg-secondary {
    background-color: #6c757d !important;
}

.badge.bg-primary {
    background-color: #007bff !important;
}

.info-item .badge {
    margin-top: 5px;
}
/* New modal layout styles */
.modal-body .video-container {
    padding-top: 0;
    height: 100%;
    min-height: 400px;
}

.alert-sidebar-info {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background-color: #f8f9fa;
}

.alert-info-block {
    flex-grow: 1;
}

.info-item strong {
    display: block;
    margin-bottom: 2px;
    color: #6c757d;
    font-size: 0.85rem;
}

.info-item div {
    font-weight: 500;
}

.action-buttons {
    margin-top: auto;
}

/* Make sure videos fill their container */
.video-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background-color: #000;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .modal-body .row {
        flex-direction: column;
    }
    
    .modal-body .col-md-8,
    .modal-body .col-md-4 {
        width: 100%;
        max-width: 100%;
        flex: 0 0 100%;
    }
    
    .modal-body .video-container {
        min-height: 300px;
    }
    
    .alert-sidebar-info {
        min-height: 300px;
    }
}

/* Larger modals (1.5x size) */
.modal-lg {
    max-width: 1350px; /* Default is 900px, so 900 * 1.5 = 1350px */
}

.modal-dialog {
    max-width: 1350px; /* Ensure all dialogs get the larger size */
}

/* Adjust modal heights too */
.modal-body .video-container {
    min-height: 600px; /* Increased from 400px */
}

/* Ensure text sizes are appropriate for larger modals */
.modal-title {
    font-size: 1.4rem;
}

.info-item strong {
    font-size: 0.95rem;
}
/* 
.info-item div {
    font-size: 1.1rem;
} */

/* Make buttons in the sidebar bigger */
.alert-sidebar-info .btn {
    padding: 8px 12px;
    font-size: 1rem;
}

/* Adjust responsive behavior for larger modals */
@media (max-width: 1400px) {
    .modal-lg, 
    .modal-dialog {
        max-width: 95%;
        margin: 1.75rem auto;
    }
}

@media (max-width: 768px) {
    .modal-body .video-container {
        min-height: 450px; /* Increased from 300px */
    }
    
    .alert-sidebar-info {
        min-height: 450px; /* Increased from 300px */
    }
}

/* Increased font sizes for better readability */

/* Alert meta information */
.alert-meta {
    font-size: 1rem; /* Increased from 0.9rem */
    color: #333;
}

/* Button text size increase */


/* Modal buttons even larger */
.modal-footer .btn,
.action-buttons .btn {
    padding: 8px 15px;
    font-size: 1.2rem; /* Increased button text size */
    min-width: 100px;
}

/* Sidebar modal buttons */
.alert-sidebar-info .btn {
    padding: 10px 15px;
    font-size: 1.2rem; /* Larger button text */
    margin-bottom: 12px;
    width: 100%;
}

/* Modal content text sizes */
.modal-title {
    font-size: 1.5rem; /* Larger title */
}

.info-item strong {
    font-size: 1.05rem; /* Larger labels */
    display: block;
    margin-bottom: 4px;
    color: #6c757d;
}

.info-item div {
    font-size: 1.5rem; 
    font-weight: 500;
}

/* Dashboard card titles and content */
.card-title {
    font-size: 1.4rem;
}

.info-box-text {
    font-size: 1.1rem;
}

.info-box-number {
    font-weight: 700;
    font-size: 1.4rem; /* Increased from 1.25rem */
}

/* Make sure alert text in the sidebar doesn't overflow */
.alert-camera, .alert-event, .alert-time, .alert-level, .alert-status {
    margin-bottom: 8px; /* More space between lines */
}

/* Adjust badge sizes to match the new text sizes */
.badge {
    font-size: 1rem; /* Increased badge text */
    padding: 0.4rem 0.6rem;
}

.modal .badge {
    font-size: 1.1rem; /* Even larger in modals */
    padding: 0.45rem 0.7rem;
}

/* Update the layout structure */
.dashboard-container {
    display: flex;
    flex-direction: row;
    gap: 15px;
    width: 100%;
}



.alert-sidebar {
    flex: 3;
    min-width: 300px;
    max-width: 30%;
}

/* Camera table styles */
#cameras-table {
    margin-bottom: 0;
}

#cameras-table thead {
    background-color: #343a40;
    color: #fff;
}

#cameras-table th, #cameras-table td {
    padding: 12px 15px;
    vertical-align: middle;
}

/* Set a fixed height for the camera table container */
.card:has(#cameras-table) .card-body {
    max-height: 55vh;
    overflow-y: auto;
}

/* Connection status indicator */
.connection-status {
    display: inline-block;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    margin: 0; /* Xóa margin: 0 auto; để không căn giữa */
    margin-left: 5px;
}

.status-online {
    background-color: #28a745;
    box-shadow: 0 0 5px #28a745;
}

.status-offline {
    background-color: #6c757d;
    box-shadow: 0 0 5px #6c757d;
}

/* Camera icon */
.camera-icon {
    width: 24px;
    height: 24px;
    display: inline-block; /* Thay đổi từ block sang inline-block */
    margin: 0; /* Xóa margin: 0 auto; để không căn giữa */
    margin-left: 5px;
}

/* Latest alert styling */
.latest-alert {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
}

.latest-alert .badge {
    padding: 5px 8px;
}

/* Detail button */
.camera-detail-btn {
    padding: 6px 12px;
    font-size: 0.9rem;
}

/* Camera table pagination */
.cameras-pagination {
    padding: 10px;
    border-top: 1px solid #dee2e6;
    background-color: #f8f9fa;
}

/* Responsive adjustments */
@media (max-width: 992px) {
    .dashboard-container {
        flex-direction: column;
    }
    
    .alert-sidebar {
        max-width: 100%;
    }
    
    .card:has(#cameras-table) .card-body {
        max-height: none;
    }
    
    .latest-alert {
        max-width: none;
    }
}

/* Additional styling to fix AdminLTE layout issues */

/* Make sure content fits in the containers */
.dashboard-container {
    width: 100%;
    margin: 0;
    padding: 0;
}

.main-content-area {
    width: 100%;
    padding-right: 0;
}

/* Fix info box spacing and size */
.info-box {
    min-height: 85px;
    margin-bottom: 15px;
}

.info-box-icon {
    width: 70px;
    font-size: 1.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Ensure consistent text sizes */
.info-box-text {
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.info-box-number {
    font-size: 1.2rem;
    font-weight: 700;
}

/* Give proper spacing between rows of info boxes */
.card-body .row + .row {
    margin-top: 10px;
}

/* Responsive adjustments */
@media (max-width: 767.98px) {
    .info-box {
        margin-bottom: 10px;
    }
    
    .col-sm-6 {
        margin-bottom: 10px;
    }
}

/* Ensure camera table is responsive */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Fix table column widths */
#cameras-table th,
#cameras-table td {
    white-space: nowrap;
}

/* Add proper cell padding */
#cameras-table td {
    padding: 10px;
    vertical-align: middle;
}

/* Fix scrollbar appearance */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}


/* Màu cho cột カメラ名 khi hover */
#cameras-table tbody tr:hover td:nth-child(2) {
    color: #ffffff !important;
    font-weight: 600 !important;
    text-shadow: 0px 0px 1px rgba(0, 0, 0, 0.2);
}

/* Điều chỉnh cụ thể cho toàn bộ hàng khi hover */
#cameras-table tbody tr:hover {
    background-color: #007bff !important; /* Màu xanh đậm khi hover */
}

/* Nếu muốn chọn theo class thay vì vị trí cột, hãy thêm class "camera-name" vào TD */
#cameras-table tbody tr:hover .camera-name {
    color: #ffffff !important;
    font-weight: 600 !important;
}

/* Hiệu ứng phóng to icon khi hover vào cột カメラ */
.camera-icon {
    width: 24px;
    height: 24px;
    display: inline-block;
    transition: transform 0.2s ease, filter 0.2s ease;
}

/* Hiệu ứng khi hover vào hàng hoặc icon */
#cameras-table tbody tr:hover .camera-icon,
.camera-icon:hover {
    transform: scale(1.3); /* Phóng to icon lên 130% */
    filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.7)); /* Thêm hiệu ứng bóng sáng */
}

/* Màu nền cho các icon của các loại event trong bảng システムステータス */
/* Sử dụng class tùy chỉnh cho từng loại */

/* Icon cho 暴力 (fight) - màu nền đỏ */
.event-icon-fight {
    background-color: #dc3545; /* Màu đỏ */
    color: white;
    padding: 15px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Icon cho 転倒 (fall) - màu nền cam */
.event-icon-fall {
    background-color: #fd7e14; /* Màu cam */
    color: white;
    padding: 15px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Icon cho 車椅子 (wheelchair) - màu nền xanh dương */
.event-icon-wheelchair {
    background-color: #0d6efd; /* Màu xanh dương */
    color: white;
    padding: 15px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Icon cho 白状 (white cane) - màu nền xám */
.event-icon-white-cane {
    background-color: #6c757d; /* Màu xám */
    color: white;
    padding: 15px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Điều chỉnh kích thước icon trong info-box */
.event-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Additional CSS for centering event boxes */

/* Center the row of event info boxes */
.dashboard-container .card-body .row.justify-content-center {
    display: flex;
    justify-content: center;
    gap: 2rem; /* Add spacing between boxes */
}

/* Ensure event icons have consistent sizing */
.event-icon {
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Make info boxes slightly larger for better visual impact */
.info-box {
    min-height: 90px;
    margin-bottom: 20px;
    transition: transform 0.2s;
}

.info-box:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* Ensure dark theme compatibility */
.card-body .row + .row {
    margin-top: 15px;
}

/* Adjust info box content alignment */
.info-box-content {
    padding-left: 15px;
}

.info-box-number {
    font-size: 1.6rem;
    font-weight: 700;
}

.info-box-text {
    font-size: 1.1rem;
}