:root {
    --bg-background: #09090b;
    --bg-card: #18181b;
    --bg-surface: #27272a;

    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;

    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-foreground: #ffffff;

    --destructive: #ef4444;
    --destructive-hover: #dc2626;

    --border: #27272a;
    --input-bg: #18181b;
    --ring: #2563eb;

    --radius: 0.5rem;
    --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

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

body {
    background-color: var(--bg-background);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--primary);
}

/* Layout */
.layout-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    background-color: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1rem;
    transition: transform 0.3s ease;
}

.sidebar-header {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 2rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item a {
    display: block;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
}

.nav-item a:hover,
.nav-item a.active {
    background-color: var(--bg-surface);
    color: var(--text-primary);
}

.main-content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

.nav-divider {
    height: 1px;
    background: var(--border);
    margin: 1rem 0;
}

.nav-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
    padding-left: 1rem;
}

/* Components */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
}

.card-header {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    outline: none;
}

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

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

.btn-ghost {
    background-color: transparent;
    color: var(--text-primary);
}

.btn-ghost:hover {
    background-color: var(--bg-surface);
}

.btn-destructive {
    background-color: var(--destructive);
    color: white;
}

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

/* Mobile Toggle - MOVED AFTER .btn TO ENSURE SPECIFICITY/CASCADE */
.mobile-nav-toggle {
    display: none !important;
    /* Force hide on desktop */
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 50;
    padding: 0.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    border-radius: var(--radius);
    color: var(--text-primary);
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        height: 100vh;
        z-index: 40;
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .mobile-nav-toggle {
        display: block !important;
        /* Force show on mobile */
    }

    .main-content {
        padding: 1rem;
        padding-top: 4rem;
        /* Space for toggle */
    }
}


/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

/* Global form styling - applies to ALL inputs, selects, textareas */
.form-input,
.form-select,
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="url"],
input[type="search"],
select,
textarea {
    width: 100%;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background-color: var(--input-bg);
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: var(--text-primary);
    transition: border-color 0.2s;
}

/* Select dropdown arrow styling for dark theme */
select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23a1a1aa' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
    cursor: pointer;
}

select option {
    background-color: var(--bg-card);
    color: var(--text-primary);
}

/* Exclude checkboxes and radios from full-width styling */
input[type="checkbox"],
input[type="radio"] {
    width: auto;
    padding: 0;
    margin: 0;
    cursor: pointer;
    accent-color: var(--primary);
}

/* Focus states */
.form-input:focus,
.form-select:focus,
input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
input[type="url"]:focus,
input[type="search"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--ring);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

/* File inputs */
input[type="file"] {
    border: 1px dashed var(--border);
    background-color: var(--input-bg);
    padding: 0.5rem;
    border-radius: var(--radius);
    color: var(--text-secondary);
    cursor: pointer;
}

input[type="file"]::-webkit-file-upload-button {
    background-color: var(--primary);
    color: var(--primary-foreground);
    border: none;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius);
    cursor: pointer;
    margin-right: 0.5rem;
}

/* Login Page Specifics */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background-color: var(--bg-background);
}

.login-card {
    width: 100%;
    max-width: 400px;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

/* Tables */
.table-container {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    text-align: left;
}

.table th {
    background-color: var(--bg-surface);
    color: var(--text-secondary);
    font-weight: 500;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
}

.table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}

.table tr:last-child td {
    border-bottom: none;
}

.table tr:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

/* Utility */
.text-center {
    text-align: center;
}

.mt-4 {
    margin-top: 1rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.flex {
    display: flex;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-2 {
    gap: 0.5rem;
}

.w-full {
    width: 100%;
}

.hidden {
    display: none !important;
}

/* Status Indicators */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-online {
    background-color: rgba(34, 197, 94, 0.1);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.status-offline {
    background-color: rgba(113, 113, 122, 0.1);
    color: #a1a1aa;
    border: 1px solid rgba(113, 113, 122, 0.2);
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: currentColor;
}

/* Sidebar Version */
.sidebar-version {
    margin-top: auto;
    padding: 1rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    border-top: 1px solid var(--border);
}