:root {
    --bg-color: #0b0b14;
    --card-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --accent-primary: #8a2be2;
    --accent-secondary: #00d2ff;
    --text-main: #e0e0e0;
    --text-dim: #a0a0a0;
    --error: #ff4d4d;
    --success: #00ff88;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

.glow-bg {
    position: fixed;
    top: -10%;
    left: -10%;
    width: 120%;
    height: 120%;
    background: radial-gradient(circle at 20% 30%, rgba(138, 43, 226, 0.15) 0%, transparent 50%),
                radial-gradient(circle at 80% 70%, rgba(0, 210, 255, 0.1) 0%, transparent 50%);
    z-index: -1;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.glass-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 3rem;
    background: rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.logo h1 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 2px;
}

.logo span {
    color: var(--accent-secondary);
    font-weight: 400;
}

.pulse {
    width: 12px;
    height: 12px;
    background: var(--accent-secondary);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--accent-secondary);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.5); opacity: 0.5; }
    100% { transform: scale(1); opacity: 1; }
}

.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

#login-section {
    max-width: 500px;
    margin: 10vh auto;
    text-align: center;
}

h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    background: linear-gradient(90deg, #fff, #a0a0a0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

p {
    color: var(--text-dim);
    margin-bottom: 2rem;
}

.input-group {
    display: flex;
    gap: 1rem;
}

input, textarea {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1rem;
    color: #fff;
    width: 100%;
    outline: none;
    transition: all 0.3s;
}

input:focus, textarea:focus {
    border-color: var(--accent-secondary);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 15px rgba(0, 210, 255, 0.1);
}

.primary-btn {
    background: linear-gradient(135deg, var(--accent-primary), #6a1b9a);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 1rem 2rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(138, 43, 226, 0.4);
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

@media (max-width: 968px) {
    .dashboard-grid { grid-template-columns: 1fr; }
}

.tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.tab-btn {
    background: none;
    border: none;
    color: var(--text-dim);
    padding: 0.5rem 1rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.3s;
}

.tab-btn.active {
    color: #fff;
    border-bottom: 2px solid var(--accent-secondary);
}

textarea {
    min-height: 150px;
    font-family: monospace;
    margin-bottom: 1rem;
}

.provider-key-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    margin-bottom: 1rem;
}

.provider-key-item,
.key-add-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.75rem;
    align-items: center;
}

.provider-key-item {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 0.75rem;
}

.provider-key-mask {
    color: var(--accent-secondary);
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.provider-key-input {
    font-family: 'Courier New', Courier, monospace;
    padding: 0.75rem;
}

.provider-key-actions {
    display: flex;
    gap: 0.5rem;
}

.compact-btn {
    border-radius: 10px;
    padding: 0.65rem 0.85rem;
    white-space: nowrap;
}

.danger-btn {
    color: var(--error);
}

.provider-key-empty {
    border: 1px dashed var(--glass-border);
    border-radius: 12px;
    color: var(--text-dim);
    padding: 1rem;
    text-align: center;
}

.key-add-row {
    margin-bottom: 1rem;
}

@media (max-width: 640px) {
    .provider-key-item,
    .key-add-row {
        grid-template-columns: 1fr;
    }

    .provider-key-actions {
        justify-content: flex-end;
        flex-wrap: wrap;
    }
}

.label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.label-row label {
    margin-bottom: 0;
}

.text-btn {
    background: none;
    border: none;
    color: var(--accent-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    opacity: 0.8;
    transition: 0.3s;
}

.text-btn:hover {
    opacity: 1;
}

.text-btn:disabled {
    color: var(--text-dim);
    cursor: not-allowed;
    text-decoration: none;
}

.order-section {
    margin: 2rem 0;
}

.sortable-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sort-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    padding: 0.8rem 1rem;
    border-radius: 10px;
    margin-bottom: 0.5rem;
    cursor: grab;
    transition: 0.2s;
    user-select: none;
}

.sort-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.sort-item:active {
    cursor: grabbing;
}

.sort-item.dragging {
    opacity: 0.5;
    background: var(--accent-primary);
    border-color: var(--accent-secondary);
}

.extension-list {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ext-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    padding: 1rem;
    border-radius: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ext-info h4 { margin-bottom: 0.2rem; }
.ext-info p { margin-bottom: 0; font-size: 0.8rem; }

.console-box {
    background: #000;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1rem;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85rem;
    color: #00ff88;
    max-height: 250px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

.console-box .err { color: #ff4d4d; }
.console-box .warn { color: #ffcc00; }
.console-box .info { color: #00d2ff; }
.console-box .success { color: #00ff88; }

/* Statistics Styles */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.stat-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    transition: 0.3s;
}

.stat-card:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-5px);
}

.stat-card h3 {
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-value {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--accent-secondary);
}

.stats-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.stats-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1rem;
}

.stats-item-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.stats-bar-bg {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.stats-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    width: 0%;
    transition: width 1s ease-out;
}

.chart-container {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.5rem;
    height: 300px;
}

.mt-large { margin-top: 2.5rem; }
.mt-small { margin-top: 0.8rem; }

.hidden { display: none !important; }

.glass-alert {
    background: rgba(0, 210, 255, 0.1);
    border: 1px solid var(--accent-secondary);
    padding: 1rem;
    border-radius: 12px;
    margin-top: 1rem;
    word-break: break-all;
}

.glass-alert code {
    display: block;
    margin-top: 0.5rem;
    color: var(--accent-secondary);
    font-size: 0.9rem;
}

#toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 1000;
}

.toast {
    background: rgba(20, 20, 30, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 1rem 2rem;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    animation: slideIn 0.3s forwards;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.fade-in { animation: fadeIn 0.5s forwards; }
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.mt-large { margin-top: 2rem; }
