/* General Reset and Styling */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Arial', sans-serif;
}

body {
    line-height: 1.6;
    color: #e0e0e0;
    /* Light text for dark backgrounds */
    background-color: #121212;
    background: #1e1e1e;
    /* Dark background */
}

/* Grid Layout */
.container {
    padding: 0;
    display: grid;
    grid-template-columns: 250px 1fr;
    grid-template-rows: auto 1fr auto;
    grid-template-areas:
        "header header"
        "sidebar content"
        "footer footer";
    height: 100vh;
}

.container-fluid {
    --bs-gutter-x: 0;
    padding: 0;
    margin: 0;
    max-width: none;
    background-color: #1e1e1e; 
}

/* Header Styling */
header {
    grid-area: header;
    background-color: #1f1f1f;
    color: #ffffff;
    padding: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

nav {
    display: flex;
    justify-content: space-around;
}

nav a {
    color: #ffffff;
    text-decoration: none;
    font-weight: bold;
}

nav a:hover {
    color: #90caf9;
}

.hamburger {
    display: none;
    /* Hidden by default */
    font-size: 2rem;
    background: none;
    color: #ffffff;
    border: none;
    cursor: pointer;
}

/* Sidebar Styling */
.sidebar {
    grid-area: sidebar;
    background-color: #1f1f1f;
    color: #e0e0e0;
    padding: 20px;
    border-right: 1px solid #333;
    transition: transform 0.3s ease-in-out;
}

/* Hide Sidebar by Default on Mobile */
.sidebar.hidden {
    transform: translateX(-100%);
}

.sidebar a {
    display: block;
    padding: 12px 16px;
    text-decoration: none;
    color: #e0e0e0;
    transition: all 0.3s ease;
}

.sidebar a:hover {
    background-color: #2d2d2d;
    color: #90caf9;
}

.sidebar a.active {
    background-color: #2d2d2d;
    color: #90caf9;
    font-weight: 500;
    border-left: 4px solid #90caf9;
}

.sidebar ul {
    list-style: none;
}

.sidebar ul li {
    margin: 15px 0;
}

.sidebar ul li a {
    color: #e0e0e0;
    text-decoration: none;
    font-weight: bold;
}

.sidebar ul li a:hover {
    color: #90caf9;
}

/* Main Content Styling */
.content {
    grid-area: content;
    padding: 0;
    margin: 0;
    width: 100%;
    overflow-y: auto;
    background: #1e1e1e;
    box-shadow: none; 
    border-radius: 0; 
}

/* Footer Styling */
footer {
    grid-area: footer;
    background-color: #1f1f1f;
    color: #e0e0e0;
    text-align: center;
    padding: 10px;
    border-top: 1px solid #333;
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    .container {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto auto;
        grid-template-areas:
            "header"
            "content"
            "footer";
    }

    .hamburger {
        display: block;
        /* Show hamburger menu */
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100%;
        width: 250px;
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
        z-index: 1000;
        background-color: #1f1f1f;
    }

    .sidebar.visible {
        transform: translateX(0);
        /* Slide in when visible */
    }

    .content {
        padding: 10px;
    }
}

/* Overlay for mobile view */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    /* Below sidebar but above content */
}

/* Show overlay when sidebar is visible */
.sidebar-overlay.visible {
    display: block;
}

/* Devices Page Specific Styling */
.devices-container {
    padding: 20px;
    background: #1e1e1e;
    border-radius: 8px;
}

.devices-container h1 {
    margin-bottom: 24px;
    color: #90caf9;
}

/* Filters Section */
.filters {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
}

.filters select {
    padding: 8px 12px;
    border-radius: 4px;
    background-color: #2d2d2d;
    border: 1px solid #404040;
    color: #e0e0e0;
    min-width: 200px;
}

.filters select:focus {
    outline: none;
    border-color: #90caf9;
}

/* Table Styling */
.devices-table {
    overflow-x: auto;
    margin-top: 20px;
}

.devices-table table {
    width: 100%;
    border-collapse: collapse;
    background-color: #1f1f1f;
    border-radius: 8px;
    overflow: hidden;
}

.devices-table th,
.devices-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #333;
}

.devices-table th {
    background-color: #2d2d2d;
    color: #90caf9;
    font-weight: bold;
    white-space: nowrap;
}

.devices-table tr:hover {
    background-color: #2d2d2d;
}

.devices-table td {
    color: #e0e0e0;
}

/* Button Styling */
.btn-edit,
.btn-delete {
    padding: 6px 12px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    margin-right: 8px;
    font-weight: bold;
    transition: background-color 0.2s;
}

.btn-edit {
    background-color: #2196f3;
    color: white;
}

.btn-delete {
    background-color: #f44336;
    color: white;
}

.btn-edit:hover {
    background-color: #1976d2;
}

.btn-delete:hover {
    background-color: #d32f2f;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .filters {
        flex-direction: column;
    }
    
    .devices-table {
        margin-top: 16px;
    }
    
    .devices-table th,
    .devices-table td {
        padding: 8px;
    }
    
    .btn-edit,
    .btn-delete {
        padding: 4px 8px;
        font-size: 0.9em;
    }

    .container-fluid {
        padding: 0;
        margin: 0;
    }
    
    .row {
        grid-template-columns: 1fr;
        padding: 10px;
        margin: 0;
    }
    
    .content {
        padding: 0;
    }
}

/* Status colors */
.devices-table td:nth-child(5) {
    text-transform: capitalize;
}

.devices-table td:nth-child(5)[data-status="active"] {
    color: #4caf50;
}

.devices-table td:nth-child(5)[data-status="inactive"] {
    color: #f44336;
}

.devices-table td:nth-child(5)[data-status="maintenance"] {
    color: #ff9800;
}

/* Chain Manager Specific Styles */
.row {
    display: grid;
    gap: 20px;
    margin: 0;
    padding: 20px;
    width: 100%;
    background-color: #1e1e1e; 
}

.col-md-3 {
    width: 100%;
}

.card {
    background-color: #1f1f1f;
    border: 1px solid #333;
    border-radius: 8px;
    height: calc(100vh - 200px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.7);
}

.card-header {
    background-color: #2d2d2d;
    border-bottom: 1px solid #333;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h5 {
    color: #90caf9;
    margin: 0;
}

.card-body {
    overflow-y: auto;
    padding: 1rem;
}

.list-group-item {
    background-color: #1f1f1f;
    border: 1px solid #333;
    color: #e0e0e0;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 8px;
}

.list-group-item:hover {
    background-color: #2d2d2d;
    border-left: 3px solid #90caf9;
}

.list-group-item.active {
    background-color: #2d2d2d;
    border-left: 3px solid #2196f3;
    color: #90caf9;
}

/* Modal Styles */
.modal-content {
    background-color: #1f1f1f;
    border: 1px solid #333;
}

.modal-header {
    background-color: #2d2d2d;
    border-bottom: 1px solid #333;
    color: #90caf9;
}

.modal-footer {
    background-color: #2d2d2d;
    border-top: 1px solid #333;
}

.btn-close {
    color: #e0e0e0;
    filter: invert(1) brightness(200%);
}

.form-label {
    color: #e0e0e0;
}

.form-control {
    background-color: #2d2d2d;
    border: 1px solid #404040;
    color: #e0e0e0;
}

.form-control:focus {
    background-color: #2d2d2d;
    border-color: #90caf9;
    box-shadow: 0 0 0 0.2rem rgba(144, 202, 249, 0.25);
    color: #e0e0e0;
}

/* Button Styles */
.btn-primary {
    background-color: #2196f3;
    border-color: #2196f3;
    color: white;
}

.btn-primary:hover {
    background-color: #1976d2;
    border-color: #1976d2;
}

.btn-secondary {
    background-color: #424242;
    border-color: #424242;
    color: #e0e0e0;
}

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

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

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

/* Responsive adjustments */
@media (max-width: 768px) {
    .row {
        grid-template-columns: 1fr;
        padding: 10px;
    }

    .card {
        height: auto;
        max-height: 300px;
        margin-bottom: 20px;
    }

    .modal-dialog {
        margin: 10px;
    }
}

/* Custom scrollbar */
.card-body::-webkit-scrollbar {
    width: 8px;
}

.card-body::-webkit-scrollbar-track {
    background: #1f1f1f;
}

.card-body::-webkit-scrollbar-thumb {
    background: #424242;
    border-radius: 4px;
}

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