@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

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

:root {
    --bg-primary: #0a0a12;
    --bg-secondary: #12121f;
    --bg-card: #1a1a2e;
    --bg-card-hover: #1f1f35;
    --purple-50: #f3e8ff;
    --purple-100: #e9d5ff;
    --purple-200: #d8b4fe;
    --purple-300: #c084fc;
    --purple-400: #a855f7;
    --purple-500: #9333ea;
    --purple-600: #7c3aed;
    --purple-700: #6d28d9;
    --purple-800: #5b21b6;
    --purple-900: #4c1d95;
    --text-primary: #f1f1f6;
    --text-secondary: #a0a0b8;
    --text-muted: #6b6b82;
    --border: #2a2a40;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --glow: rgba(147, 51, 234, 0.3);
    --glow-strong: rgba(147, 51, 234, 0.5);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* animated bg */
.bg-grid {
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(147, 51, 234, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(147, 51, 234, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
    z-index: 0;
}

.bg-glow {
    position: fixed;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(147, 51, 234, 0.08), transparent 70%);
    top: -200px;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: none;
    z-index: 0;
    animation: pulse-glow 4s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { opacity: 0.6; transform: translateX(-50%) scale(1); }
    50% { opacity: 1; transform: translateX(-50%) scale(1.1); }
}

/* login screen */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    position: relative;
    z-index: 1;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    text-align: center;
    backdrop-filter: blur(20px);
    box-shadow: 0 0 60px rgba(147, 51, 234, 0.1);
}

.logo {
    font-size: 42px;
    font-weight: 900;
    background: linear-gradient(135deg, var(--purple-400), var(--purple-600));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -1px;
    margin-bottom: 4px;
}

.logo-sub {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-bottom: 36px;
}

.input-group {
    margin-bottom: 20px;
    text-align: left;
}

.input-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.input-group input {
    width: 100%;
    padding: 14px 18px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 15px;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-group input:focus {
    border-color: var(--purple-500);
    box-shadow: 0 0 0 3px var(--glow);
}

.input-group input::placeholder {
    color: var(--text-muted);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    border: none;
    border-radius: 12px;
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    width: 100%;
    background: linear-gradient(135deg, var(--purple-600), var(--purple-800));
    color: white;
    box-shadow: 0 4px 20px var(--glow);
}

.btn-primary:hover {
    box-shadow: 0 4px 30px var(--glow-strong);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.error-msg {
    color: var(--error);
    font-size: 13px;
    margin-top: 12px;
    display: none;
}

.error-msg.show {
    display: block;
}

/* dashboard */
.dashboard {
    display: none;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

.dash-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    background: rgba(10, 10, 18, 0.8);
    backdrop-filter: blur(20px);
    position: sticky;
    top: 0;
    z-index: 10;
}

.dash-logo {
    font-size: 22px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--purple-400), var(--purple-600));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 13px;
    color: var(--text-secondary);
}

.user-badge .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
}

.btn-logout {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
}

.btn-logout:hover {
    border-color: var(--error);
    color: var(--error);
}

.dash-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 24px;
}

.welcome-section {
    text-align: center;
    margin-bottom: 48px;
}

.welcome-section h1 {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 8px;
}

.welcome-section h1 span {
    background: linear-gradient(135deg, var(--purple-400), var(--purple-600));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.welcome-section p {
    color: var(--text-secondary);
    font-size: 15px;
}

.expiry-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 20px;
    background: linear-gradient(135deg, rgba(147, 51, 234, 0.1), rgba(109, 40, 217, 0.1));
    border: 1px solid rgba(147, 51, 234, 0.2);
    border-radius: 12px;
    margin-bottom: 40px;
    font-size: 14px;
}

.expiry-banner .icon {
    font-size: 18px;
}

.expiry-banner .time {
    color: var(--purple-300);
    font-weight: 600;
}

.expired-banner {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(220, 38, 38, 0.1));
    border-color: rgba(239, 68, 68, 0.2);
}

.expired-banner .time {
    color: var(--error);
}

/* server cards */
.server-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 40px;
}

@media (max-width: 600px) {
    .server-grid {
        grid-template-columns: 1fr;
    }
    .login-card {
        padding: 36px 24px;
    }
    .dash-content {
        padding: 24px 16px;
    }
}

.server-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 32px 24px;
    text-align: center;
    transition: all 0.3s;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.server-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent, rgba(147, 51, 234, 0.05));
    opacity: 0;
    transition: opacity 0.3s;
}

.server-card:hover {
    border-color: var(--purple-500);
    box-shadow: 0 0 40px var(--glow);
    transform: translateY(-2px);
}

.server-card:hover::before {
    opacity: 1;
}

.server-card.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.server-flag {
    font-size: 48px;
    margin-bottom: 16px;
    position: relative;
    z-index: 1;
}

.server-name {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 6px;
    position: relative;
    z-index: 1;
}

.server-desc {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
}

.server-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: var(--success);
    position: relative;
    z-index: 1;
}

.server-status .pulse {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success);
    animation: status-pulse 2s ease-in-out infinite;
}

@keyframes status-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.connect-btn {
    display: block;
    width: 100%;
    margin-top: 16px;
    padding: 12px;
    background: linear-gradient(135deg, var(--purple-600), var(--purple-800));
    border: none;
    border-radius: 10px;
    color: white;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    z-index: 1;
}

.connect-btn:hover {
    box-shadow: 0 4px 20px var(--glow);
}

/* info section */
.info-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
}

.info-section h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--purple-300);
}

.info-list {
    list-style: none;
}

.info-list li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    color: var(--text-secondary);
}

.info-list li:last-child {
    border-bottom: none;
}

.info-list .num {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    background: var(--purple-900);
    color: var(--purple-300);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
}

/* toast */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 14px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 14px;
    color: var(--text-primary);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    z-index: 100;
    transition: transform 0.3s ease;
    white-space: nowrap;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

.toast.error {
    border-color: rgba(239, 68, 68, 0.3);
}

.toast.success {
    border-color: rgba(16, 185, 129, 0.3);
}

/* spinner */
.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* modal */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 50;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 32px;
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.modal h3 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 12px;
}

.modal p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 24px;
    line-height: 1.6;
}

.modal-copied {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 8px;
    color: var(--success);
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 20px;
}

.modal-copied::before {
    content: '\2713';
}

.modal-actions-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.modal-btn-full {
    width: 100%;
    justify-content: center;
}

.modal-hint {
    margin-top: 16px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.modal-actions {
    display: flex;
    gap: 12px;
}

.modal-actions .btn {
    flex: 1;
}

.btn-secondary {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-primary);
}

.btn-secondary:hover {
    border-color: var(--text-muted);
}
