:root {
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --secondary: #475569;
    --secondary-hover: #334155;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #eab308;
    --border: rgba(255, 255, 255, 0.1);
}

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

body {
    background: var(--bg-color);
    background-image:
        radial-gradient(at 0% 0%, hsla(253,16%,7%,1) 0, transparent 50%),
        radial-gradient(at 50% 0%, hsla(225,39%,30%,0.3) 0, transparent 50%),
        radial-gradient(at 100% 0%, hsla(339,49%,30%,0.3) 0, transparent 50%);
    background-attachment: fixed;
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 40px 20px;
}

.container {
    width: 100%;
    max-width: 520px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    animation: fadeUp 0.6s ease-out;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 4px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo svg { color: var(--primary); }

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

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-email {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.btn-logout {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}
.btn-logout:hover {
    color: var(--danger);
    border-color: var(--danger);
}

/* Cards */
.card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 28px;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}

.card h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.card p {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 20px;
    line-height: 1.5;
}

/* Forms */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

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

input {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    width: 100%;
}

input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.btn {
    width: 100%;
    padding: 12px 20px;
    border-radius: 8px;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    display: flex;
    justify-content: center;
    align-items: center;
}

.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn.primary {
    background-color: var(--primary);
    color: white;
}
.btn.primary:hover:not(:disabled) { background-color: var(--primary-hover); }

.btn.secondary {
    background-color: var(--secondary);
    color: white;
    margin-top: 8px;
}
.btn.secondary:hover:not(:disabled) { background-color: var(--secondary-hover); }

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

/* Auth toggle */
.auth-toggle {
    text-align: center;
    margin-top: 16px;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.auth-toggle a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
}
.auth-toggle a:hover { text-decoration: underline; }

/* Error messages */
.error-msg {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-bottom: 16px;
    display: none;
}

.success-msg {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--success);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-bottom: 16px;
    display: none;
}

/* Tier badges */
.tier-badge {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    width: fit-content;
}
.tier-badge.free { background: rgba(100,100,100,0.3); color: var(--text-muted); }
.tier-badge.premium { background: rgba(234, 179, 8, 0.2); color: var(--warning); }

/* Info items */
.info-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.info-item .label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.info-item .value {
    font-size: 0.9rem;
    font-weight: 500;
}

/* Device list */
.device-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.device-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid var(--border);
}

.device-item .device-name {
    font-weight: 500;
    font-size: 0.9rem;
}

.device-item .device-token {
    font-family: monospace;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.device-item .device-seen {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: right;
}

.empty-state {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Pair form */
.pair-form {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.pair-form input {
    flex: 1;
    font-family: monospace;
    font-size: 0.8rem;
}

.pair-form .btn {
    width: auto;
    padding: 12px 20px;
    white-space: nowrap;
}

/* Views */
.view { display: none; }
.view.active { display: flex; flex-direction: column; gap: 24px; }

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

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

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