:root {
    /* Light Mode (Default) */
    --primary-color: #2563eb;
    --primary-light: #dbeafe;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --text-dark: #1e293b;
    --text-light: #64748b;
    --bg-light: #f8fafc;
    --bg-dark: #1e293b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --provider-hetzner: #d90429;
    --provider-contabo: #0077b6;
    --provider-proxmox: #ff9e00;
    --card-bg: #ffffff;
}

@media (prefers-color-scheme: dark) {
    :root {
        /* Dark Mode */
        --primary-color: #3b82f6;
        --primary-light: #1e3a8a;
        --secondary-color: #94a3b8;
        --success-color: #059669;
        --warning-color: #d97706;
        --error-color: #dc2626;
        --text-dark: #f1f5f9;
        --text-light: #94a3b8;
        --bg-light: #111827;
        --bg-dark: #0f172a;
        --border-color: #1e293b;
        --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.2);
        --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
        --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
        --card-bg: #1e293b;
    }
}

/* Custom theme selection */
body.light-theme {
    --primary-color: #2563eb;
    --primary-light: #dbeafe;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --text-dark: #1e293b;
    --text-light: #64748b;
    --bg-light: #f8fafc;
    --bg-dark: #1e293b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --card-bg: #ffffff;
}

body.dark-theme {
    --primary-color: #3b82f6;
    --primary-light: #1e3a8a;
    --secondary-color: #94a3b8;
    --success-color: #059669;
    --warning-color: #d97706;
    --error-color: #dc2626;
    --text-dark: #f1f5f9;
    --text-light: #94a3b8;
    --bg-light: #111827;
    --bg-dark: #0f172a;
    --border-color: #1e293b;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
    --card-bg: #1e293b;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    color: var(--text-dark);
    background-color: #f9fafb;
    line-height: 1.5;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styles */
.sidebar {
    width: 260px;
    background-color: var(--bg-dark);
    color: white;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
    padding: 1.5rem;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    overflow-y: auto;
    z-index: 10;
}

.logo {
    padding: 0.5rem 0;
    margin-bottom: 2rem;
    text-align: center;
}

.logo img {
    max-width: 100%;
    height: auto;
}

.org-selector {
    margin-bottom: 2rem;
}

.org-selector select {
    width: 100%;
    padding: 0.5rem;
    border-radius: 0.375rem;
    border: 1px solid var(--border-color);
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 0.875rem;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 1rem;
}

.nav-items {
    list-style: none;
    margin-bottom: auto;
    margin-top: 1rem;
}

.nav-item {
    display: block;
    margin-bottom: 0.5rem;
}

.nav-item a {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--text-light);
    text-decoration: none;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
}

.nav-item a:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
}

.nav-item.active a {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    font-weight: 500;
}

.nav-item i {
    margin-right: 0.75rem;
    font-size: 1.125rem;
    color: var(--secondary-color);
}

.nav-item.active i {
    color: var(--primary-color);
}

.user-info {
    display: flex;
    align-items: center;
    padding: 1rem 0;
    margin-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 0.75rem;
    object-fit: cover;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.username {
    font-weight: 600;
    font-size: 0.875rem;
    color: white;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-light);
}

/* Main Content Styles */
.content {
    flex: 1;
    margin-left: 260px; /* Match the sidebar width */
    padding: 1.5rem;
    background-color: var(--bg-light);
    min-height: 100vh;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.page-title h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn {
    padding: 0.625rem 1.25rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    transition: all 0.2s ease;
    background-color: var(--primary-color);
    color: white;
    border: none;
}

.btn:hover {
    background-color: #1d4ed8;
}

.btn i {
    margin-right: 0.5rem;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border-radius: 0.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: transparent;
    color: var(--secondary-color);
    border: 1px solid var(--border-color);
}

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

.btn-icon.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.search-bar {
    position: relative;
}

.search-bar input {
    padding: 0.5rem 1rem 0.5rem 2.5rem;
    border-radius: 0.375rem;
    border: 1px solid var(--border-color);
    width: 250px;
    font-size: 0.875rem;
}

.search-bar i {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
}

.notifications {
    position: relative;
}

.notifications i {
    font-size: 1.125rem;
    color: var(--secondary-color);
    cursor: pointer;
}

.badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: var(--error-color);
    color: white;
    font-size: 0.75rem;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.widget {
    background-color: var(--card-bg);
    border-radius: 0.5rem;
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
}

.widget h2 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    color: var(--text-dark);
}

/* Resource Summary */
.resource-summary {
    grid-column: span 2;
}

.resource-stats {
    display: flex;
    justify-content: flex-start;
    gap: 2rem;
}

.stat-card {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 0.375rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    font-size: 1.25rem;
    color: white;
}

.stat-icon.servers {
    background-color: #4f46e5;
}

.stat-icon.networks {
    background-color: #f97316;
}

.stat-icon.storage {
    background-color: #06b6d4;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-dark);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-light);
}

/* Server Status */
.server-status {
    grid-column: span 1;
}

.status-summary {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.status-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    flex: 1;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-bottom: 0.5rem;
}

.status-indicator.running {
    background-color: var(--success-color);
}

.status-indicator.stopped {
    background-color: var(--secondary-color);
}

.status-indicator.error {
    background-color: var(--error-color);
}

.status-count {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
}

.status-label {
    font-size: 0.75rem;
    color: var(--text-light);
}

/* Provider Distribution */
.provider-distribution {
    grid-column: span 1;
}

.chart-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.provider-chart {
    display: flex;
    align-items: center;
    height: 2rem;
    border-radius: 0.25rem;
    overflow: hidden;
}

.chart-segment {
    height: 100%;
    text-indent: -9999px;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.legend-item {
    display: flex;
    align-items: center;
    font-size: 0.875rem;
}

.color-box {
    width: 12px;
    height: 12px;
    margin-right: 0.5rem;
}

.color-box.hetzner, .chart-segment.hetzner {
    background-color: var(--provider-hetzner);
}

.color-box.contabo, .chart-segment.contabo {
    background-color: var(--provider-contabo);
}

.color-box.proxmox, .chart-segment.proxmox {
    background-color: var(--provider-proxmox);
}

/* Recent Activity */
.activity-list {
    list-style: none;
}

.activity-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.75rem;
    font-size: 1rem;
    color: white;
}

.activity-icon.create {
    background-color: var(--success-color);
}

.activity-icon.restart {
    background-color: var(--warning-color);
}

.activity-icon.delete {
    background-color: var(--error-color);
}

.activity-title {
    font-weight: 500;
    font-size: 0.875rem;
}

.activity-meta {
    font-size: 0.75rem;
    color: var(--text-light);
}

.view-all {
    display: block;
    text-align: center;
    margin-top: 1rem;
    font-size: 0.875rem;
    color: var(--primary-color);
    text-decoration: none;
}

/* Server List Table */
.quick-access {
    background-color: white;
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.quick-access h2 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #111827;
}

.server-list {
    width: 100%;
    overflow: auto;
}

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

.server-list th {
    text-align: left;
    padding: 0.75rem 0.5rem;
    font-weight: 500;
    color: #6b7280;
    font-size: 0.8rem;
    border-bottom: 1px solid #e5e7eb;
}

.server-list td {
    padding: 0.75rem 0.5rem;
    border-bottom: 1px solid #e5e7eb;
    color: #111827;
    font-size: 0.875rem;
    vertical-align: middle;
}

.server-name {
    color: #111827;
    font-weight: 500;
}

.provider {
    display: flex;
    align-items: center;
}

.provider-icon {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    margin-right: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 500;
    font-size: 0.75rem;
}

.provider-icon.hetzner {
    background-color: #e11d48;
}

.provider-icon.contabo {
    background-color: #0284c7;
}

.provider-icon.proxmox {
    background-color: #ea580c;
}

.status-running {
    color: #10b981;
    font-weight: normal;
}

.status-stopped {
    color: #6b7280;
    font-weight: normal;
}

.resource-item {
    display: flex;
    align-items: center;
    margin-bottom: 0.25rem;
    color: #6b7280;
    font-size: 0.75rem;
}

.resource-item i {
    margin-right: 0.25rem;
    color: #9ca3af;
    width: 14px;
}

.actions {
    display: flex;
    gap: 0.375rem;
    justify-content: flex-end;
}

.action-btn {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    background-color: transparent;
    color: #9ca3af;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    outline: none;
    font-size: 0.8rem;
}

.action-btn:hover {
    color: #111827;
    background-color: #f3f4f6;
}

.view-all {
    display: block;
    text-align: right;
    margin-top: 0.75rem;
    font-size: 0.8125rem;
    color: #4f46e5;
    text-decoration: none;
}

.view-all:hover {
    text-decoration: underline;
}

/* Theme Toggle */
.theme-toggle {
    display: flex;
    align-items: center;
    margin-right: 1rem;
}

.theme-toggle-label {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
    margin-left: 0.5rem;
}

.theme-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.theme-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--text-light);
    transition: .4s;
    border-radius: 24px;
}

.theme-toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

.theme-toggle input:checked + .theme-toggle-slider {
    background-color: var(--primary-color);
}

.theme-toggle input:checked + .theme-toggle-slider:before {
    transform: translateX(24px);
}

.theme-toggle-icon {
    color: var(--text-dark);
}

/* Mobile Responsive Adjustments */
@media (max-width: 1024px) {
    .sidebar {
        position: static;
        width: 100%;
        height: auto;
        max-height: none;
        padding-bottom: 0;
    }
    
    .content {
        margin-left: 0;
    }
    
    .app-container {
        flex-direction: column;
    }
    
    .nav-items {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
        margin-bottom: 1rem;
    }
    
    .nav-item {
        margin-bottom: 0;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .top-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .search-bar input {
        width: 100%;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .resource-stats {
        flex-direction: column;
        gap: 1rem;
    }
    
    .stat-card {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .content {
        padding: 1rem;
    }
    
    .server-list table {
        font-size: 0.75rem;
    }
    
    .server-list th,
    .server-list td {
        padding: 0.5rem;
    }
    
    .page-title h1 {
        font-size: 1.25rem;
    }
    
    .btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.75rem;
    }
    
    .actions {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
}
