:root {
    --primary-color: #2563eb;
    --secondary-color: #1e40af;
    --background-color: #f9fafb;
    --text-color: #1f2937;
    --border-color: #e5e7eb;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
}  

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: rgba(21, 26, 41, 1);
    color: var(--text-color);
    line-height: 1.5;
}

.container {
    display: flex;
    height: 85vh;
}

header .nav-bar {
    background: rgba(28, 33, 48, 0.75);
}

.sidebar {
    width: 300px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 16px;

    font-weight: bold;
    font-size: 1.2rem;
}

.sidebar-container{
    overflow-y: auto;
    padding: 0 20px 0 20px;
    background-color: rgba(0, 0, 0, .0);
}

.sidebar-content {
    flex: 1;


}

.sidebar-footer {
    padding: 16px;
    text-align: center;
}

.device-list {
    list-style: none;
}

.device-item {
    position: relative;
    padding: 12px 16px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    flex-direction: column;
    background: rgba(46, 48, 54, 0.85);
    margin-bottom: 10px;
    border: 1px solid #373A42;
}

.device-info{
    display: flex;
    justify-content: space-between;
    flex-direction: column;
    gap: 10px;
}

.device-item:hover {
    background-color: #222e3a;
}

.device-name {
    font-weight: 500;
}

.device-status {
    font-size: 0.8rem;
    padding: 3px 8px;
    border-radius: 9999px;
    font-weight: 500;
}

.status-online {
    background-color: #00bb41;
    color: #ffffff;
    width: max-content;
}

.status-offline {
    background-color: #fee2e2;
    color: #991b1b;
}

.stream-btn {
    position: absolute;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 6px 10px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background-color 0.2s;
    right: 10px;
    bottom: 10px;

}

.stream-btn:hover {
    background-color: var(--secondary-color);
}

.stream-btn:disabled {
    position: absolute;
    background-color: #9ca3af;
    cursor: not-allowed;
    right: 10px;
    bottom: 10px;

}
.records-btn {
    position: absolute;
    background-color: var(--success-color);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 6px 10px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background-color 0.2s;
    right: 80px;
    bottom: 10px;

}

.records-btn:hover {
    background-color: var(--secondary-color);
}

.main-content {
    flex: 1;
    padding: 16px;
    overflow: auto;
    height: 80vh;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.clear-all-btn {
    background-color: var(--error-color);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 16px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.clear-all-btn:hover {
    background-color: #dc2626;
}
.view-all-btn {
    background-color: var(--success-color);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 16px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.view-all-btn:hover {
    background-color: #16a34a;
}
.streams-grid {
    display: grid;
    gap: 16px;
    width: 100%;
    height: calc(80vh - 100px);
}

.grid-1x1 {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
}

.grid-1x2 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr;
}

.grid-2x2 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}

.stream-container {
    position: relative;
    background-color: #000;
    border-radius: 8px;
    overflow: hidden;
}

.stream-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.stream-loader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    z-index: 5;
}

.stream-loader-spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin-bottom: 10px;
}

.stream-overlay {
    position: absolute;
    top: 0;
    right: 0;
    padding: 8px;
    display: flex;
    gap: 8px;
}

.close-stream-btn {
    background-color: rgba(239, 68, 68, 0.8);
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
}

.close-stream-btn:hover {
    background-color: rgba(220, 38, 38, 0.9);
}

.stream-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px 16px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 0.9rem;
}

.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100px;
    font-size: 0.9rem;
    color: #6b7280;
}

.spinner {
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

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

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #6b7280;
    font-size: 0.9rem;
    text-align: center;
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    color: #9ca3af;
}

/* Error Message */
.error-message {
    padding: 16px;
    background-color: #fee2e2;
    color: #991b1b;
    border-radius: 4px;
    margin-bottom: 16px;
}

/* Improved stream loader styling */
.stream-loader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    z-index: 10;
    transition: opacity 0.3s ease;
}

.stream-loader-spinner {
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top: 4px solid #FAD754; /* Using your accent color from your variables.css */
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
    margin-bottom: 16px;
}

.stream-loader div:not(.stream-loader-spinner) {
    font-size: 14px;
    font-weight: 500;
    margin-top: 10px;
    text-align: center;
    max-width: 80%;
}

/* Improve the spinner animation */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Add pulse effect for better visual indication */
.stream-loader::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-color: rgba(250, 215, 84, 0.1); /* FAD754 with opacity */
    animation: pulse 2s ease-out infinite;
    z-index: -1;
}

@keyframes pulse {
    0% { 
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0.8;
    }
    50% { 
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 0.2;
    }
    100% { 
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0.8;
    }
}

/* Additional style for error state */
.stream-loader.error {
    background-color: rgba(239, 68, 68, 0.8);
}

.stream-loader.error .stream-loader-spinner {
    border-top-color: #ef4444;
}

/* Initial stream loader that appears immediately when Stream button is clicked */
.initial-stream-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    border-radius: 8px;
    color: white;
    padding: 20px;
}

.initial-loader-text {
    margin-top: 16px;
    text-align: center;
    font-size: 14px;
}

/* Style for temporary stream container */
.temp-stream {
    min-height: 200px;
    background-color: rgba(28, 33, 48, 0.75);
    border: 1px dashed rgba(250, 215, 84, 0.5); /* Using accent color */
}

/* Disabled stream button with loading indication */
.stream-btn:disabled {
    background-color: #4a5568;
    opacity: 0.7;
    cursor: not-allowed;
    position: absolute;
    right: 10px;
    bottom: 10px;
}

/* For smoother animations and transitions */
.streams-grid {
    transition: all 0.3s ease;
}

.stream-container {
    animation: fadeIn 0.3s ease;
}

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

/* Better error message styling */
.error-message {
    background-color: rgba(239, 68, 68, 0.9);
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    animation: slideIn 0.3s ease;
}

.error-message button {
    color: white !important;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.error-message button:hover {
    opacity: 1;
}

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