:root {
    /* Colors - Dark Premium Theme */
    --bg-app: #0f1115;
    --bg-sidebar: #161b22;
    --bg-card: #1c2128;
    --bg-card-hover: #21262d;

    --text-primary: #f0f6fc;
    --text-secondary: #8b949e;
    --text-tertiary: #6e7681;

    --accent-primary: #58a6ff;
    /* Blue */
    --accent-secondary: #238636;
    /* Green */
    --accent-danger: #f85149;
    /* Red */
    --accent-warning: #d29922;
    /* Yellow */
    --accent-glow: rgba(88, 166, 255, 0.4);

    --border-color: #30363d;

    --font-heading: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --transition-speed: 0.2s;
}

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

body {
    font-family: var(--font-heading);
    background-color: var(--bg-app);
    color: var(--text-primary);
    overflow: hidden;
    /* App-like feel */
    height: 100vh;
}

/* Layout */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 10;
}

.sidebar-header {
    height: 70px;
    display: flex;
    align-items: center;
    padding: 0 24px;
    border-bottom: 1px solid var(--border-color);
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.logo i {
    color: var(--accent-primary);
    font-size: 1.4rem;
}

.badge {
    background-color: var(--accent-primary);
    color: #000;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
}

.sidebar-nav {
    flex: 1;
    padding: 24px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    transition: all var(--transition-speed);
}

.nav-item i {
    font-size: 1.2rem;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
}

.nav-item.active {
    background-color: rgba(88, 166, 255, 0.1);
    color: var(--accent-primary);
}

.sidebar-footer {
    padding: 24px;
    border-top: 1px solid var(--border-color);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    background: radial-gradient(circle at top right, #161b22, transparent 40%);
}

.top-bar {
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    border-bottom: 1px solid var(--border-color);
    background-color: rgba(15, 17, 21, 0.8);
    backdrop-filter: blur(10px);
    z-index: 5;
}

.top-bar h1 {
    font-size: 1.2rem;
    font-weight: 600;
}

.actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.clock {
    font-family: var(--font-mono);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 8px;
    border-radius: 50%;
    transition: background var(--transition-speed);
}

.btn-icon:hover {
    background-color: var(--bg-card-hover);
    color: var(--text-primary);
}

/* Content Area */
.content-wrapper {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
}

/* Components: Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    transition: transform var(--transition-speed), border-color var(--transition-speed);
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--text-secondary);
}

.stat-info h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 8px;
}

.stat-info .value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background-color: rgba(255, 255, 255, 0.05);
}

/* Tables */
.data-table-container {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.table-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 16px 24px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background-color: rgba(0, 0, 0, 0.2);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    color: var(--text-tertiary);
    font-size: 0.95rem;
}

.data-table tr:hover td {
    background-color: rgba(255, 255, 255, 0.02);
    color: var(--text-primary);
}

/* Status Badges */
.status-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
}

.status-active,
.status-success,
.status-online,
.status-successfully {
    background-color: rgba(35, 134, 54, 0.15);
    color: #3fb950;
    border: 1px solid rgba(35, 134, 54, 0.2);
}

.status-inactive,
.status-failed,
.status-error,
.status-offline {
    background-color: rgba(248, 81, 73, 0.15);
    color: #ff7b72;
    border: 1px solid rgba(248, 81, 73, 0.2);
}

.status-pending,
.status-warning,
.status-maintenance {
    background-color: rgba(210, 153, 34, 0.15);
    color: #e3b341;
    border: 1px solid rgba(210, 153, 34, 0.2);
}

.status-suspended,
.status-unknown {
    background-color: rgba(110, 118, 129, 0.15);
    color: #8b949e;
    border: 1px solid rgba(110, 118, 129, 0.2);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}

/* Loading */
.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
}

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

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Extensions Grid specific */
.extensions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.extension-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 16px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-align: center;
}

.ext-icon {
    font-size: 2rem;
    color: var(--text-secondary);
}

.ext-icon.active {
    color: var(--accent-secondary);
    text-shadow: 0 0 10px rgba(63, 185, 80, 0.4);
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.dots-loader span {
    display: inline-block;
    width: 6px;
    height: 6px;
    background-color: var(--text-secondary);
    border-radius: 50%;
    animation: dots 1.4s infinite ease-in-out both;
}

.dots-loader span:nth-child(1) {
    animation-delay: -0.32s;
}

.dots-loader span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes dots {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    width: 400px;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
}

.btn {
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    border: none;
    font-family: inherit;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--accent-primary);
    color: black;
}

.btn-primary:hover {
    filter: brightness(1.1);
}

.btn-cancel {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-cancel:hover {
    background: rgba(255, 255, 255, 0.05);
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px;
    background: var(--bg-app);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    outline: none;
}

.form-group input:focus {
    border-color: var(--accent-primary);
}