:root {
    --bg-color: #0b0c10;
    --card-bg: rgba(20, 22, 30, 0.45);
    --card-border: rgba(255, 255, 255, 0.05);
    --card-hover: rgba(255, 255, 255, 0.08);
    --primary: #8b5cf6;
    --primary-hover: #7c3aed;
    --primary-glow: rgba(139, 92, 246, 0.4);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #f43f5e;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(circle at 15% 15%, rgba(139, 92, 246, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 85% 85%, rgba(244, 63, 94, 0.1) 0%, transparent 40%);
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2.5rem;
    animation: fadeIn 0.8s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--primary);
    filter: drop-shadow(0 0 8px var(--primary-glow));
}

.logo h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.5px;
    background: linear-gradient(to right, #fff, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-actions {
    display: flex;
    gap: 14px;
}

/* Buttons */
.btn {
    padding: 0.65rem 1.4rem;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.6);
}

.btn-outline {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-main);
    border: 1px solid rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255,255,255,0.2);
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.75rem;
    border-radius: 6px;
}

/* Stats */
.stats-overview {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-radius: 20px;
    padding: 1.8rem;
    flex: 1;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, border-color 0.3s ease;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2);
}

.stat-card:hover {
    transform: translateY(-4px);
    border-color: rgba(255,255,255,0.15);
}

.stat-icon {
    position: absolute;
    top: -15px;
    right: -10px;
    font-size: 5rem;
    opacity: 0.05;
    z-index: 0;
}

.pulse-glow {
    animation: glow 3s ease-in-out infinite alternate;
}

@keyframes glow {
    from { opacity: 0.05; text-shadow: 0 0 10px var(--primary); }
    to { opacity: 0.15; text-shadow: 0 0 20px var(--primary); }
}

.stat-card h3 {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
    z-index: 1;
    position: relative;
    background: linear-gradient(to right, #fff, #cbd5e1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 1;
    position: relative;
}

.highlight-card {
    background: linear-gradient(135deg, rgba(20, 22, 30, 0.7), rgba(139, 92, 246, 0.08));
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.highlight-card h3 {
    background: linear-gradient(to right, #fff, #c4b5fd);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-indicator {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.mini-progress {
    margin-top: 12px;
    height: 4px;
    background: rgba(0,0,0,0.3);
}

/* Table */
.table-container {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    min-height: 250px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2);
}

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

th {
    text-align: left;
    padding: 1.2rem 1.5rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid rgba(255,255,255,0.05);
    background: rgba(0, 0, 0, 0.2);
}

td {
    padding: 1.2rem 1.5rem;
    font-size: 0.875rem;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    vertical-align: middle;
    transition: background 0.2s ease;
}

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

tr:hover td {
    background: rgba(255, 255, 255, 0.03);
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    backdrop-filter: blur(4px);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.1);
}

.badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.2);
}
.badge-success::before { background: var(--success); box-shadow: 0 0 6px var(--success); }

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
    box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.2);
}
.badge-warning::before { background: var(--warning); box-shadow: 0 0 6px var(--warning); }

.badge-danger {
    background: rgba(244, 63, 94, 0.15);
    color: var(--danger);
    box-shadow: inset 0 0 0 1px rgba(244, 63, 94, 0.2);
}
.badge-danger::before { background: var(--danger); box-shadow: 0 0 6px var(--danger); }

/* Progress Bar */
.progress-container {
    width: 100%;
    height: 6px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 4px;
    margin-top: 8px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.5);
}

.progress-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.3s ease;
    position: relative;
    overflow: hidden;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.usage-text {
    font-weight: 600;
    color: var(--text-main);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal {
    background: rgba(20, 22, 30, 0.85);
    border: 1px solid rgba(255,255,255,0.1);
    backdrop-filter: blur(25px) saturate(200%);
    border-radius: 24px;
    width: 90%;
    max-width: 650px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8), 0 0 40px rgba(139, 92, 246, 0.1);
    transform: translateY(30px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.modal-overlay.active .modal {
    transform: translateY(0) scale(1);
}

.modal-header {
    padding: 1.8rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.3rem;
    font-weight: 700;
}

.close-btn {
    background: rgba(255,255,255,0.05);
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    background: rgba(244, 63, 94, 0.2);
    color: var(--danger);
    transform: rotate(90deg);
}

.modal-body {
    padding: 1.8rem;
}

.modal-desc {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 1.2rem;
}

#config-editor {
    width: 100%;
    height: 280px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    color: var(--text-main);
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.875rem;
    padding: 1.2rem;
    resize: vertical;
    line-height: 1.5;
    transition: border-color 0.3s;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.5);
}

#config-editor:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.5), 0 0 0 3px var(--primary-glow);
}

.modal-footer {
    padding: 1.5rem 1.8rem;
    border-top: 1px solid rgba(255,255,255,0.05);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: rgba(0,0,0,0.2);
    border-bottom-left-radius: 24px;
    border-bottom-right-radius: 24px;
}

/* Loader */
.loader-container {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(11, 12, 16, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.loader {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(255,255,255,0.05);
    border-radius: 50%;
    border-top-color: var(--primary);
    border-bottom-color: #38bdf8;
    animation: spin 1s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
}

.pulse-red {
    background: var(--danger);
    box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.7);
    animation: pulse-danger 2s infinite;
}

@keyframes pulse-danger {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(244, 63, 94, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(244, 63, 94, 0); }
}

@media (max-width: 768px) {
    .stats-overview {
        flex-direction: column;
    }
    .app-container {
        padding: 1rem;
    }
}
