/* Theme Variables */
:root {
    /* Dark Theme (Default) */
    --brand-primary: #7C3AED;
    --brand-secondary: #3B82F6;
    --brand-accent: #EC4899;
    --bg-dark: #111827;
    --bg-surface: rgba(31, 41, 55, 0.6);
    --bg-surface-light: rgba(55, 65, 81, 0.4);
    --text-primary: #F9FAFB;
    --text-secondary: #E5E7EB;
    --text-tertiary: #9CA3AF;
    --border-color: rgba(107, 114, 128, 0.3);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    
    /* Status Colors */
    --status-running: #10B981;
    --status-warning: #F59E0B;
    --status-stopped: #9CA3AF;
    
    /* Provider Colors */
    --provider-hetzner: #F43F5E;
    --provider-contabo: #0EA5E9;
    --provider-proxmox: #FBBF24;
    
    /* Resource Colors */
    --resource-cpu: #8B5CF6;
    --resource-memory: #EC4899;
    --resource-storage: #14B8A6;
    --resource-network: #6366F1;
}

/* Light Theme Variables */
body.light-theme {
    --brand-primary: #6D28D9;
    --brand-secondary: #2563EB;
    --brand-accent: #DB2777;
    --bg-dark: #F9FAFB;
    --bg-surface: rgba(255, 255, 255, 0.7);
    --bg-surface-light: rgba(255, 255, 255, 0.5);
    --text-primary: #111827;
    --text-secondary: #374151;
    --text-tertiary: #6B7280;
    --border-color: rgba(209, 213, 219, 0.5);
    --glass-shadow: 0 8px 32px 0 rgba(100, 116, 139, 0.1);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

/* Background Effects */
.background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.bg-shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
    transition: all 15s ease-in-out;
}

.shape1 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--brand-primary), transparent 70%);
    top: -200px;
    left: -200px;
}

.shape2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--brand-secondary), transparent 70%);
    bottom: -100px;
    right: -100px;
}

.shape3 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, var(--brand-accent), transparent 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Glassmorphism */
.glass {
    background: var(--bg-surface);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--glass-shadow);
    transition: box-shadow 0.3s, backdrop-filter 0.3s;
}

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

/* Sidebar */
.sidebar {
    width: 280px;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    margin: 1rem;
    height: calc(100vh - 2rem);
    position: sticky;
    top: 1rem;
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(to right, var(--brand-primary), var(--brand-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.menu-toggle {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface-light);
    color: var(--text-secondary);
    font-size: 1.25rem;
    display: none;
}

.organization-selector {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bg-surface-light);
    border-radius: 10px;
    margin-bottom: 2rem;
    cursor: pointer;
}

.org-avatar {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
}

.org-info {
    flex: 1;
}

.org-info h3 {
    font-size: 0.95rem;
    font-weight: 600;
}

.org-info span {
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

.main-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.8rem 1rem;
    border-radius: 10px;
    color: var(--text-secondary);
    transition: all 0.2s;
    position: relative;
}

.nav-link i {
    font-size: 1.1rem;
    width: 20px;
}

.nav-link:hover {
    background: var(--bg-surface-light);
    color: var(--text-primary);
}

.nav-link.active {
    background: linear-gradient(90deg, rgba(124, 58, 237, 0.15), transparent);
    color: var(--brand-primary);
}

.nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 4px;
    background: var(--brand-primary);
    border-radius: 0 4px 4px 0;
}

.badge {
    background: var(--brand-primary);
    color: white;
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    margin-left: auto;
}

.sidebar-footer {
    margin-top: auto;
}

.theme-switch {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.theme-switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.theme-switch label {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 32px;
    background-color: var(--bg-surface-light);
    border-radius: 16px;
    cursor: pointer;
    overflow: hidden;
}

.theme-switch .toggle-thumb {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: var(--brand-primary);
    transition: transform 0.2s;
}

.theme-switch input:checked + label .toggle-thumb {
    transform: translateX(28px);
    background-color: var(--brand-secondary);
}

.light-icon, .dark-icon {
    position: absolute;
    top: 6px;
    font-size: 0.9rem;
    transition: opacity 0.2s;
}

.light-icon {
    right: 8px;
    color: #FBBF24;
    opacity: 0;
}

.dark-icon {
    left: 8px;
    color: #9CA3AF;
    opacity: 1;
}

.theme-switch input:checked + label .light-icon {
    opacity: 1;
}

.theme-switch input:checked + label .dark-icon {
    opacity: 0;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bg-surface-light);
    border-radius: 10px;
    cursor: pointer;
}

.user-profile img {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
}

.user-info h4 {
    font-size: 0.95rem;
    font-weight: 600;
}

.user-info span {
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

/* Main Content */
.content {
    flex: 1;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
}

.header-left h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-tertiary);
}

.breadcrumbs a {
    color: var(--text-secondary);
}

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

.search-box {
    position: relative;
}

.search-box input {
    width: 250px;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border-radius: 12px;
    border: none;
    background: var(--bg-surface-light);
    color: var(--text-primary);
    font-size: 0.95rem;
}

.search-box i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
}

.header-actions {
    display: flex;
    gap: 0.75rem;
}

.btn-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface-light);
    color: var(--text-secondary);
    font-size: 1.1rem;
    position: relative;
}

.notification-dot {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--brand-accent);
}

/* Dashboard Overview */
.dashboard-overview {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.card {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.provider-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
}

.card[data-provider="hetzner"] {
    border-top: 4px solid var(--provider-hetzner);
}

.card[data-provider="contabo"] {
    border-top: 4px solid var(--provider-contabo);
}

.card[data-provider="proxmox"] {
    border-top: 4px solid var(--provider-proxmox);
}

.card-body {
    flex: 1;
}

.stat-value {
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 0.5rem;
}

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

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

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

.status-dot.warning {
    background-color: var(--status-warning);
}

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

.btn-outline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-surface-light);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
}

/* Resource Summary */
.resource-summary {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

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

.resource-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.1rem;
}

.resource-icon.cpu {
    background-color: var(--resource-cpu);
}

.resource-icon.memory {
    background-color: var(--resource-memory);
}

.resource-icon.storage {
    background-color: var(--resource-storage);
}

.resource-icon.network {
    background-color: var(--resource-network);
}

.resource-info {
    flex: 1;
}

.resource-label {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.resource-bar {
    height: 10px;
    background-color: var(--bg-surface-light);
    border-radius: 5px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--brand-primary), var(--brand-secondary));
    border-radius: 5px;
    text-align: right;
    padding-right: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    line-height: 10px;
}

/* Server List */
.server-list-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.server-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
}

.server-list-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

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

.filter-group {
    display: flex;
    gap: 0.75rem;
}

.glass-select {
    padding: 0.5rem 2rem 0.5rem 1rem;
    border-radius: 8px;
    background: var(--bg-surface-light);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 0.9rem;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%239CA3AF'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 1.5em;
}

.btn-primary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    color: white;
    font-size: 0.9rem;
    font-weight: 500;
}

.server-list {
    padding: 1.5rem;
    overflow-x: auto;
}

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

th {
    text-align: left;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: var(--text-tertiary);
    font-weight: 500;
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 1rem;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-color);
}

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

.server-name {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
}

.provider-pill, .status-pill {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.provider-pill.hetzner {
    background-color: rgba(244, 63, 94, 0.15);
    color: var(--provider-hetzner);
}

.provider-pill.contabo {
    background-color: rgba(14, 165, 233, 0.15);
    color: var(--provider-contabo);
}

.provider-pill.proxmox {
    background-color: rgba(251, 191, 36, 0.15);
    color: var(--provider-proxmox);
}

.status-pill.running {
    background-color: rgba(16, 185, 129, 0.15);
    color: var(--status-running);
}

.status-pill.warning {
    background-color: rgba(245, 158, 11, 0.15);
    color: var(--status-warning);
}

.status-pill.stopped {
    background-color: rgba(156, 163, 175, 0.15);
    color: var(--status-stopped);
}

.resource-badges {
    display: flex;
    gap: 0.5rem;
}

.resource-pill {
    padding: 0.15rem 0.5rem;
    border-radius: 6px;
    font-size: 0.75rem;
    background-color: var(--bg-surface-light);
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
}

.action-buttons .btn-icon {
    width: 32px;
    height: 32px;
    font-size: 0.9rem;
}

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

.btn-icon.start {
    background-color: rgba(16, 185, 129, 0.15);
    color: var(--status-running);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .dashboard-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 992px) {
    .app-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: auto;
        position: relative;
        top: 0;
        height: auto;
        margin-bottom: 0;
    }
    
    .menu-toggle {
        display: flex;
    }
    
    .main-nav, .sidebar-footer {
        display: none;
    }
    
    .sidebar.show .main-nav,
    .sidebar.show .sidebar-footer {
        display: flex;
    }
}

@media (max-width: 768px) {
    .dashboard-cards {
        grid-template-columns: 1fr;
    }
    
    .header-right {
        display: none;
    }
    
    .server-list-actions {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .glass-select {
        flex: 1;
    }
}

/* Modal Styles */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(17, 24, 39, 0.7);
    backdrop-filter: blur(3px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.modal-backdrop.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    width: 90%;
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(20px);
    transition: transform 0.3s;
}

.modal-backdrop.active .modal {
    transform: translateY(0);
}

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

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    gap: 1rem;
}

.form-section {
    margin-bottom: 1.5rem;
}

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

.form-section input[type="text"],
.form-section select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-surface-light);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: inherit;
}

.form-section input[type="text"]::placeholder {
    color: var(--text-tertiary);
}

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

.provider-selector select {
    flex: 1;
}

/* Card-based selection for plans and OS */
.plan-cards,
.os-cards {
    display: grid;
    gap: 1rem;
    margin-top: 0.75rem;
}

.plan-cards {
    grid-template-columns: repeat(3, 1fr);
}

.os-cards {
    grid-template-columns: repeat(4, 1fr);
}

.plan-card input[type="radio"],
.os-card input[type="radio"] {
    position: absolute;
    opacity: 0;
}

.plan-card,
.os-card {
    cursor: pointer;
    position: relative;
}

.plan-card-content,
.os-card-content {
    padding: 1rem;
    border: 1px solid var(--border-color);
    transition: transform 0.3s, box-shadow 0.3s;
    height: 100%;
}

.plan-card input[type="radio"]:checked + .plan-card-content,
.os-card input[type="radio"]:checked + .os-card-content {
    border-color: var(--brand-primary);
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.05), rgba(59, 130, 246, 0.05));
}

.plan-card:hover .plan-card-content,
.os-card:hover .os-card-content {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(31, 38, 135, 0.2);
}

.plan-icon {
    width: 40px;
    height: 40px;
    margin-bottom: 0.75rem;
    color: var(--brand-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.plan-details h4 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.plan-details ul {
    list-style: none;
    padding: 0;
    margin-bottom: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.plan-details ul li {
    margin-bottom: 4px;
}

.plan-price {
    font-weight: 600;
    color: var(--brand-primary);
    font-size: 0.9rem;
}

.os-card-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1rem 0.75rem;
}

.os-icon {
    font-size: 1.75rem;
    margin-bottom: 0.75rem;
    color: var(--brand-primary);
}

.os-name {
    font-size: 0.75rem;
    font-weight: 500;
}

.btn-secondary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 10px;
    background: var(--bg-surface-light);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: background-color 0.2s;
}

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

.action-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 10px;
    background: var(--bg-surface-light);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
}

.action-btn:hover {
    transform: translateY(-2px);
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.1), rgba(59, 130, 246, 0.1));
    color: var(--brand-primary);
}

@media (max-width: 768px) {
    .plan-cards {
        grid-template-columns: 1fr;
    }

    .os-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}
