:root {
    --bg: #e0e5ec;
    --bg-dark: #d1d9e6;
    --text: #2d3436;
    --text-muted: #636e72;
    --primary: #6c5ce7;
    --primary-dark: #5a4bd1;
    --success: #00b894;
    --danger: #e17055;
    --warning: #fdcb6e;
    --shadow-light: #ffffff;
    --shadow-dark: #a3b1c6;
    --radius: 16px;
    --radius-sm: 10px;
    --radius-xs: 8px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* Neumorphism Base */
.neu-card {
    background: var(--bg);
    border-radius: var(--radius);
    box-shadow: 8px 8px 16px var(--shadow-dark), -8px -8px 16px var(--shadow-light);
    padding: 24px;
    margin-bottom: 20px;
}

.neu-card-raised {
    background: var(--bg);
    border-radius: var(--radius);
    box-shadow: 12px 12px 24px var(--shadow-dark), -12px -12px 24px var(--shadow-light);
    padding: 24px;
}

.neu-card-inset {
    background: var(--bg);
    border-radius: var(--radius-sm);
    box-shadow: inset 4px 4px 8px var(--shadow-dark), inset -4px -4px 8px var(--shadow-light);
    padding: 16px;
}

/* Buttons */
.neu-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--bg);
    box-shadow: 4px 4px 8px var(--shadow-dark), -4px -4px 8px var(--shadow-light);
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}
.neu-btn:hover {
    box-shadow: 2px 2px 4px var(--shadow-dark), -2px -2px 4px var(--shadow-light);
}
.neu-btn:active, .neu-btn.pressed {
    box-shadow: inset 3px 3px 6px var(--shadow-dark), inset -3px -3px 6px var(--shadow-light);
}
.neu-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.neu-btn-sm { padding: 6px 12px; font-size: 12px; border-radius: var(--radius-xs); }
.neu-btn-primary { color: var(--primary); }
.neu-btn-success { color: var(--success); }
.neu-btn-danger { color: var(--danger); }
.neu-btn-warning { color: #e67e22; }

/* Inputs */
.neu-input-group {
    margin-bottom: 16px;
}
.neu-input-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-muted);
}
.neu-input-group input, .neu-input-group select {
    width: 100%;
    padding: 12px 16px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--bg);
    box-shadow: inset 3px 3px 6px var(--shadow-dark), inset -3px -3px 6px var(--shadow-light);
    color: var(--text);
    font-size: 14px;
    outline: none;
    transition: box-shadow 0.2s;
}
.neu-input-group input:focus {
    box-shadow: inset 4px 4px 8px var(--shadow-dark), inset -4px -4px 8px var(--shadow-light), 0 0 0 2px var(--primary);
}

/* Alerts */
.neu-alert {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-weight: 500;
    box-shadow: inset 2px 2px 4px var(--shadow-dark), inset -2px -2px 4px var(--shadow-light);
}
.neu-alert-success { color: var(--success); background: rgba(0, 184, 148, 0.1); }
.neu-alert-error { color: var(--danger); background: rgba(225, 112, 85, 0.1); }

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #e0e5ec 0%, #d1d9e6 100%);
}
.login-container { width: 100%; max-width: 400px; padding: 20px; }
.login-card { text-align: center; }
.login-card h2 { margin: 8px 0 24px; color: var(--primary); }
.login-icon { font-size: 48px; }
.login-card .neu-btn { width: 100%; justify-content: center; margin-top: 8px; }

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

/* Sidebar */
.sidebar {
    width: 240px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    border-radius: 0;
    padding: 0;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100;
}
.sidebar-brand {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}
.sidebar-brand h2 { font-size: 18px; color: var(--primary); }
.brand-icon { font-size: 28px; }

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    transition: all 0.2s;
}
.nav-item:hover {
    background: var(--bg-dark);
    color: var(--text);
    box-shadow: 3px 3px 6px var(--shadow-dark), -3px -3px 6px var(--shadow-light);
}
.nav-item.active {
    box-shadow: inset 3px 3px 6px var(--shadow-dark), inset -3px -3px 6px var(--shadow-light);
    color: var(--primary);
    font-weight: 600;
}
.nav-icon { font-size: 18px; }

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(0,0,0,0.05);
}
.sidebar-footer .neu-btn { width: 100%; justify-content: center; }

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 240px;
    padding: 32px;
    max-width: 1100px;
}
.page-title {
    font-size: 28px;
    margin-bottom: 24px;
    color: var(--text);
}

/* Tab Content */
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Status Grid */
.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}
.status-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
}
.status-icon { font-size: 36px; }
.status-info h3 { font-size: 13px; color: var(--text-muted); margin-bottom: 4px; }
.status-text { font-size: 20px; font-weight: 700; }
.text-green { color: var(--success); }
.text-red { color: var(--danger); }
.text-muted { color: var(--text-muted); font-style: italic; }

/* Current Config Card */
.current-config-card h3 { margin-bottom: 12px; }
.vpn-controls {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    flex-wrap: wrap;
}

/* OVPN List */
.ovpn-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 500px;
    overflow-y: auto;
}
.ovpn-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px !important;
    transition: all 0.2s;
}
.ovpn-item:hover {
    box-shadow: inset 5px 5px 10px var(--shadow-dark), inset -5px -5px 10px var(--shadow-light);
}
.ovpn-item.active-config {
    border-left: 4px solid var(--primary);
}
.ovpn-info { display: flex; flex-direction: column; gap: 4px; }
.ovpn-name { font-weight: 600; font-size: 15px; }
.ovpn-meta { font-size: 12px; color: var(--text-muted); }
.ovpn-actions { display: flex; gap: 6px; }

.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}
.badge-active { background: rgba(108, 92, 231, 0.15); color: var(--primary); }

/* Upload Zone */
.upload-zone {
    text-align: center;
    padding: 40px !important;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}
.upload-zone:hover, .upload-zone.drag-over {
    box-shadow: inset 5px 5px 10px var(--shadow-dark), inset -5px -5px 10px var(--shadow-light), 0 0 0 3px var(--primary);
}
.upload-zone input[type="file"] {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
}
.upload-icon { font-size: 48px; margin-bottom: 12px; }
.upload-zone p { margin: 4px 0; }
.file-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    padding: 10px 16px;
    border-radius: var(--radius-xs);
    background: rgba(108, 92, 231, 0.1);
}

/* Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}
.info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.info-label { font-size: 12px; color: var(--text-muted); }
.info-value { font-weight: 600; }

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.3);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal {
    width: 90%;
    max-width: 700px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.modal-body {
    overflow-y: auto;
    flex: 1;
}
.modal-body pre {
    white-space: pre-wrap;
    word-break: break-all;
    font-size: 13px;
    line-height: 1.6;
    background: var(--bg-dark);
    padding: 16px;
    border-radius: var(--radius-sm);
    max-height: 60vh;
    overflow-y: auto;
}

/* Loading */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(224, 229, 236, 0.85);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 16px;
}
.loading-overlay.show { display: flex; }
.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--shadow-dark);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Card header */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
    background: var(--shadow-dark);
    border-radius: 4px;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 60px;
        overflow: hidden;
    }
    .sidebar-brand h2, .nav-item span:not(.nav-icon), .sidebar-footer .neu-btn span:not(.nav-icon) {
        display: none;
    }
    .sidebar-brand { justify-content: center; padding: 20px 10px; }
    .nav-item { justify-content: center; padding: 12px; }
    .main-content { margin-left: 60px; padding: 20px; }
    .status-grid { grid-template-columns: repeat(2, 1fr); }
    .ovpn-item { flex-direction: column; gap: 10px; }
    .ovpn-actions { width: 100%; justify-content: flex-end; }
}
