:root {
    --bg-color: #f8fafc;
    --text-color: #0f172a;
    --text-muted: #64748b;
    --card-bg: rgba(255, 255, 255, 0.85);
    --border-color: rgba(0, 0, 0, 0.1);
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --danger: #ef4444;
    --success: #22c55e;
    --warning: #f59e0b;
    --sidebar-bg: rgba(255, 255, 255, 0.9);
}

[data-theme="dark"] {
    --bg-color: #020617;
    --text-color: #f8fafc;
    --text-muted: #94a3b8;
    --card-bg: rgba(15, 23, 42, 0.75);
    --border-color: rgba(255, 255, 255, 0.06);
    --primary: #3b82f6;
    --primary-hover: #60a5fa;
    --sidebar-bg: rgba(2, 6, 23, 0.92);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    transition: background-color 0.3s, color 0.3s, border-color 0.3s, box-shadow 0.3s;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
}

.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    padding: 2rem;
}

/* Typography elements */
h1, h2, h3, h4 {
    margin-bottom: 0.5rem;
    font-weight: 600;
}
p {
    color: var(--text-muted);
}

/* Forms and Buttons */
.form-group {
    margin-bottom: 1.25rem;
}
.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
}
.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-color);
    outline: none;
    font-family: inherit;
    font-size: 1rem;
}
select.form-control option {
    background: var(--bg-color);
    color: var(--text-color);
}
.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    text-align: center;
    font-family: inherit;
    font-size: 0.95rem;
    text-decoration: none;
}
.btn-primary {
    background-color: var(--primary);
    color: #fff;
    box-shadow: 0 4px 14px 0 rgba(37, 99, 235, 0.39);
}
.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.23);
    transform: translateY(-1px);
}
.btn-block {
    display: block;
    width: 100%;
}
.btn-danger {
    background-color: var(--danger);
    color: white;
}
.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-icon:hover {
    background: var(--border-color);
}
.hidden {
    display: none !important;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.alert-danger {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}
.alert-success {
    background-color: rgba(34, 197, 94, 0.1);
    color: var(--success);
    border: 1px solid rgba(34, 197, 94, 0.2);
}

/* Layouts */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background-image: radial-gradient(circle at top right, rgba(37, 99, 235, 0.15) 0%, transparent 40%);
}
.login-container {
    width: 100%;
    max-width: 420px;
    padding: 1rem;
    z-index: 10;
}
.login-header {
    text-align: center;
    margin-bottom: 2rem;
}
.login-footer {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--text-muted);
}
.theme-toggle-container {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 20;
}

/* Dashboard Layout */
.dashboard-layout {
    display: flex;
    min-height: 100vh;
}
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    backdrop-filter: blur(12px);
    border-right: 1px solid var(--border-color);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease, padding 0.3s ease;
    /* Sticky Sidebar configuration */
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}
.sidebar.minimized {
    width: 80px;
    padding: 1.5rem 0.75rem;
}
.sidebar.minimized .sidebar-title,
.sidebar.minimized .nav-text {
    display: none;
}
.sidebar.minimized .sidebar-header {
    justify-content: center !important;
}
.sidebar.minimized .nav-link {
    justify-content: center;
    padding: 0.75rem;
}
.sidebar.minimized .nav-link svg {
    margin-right: 0 !important;
}
.sidebar-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}
.sidebar-nav {
    flex: 1;
}
.nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    font-weight: 500;
    transition: background-color 0.3s, color 0.3s, justify-content 0.3s;
}
.nav-link:hover, .nav-link.active {
    background-color: var(--primary);
    color: #fff;
    box-shadow: 0 4px 14px 0 rgba(37, 99, 235, 0.2);
}
.main-content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    position: relative;
}
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}
.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Grids */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}
.stat-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.stat-card h3 {
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 500;
}
.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    margin-top: 0.5rem;
    color: var(--text-color);
}

/* Progress bars */
.progress-bar-container {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 1rem;
}
.progress-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.8s ease;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}
table {
    width: 100%;
    border-collapse: collapse;
}
th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}
th {
    font-weight: 600;
    color: var(--text-muted);
    background-color: rgba(0,0,0,0.02);
}
[data-theme="dark"] th {
    background-color: rgba(255,255,255,0.02);
}
tr:last-child td {
    border-bottom: none;
}

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.badge-active {
    background-color: rgba(34, 197, 94, 0.15);
    color: var(--success);
}
.badge-inactive {
    background-color: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}
.badge-proxmox {
    background-color: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}
.badge-idrac {
    background-color: rgba(37, 99, 235, 0.15);
    color: var(--primary);
}
.badge-mikrotik {
    background-color: rgba(168, 85, 247, 0.15);
    color: #a855f7;
}
.badge-linux {
    background-color: rgba(234, 179, 8, 0.15);
    color: #eab308;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal-container {
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}
.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

@keyframes pulse {
    0% { transform: scale(0.95); opacity: 1; }
    50% { transform: scale(1.15); opacity: 0.7; }
    100% { transform: scale(0.95); opacity: 1; }
}
