/* ============================================
   RTSP TRACKER - MAIN STYLES
   ============================================ */

.rtsp-container {
    max-width: 100%;
    margin: 20px auto;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* ============================================
   HEADER SECTION
   ============================================ */

.rtsp-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
    flex-wrap: wrap;
    gap: 15px;
}

.rtsp-header h2 {
    margin: 0;
    color: #2c3e50;
    font-size: 24px;
    font-weight: 600;
    flex-shrink: 0;
}

.rtsp-stats {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.rtsp-stats > span {
    padding: 10px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.25);
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.rtsp-stats > span strong {
    font-weight: 700;
}

/* ============================================
   SEARCH BOX
   ============================================ */

.rtsp-search {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #dee2e6;
    border-radius: 10px;
    font-size: 15px;
    margin-bottom: 20px;
    background: white;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

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

/* ============================================
   TIMELINE & LOG ITEMS
   ============================================ */

.rtsp-timeline {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
    min-height: 300px;
}

.rtsp-item {
    display: flex;
    gap: 15px;
    padding: 16px;
    margin-bottom: 12px;
    border-radius: 10px;
    border-left: 5px solid #ddd;
    background: #fafafa;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.rtsp-item:hover {
    transform: translateX(8px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}

.rtsp-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 5px;
    height: 100%;
    background: inherit;
    transition: width 0.3s ease;
}

.rtsp-item:hover::before {
    width: 8px;
}

/* ============================================
   LOG ITEM CONTENT
   ============================================ */

.rtsp-icon {
    font-size: 36px;
    line-height: 1;
    flex-shrink: 0;
}

.rtsp-content {
    flex: 1;
    min-width: 0;
}

.rtsp-meta {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    font-size: 13px;
}

.rtsp-meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.rtsp-meta .time {
    font-weight: 600;
    color: #495057;
}

.rtsp-meta .machine {
    color: #3498db;
    font-weight: 500;
}

.rtsp-meta .ip {
    color: #e74c3c;
    font-family: 'Courier New', monospace;
    font-weight: 600;
    font-size: 12px;
}

.rtsp-message {
    font-size: 15px;
    color: #2c3e50;
    font-weight: 500;
    margin-bottom: 10px;
    line-height: 1.5;
}

.rtsp-device {
    font-size: 13px;
    color: #6c757d;
    font-style: italic;
    padding: 6px 12px;
    background: #f8f9fa;
    border-radius: 6px;
    display: inline-block;
    margin-top: 8px;
}

/* ============================================
   DETAIL BUTTON
   ============================================ */

.rtsp-detail-btn {
    padding: 10px 18px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 10px;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.rtsp-detail-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.rtsp-detail-btn:active {
    transform: translateY(-1px);
}

/* ============================================
   EVENT COLOR THEMES
   ============================================ */

.event-green { 
    border-left-color: #27ae60; 
    background: linear-gradient(to right, #d5f4e6, #fafafa); 
}

.event-blue { 
    border-left-color: #3498db; 
    background: linear-gradient(to right, #d6eaf8, #fafafa); 
}

.event-orange { 
    border-left-color: #f39c12; 
    background: linear-gradient(to right, #fdebd0, #fafafa); 
}

.event-purple { 
    border-left-color: #9b59b6; 
    background: linear-gradient(to right, #ebdef0, #fafafa); 
}

.event-red { 
    border-left-color: #e74c3c; 
    background: linear-gradient(to right, #fadbd8, #fafafa); 
}

.event-default {
    border-left-color: #95a5a6;
    background: linear-gradient(to right, #ecf0f1, #fafafa);
}

.machine-info { 
    border-left-color: #34495e; 
    background: linear-gradient(to right, #d6dbdf, #fafafa); 
}

/* ============================================
   EMPTY STATE
   ============================================ */

.rtsp-empty {
    text-align: center;
    padding: 80px 20px;
    color: #adb5bd;
    font-size: 18px;
    font-weight: 500;
}

.rtsp-empty::before {
    content: '📭';
    display: block;
    font-size: 64px;
    margin-bottom: 20px;
}

/* ============================================
   PAGINATION
   ============================================ */

.rtsp-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 24px;
    flex-wrap: wrap;
}

.rtsp-btn {
    padding: 10px 18px;
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.3s ease;
    font-weight: 600;
    font-size: 14px;
    min-width: 44px;
    text-align: center;
}

.rtsp-btn:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.rtsp-btn.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

/* ============================================
   MODAL
   ============================================ */

.rtsp-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(44, 62, 80, 0.85);
    backdrop-filter: blur(4px);
}

.rtsp-modal-content {
    background: white;
    margin: 3% auto;
    padding: 32px;
    width: 92%;
    max-width: 950px;
    max-height: 85vh;
    overflow-y: auto;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
    animation: modalSlideIn 0.3s ease;
}

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

.rtsp-modal-close {
    float: right;
    font-size: 36px;
    font-weight: bold;
    color: #adb5bd;
    cursor: pointer;
    line-height: 1;
    transition: all 0.3s ease;
}

.rtsp-modal-close:hover {
    color: #e74c3c;
    transform: rotate(90deg);
}

.rtsp-modal-content h3 {
    margin-top: 0;
    margin-bottom: 24px;
    color: #2c3e50;
    font-size: 24px;
    font-weight: 600;
    border-bottom: 3px solid #667eea;
    padding-bottom: 12px;
}

/* ============================================
   DETAIL GRID
   ============================================ */

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.detail-box {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    padding: 20px;
    border-radius: 12px;
    border-left: 5px solid #667eea;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
}

.detail-box:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}

.detail-box h4 {
    margin-top: 0;
    margin-bottom: 16px;
    color: #667eea;
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.detail-box p {
    margin: 10px 0;
    font-size: 14px;
    color: #495057;
    line-height: 1.6;
}

.detail-box p b {
    color: #2c3e50;
    font-weight: 600;
    display: inline-block;
    min-width: 120px;
}

.detail-box ul {
    margin: 12px 0;
    padding-left: 24px;
}

.detail-box li {
    margin: 8px 0;
    font-size: 14px;
    color: #495057;
    line-height: 1.6;
}

/* ============================================
   SCROLLBAR STYLING
   ============================================ */

.rtsp-modal-content::-webkit-scrollbar {
    width: 10px;
}

.rtsp-modal-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.rtsp-modal-content::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 10px;
}

.rtsp-modal-content::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #764ba2, #667eea);
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 992px) {
    .detail-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
}

@media (max-width: 768px) {
    .rtsp-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .rtsp-header h2 {
        font-size: 20px;
        text-align: center;
    }
    
    .rtsp-stats {
        flex-direction: column;
        width: 100%;
    }
    
    .rtsp-stats > span {
        width: 100%;
        justify-content: center;
    }
    
    .rtsp-meta {
        flex-direction: column;
        gap: 8px;
    }
    
    .detail-grid {
        grid-template-columns: 1fr;
    }
    
    .rtsp-modal-content {
        margin: 10% auto;
        width: 95%;
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .rtsp-container {
        padding: 12px;
        margin: 10px auto;
    }
    
    .rtsp-header {
        padding: 12px;
    }
    
    .rtsp-icon {
        font-size: 28px;
    }
    
    .rtsp-item {
        padding: 12px;
        gap: 10px;
    }
    
    .rtsp-timeline {
        padding: 15px;
    }
}

/* ============================================
   CSS TỪ SHORTCODE (EXTRACTED)
   ============================================ */

/* Animation cho items mới */
.rtsp-new-item {
    animation: rtsp-highlight 3s ease-in-out;
}

@keyframes rtsp-highlight {
    0%, 100% { 
        background: #fafafa; 
        transform: scale(1);
    }
    25% { 
        background: linear-gradient(to right, #fff9c4, #fafafa); 
        transform: scale(1.02);
        box-shadow: 0 6px 20px rgba(255, 235, 59, 0.4);
    }
}

/* Toggle button styles */
.rtsp-refresh-status {
    display: flex;
    align-items: center;
    gap: 10px;
}

.rtsp-toggle-btn {
    padding-top: 0px;
    padding-bottom: 0px;
    padding-right: 10px;
    padding-left: 10px;
    background: #f44336;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.rtsp-toggle-btn.active {
    background: #4caf50;
}

.rtsp-toggle-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.rtsp-last-update {
    font-size: 12px;
    color: white;
}

#rtsp-last-update-time {
    font-weight: bold;
    color: #2196f3;
}

/* ============================================
   LOAD MORE BUTTON
   ============================================ */

.rtsp-loadmore-container {
    text-align: center;
    margin-top: 24px;
    padding: 20px;
}

.rtsp-loadmore-btn {
    padding: 14px 32px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.35);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.rtsp-loadmore-btn:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.45);
}

.rtsp-loadmore-btn:active:not(:disabled) {
    transform: translateY(-1px);
}

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

.rtsp-loadmore-btn .loadmore-loading {
    animation: rtsp-pulse 1s infinite;
}

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

.rtsp-end-message {
    padding: 20px;
    color: #27ae60;
    font-size: 16px;
    font-weight: 600;
    background: linear-gradient(to right, #d5f4e6, #fafafa);
    border-radius: 10px;
    display: inline-block;
}

/* ============================================
   LOADED ITEMS HIGHLIGHT (Load More)
   ============================================ */

.rtsp-loaded-item {
    animation: rtsp-loaded-highlight 1.5s ease-in-out;
}

@keyframes rtsp-loaded-highlight {
    0% { 
        background: linear-gradient(to right, #e3f2fd, #fafafa);
        transform: scale(1);
    }
    50% { 
        background: linear-gradient(to right, #bbdefb, #fafafa);
    }
    100% { 
        background: #fafafa;
        transform: scale(1);
    }
}

/* ============================================
   STATS UPDATES
   ============================================ */

#rtsp-displayed-count,
#rtsp-total-count,
#rtsp-remaining-count {
    transition: all 0.3s ease;
}

/* Flash effect khi số thay đổi */
.rtsp-count-updated {
    animation: rtsp-count-flash 0.5s ease;
}

@keyframes rtsp-count-flash {
    0%, 100% { color: white; }
    50% { color: #ffeb3b; transform: scale(1.1); }
}