/* ============================================
   VPS Proxy — Dark Premium Theme
   ============================================ */

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: rgba(20, 20, 30, 0.8);
    --bg-input: rgba(255, 255, 255, 0.04);
    --border: rgba(255, 255, 255, 0.08);
    --border-focus: rgba(99, 102, 241, 0.5);
    --text-primary: #e4e4e7;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --accent-glow: rgba(99, 102, 241, 0.25);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.1);
    --success: #22c55e;
    --info: rgba(99, 102, 241, 0.15);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

/* ---- Flash Messages ---- */
.flash-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.flash {
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    backdrop-filter: blur(16px);
    animation: slideIn 0.3s var(--transition);
    border: 1px solid var(--border);
}

.flash-error {
    background: var(--danger-bg);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.2);
}

.flash-info {
    background: var(--info);
    color: var(--accent-hover);
    border-color: rgba(99, 102, 241, 0.2);
}

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

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ============================================
   LOGIN PAGE
   ============================================ */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(99, 102, 241, 0.08) 0%, transparent 60%),
        var(--bg-primary);
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    backdrop-filter: blur(24px);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.03),
        0 20px 60px rgba(0, 0, 0, 0.5);
    animation: fadeUp 0.5s ease-out;
}

@keyframes fadeUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    color: white;
    margin-bottom: 1rem;
    box-shadow: 0 8px 24px var(--accent-glow);
}

.login-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.25rem;
}

.login-subtitle {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.input-group label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.input-group input {
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9375rem;
    font-family: inherit;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}

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

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

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    color: white;
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition);
    margin-top: 0.25rem;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px var(--accent-glow);
}

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

/* ============================================
   DASHBOARD
   ============================================ */
.dashboard-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(99, 102, 241, 0.06) 0%, transparent 50%),
        var(--bg-primary);
}

.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.header-icon {
    color: var(--accent);
}

.header-left h1 {
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.btn-logout {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.875rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition);
    cursor: pointer;
}

.btn-logout:hover {
    border-color: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    background: var(--danger-bg);
}

/* ---- Header Actions ---- */
.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ---- VPN Dropdown ---- */
.vpn-dropdown {
    position: relative;
}

.btn-vpn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.875rem;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.25);
    border-radius: var(--radius-sm);
    color: #86efac;
    font-size: 0.8125rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-vpn:hover {
    background: rgba(34, 197, 94, 0.18);
    border-color: rgba(34, 197, 94, 0.4);
}

.vpn-panel {
    display: none;
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    width: 420px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    z-index: 1000;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: fadeUp 0.2s ease-out;
}

.vpn-panel.open {
    display: block;
}

.vpn-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.vpn-panel-header h3 {
    font-size: 0.9375rem;
    font-weight: 600;
}

.vpn-badge {
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
    background: rgba(34, 197, 94, 0.12);
    color: #86efac;
    border: 1px solid rgba(34, 197, 94, 0.2);
    border-radius: 100px;
    font-weight: 500;
}

.vpn-instruction {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.vpn-instruction a {
    color: var(--accent-hover);
    text-decoration: none;
}

.vpn-instruction a:hover {
    text-decoration: underline;
}

.vpn-config-block {
    position: relative;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 0.75rem;
}

.vpn-config-block pre {
    padding: 0.875rem;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.75rem;
    line-height: 1.6;
    color: var(--text-primary);
    overflow-x: auto;
    white-space: pre;
    margin: 0;
}

.btn-copy {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.3rem 0.6rem;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: 6px;
    color: var(--accent-hover);
    font-size: 0.6875rem;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-copy:hover {
    background: rgba(99, 102, 241, 0.25);
}

.vpn-note {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.vpn-note code {
    background: rgba(99, 102, 241, 0.12);
    color: var(--accent-hover);
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    font-size: 0.6875rem;
}

/* ---- URL Bar ---- */
.url-bar-container {
    padding: 1rem 1.5rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.url-form {
    max-width: 960px;
    margin: 0 auto;
}

.url-input-wrapper {
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.url-input-wrapper:focus-within {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.url-icon {
    margin-left: 1rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

#url-input {
    flex: 1;
    padding: 0.75rem 0.75rem;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.9375rem;
    font-family: inherit;
}

#url-input::placeholder {
    color: var(--text-muted);
}

.btn-go {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    border: none;
    color: white;
    cursor: pointer;
    transition: opacity var(--transition);
}

.btn-go:hover {
    opacity: 0.85;
}

/* ---- Error ---- */
.proxy-error {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--danger-bg);
    color: #fca5a5;
    font-size: 0.875rem;
    border-bottom: 1px solid rgba(239, 68, 68, 0.15);
}

/* ---- Viewport ---- */
.proxy-viewport {
    flex: 1;
    display: flex;
    position: relative;
}

.proxy-viewport iframe {
    width: 100%;
    height: 100%;
    border: none;
    position: absolute;
    inset: 0;
    background: white;
}

.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    color: var(--text-muted);
    padding: 4rem 2rem;
}

.empty-state svg {
    opacity: 0.3;
}

.empty-state p {
    font-size: 0.9375rem;
}