/* ============== BASE ============== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #0A0E1A;
    --bg-card: #111827;
    --bg-elevated: #1E293B;
    --border: #1E293B;
    --border-light: #334155;
    --text: #F8FAFC;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    --text-dim: #475569;
    --red: #DC2626;
    --red-light: #EF4444;
    --red-dark: #991B1B;
    --red-glow: rgba(220, 38, 38, 0.3);
    --green: #10B981;
    --blue: #3B82F6;
    --radius: 16px;
    --radius-sm: 10px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

a {
    color: var(--red-light);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ============== BUTTONS ============== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    font-family: inherit;
    text-decoration: none;
}

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

.btn-primary:hover {
    background: var(--red-light);
    transform: translateY(-1px);
    box-shadow: 0 4px 20px var(--red-glow);
}

.btn-outline {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border-light);
}

.btn-outline:hover {
    border-color: var(--text-muted);
    background: rgba(255, 255, 255, 0.03);
}

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

.btn-danger:hover {
    background: var(--red);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

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

/* ============== PIN GATE ============== */
.pin-gate {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.pin-container {
    text-align: center;
}

.pin-logo {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    border-radius: 16px;
}

.pin-container h1 {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 8px;
}

.pin-container p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 32px;
}

.pin-dots {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 16px;
}

.pin-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid var(--border-light);
    background: transparent;
    transition: var(--transition);
}

.pin-dot.filled {
    background: var(--red);
    border-color: var(--red);
}

.pin-dot.shake {
    animation: shake 0.4s ease;
}

.pin-error {
    color: var(--red-light);
    font-size: 13px;
    font-weight: 600;
    min-height: 20px;
    margin-bottom: 8px;
}

.pin-pad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    max-width: 280px;
    margin: 20px auto 0;
}

.pin-key {
    width: 80px;
    height: 64px;
    border-radius: 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 24px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.pin-key:hover {
    background: var(--border-light);
}

.pin-key:active {
    transform: scale(0.95);
}

.pin-key-empty {
    background: transparent;
    border: none;
    cursor: default;
}

.pin-key-empty:hover {
    background: transparent;
}

.pin-key-delete {
    font-size: 20px;
}

.pin-cancel-btn {
    position: absolute;
    top: 24px;
    left: 24px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 15px;
    cursor: pointer;
    font-family: inherit;
}

/* Paywall form */
.paywall-form {
    max-width: 340px;
    margin: 0 auto;
}

.paywall-form .form-group {
    margin-bottom: 12px;
}

.paywall-form .form-group input {
    text-align: center;
    font-size: 16px;
    padding: 14px 20px;
    width: 100%;
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text);
    font-family: inherit;
    transition: var(--transition);
}

.paywall-form .form-group input:focus {
    outline: none;
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.paywall-form .form-group input::placeholder {
    color: var(--text-dim);
}

.paywall-form .btn {
    margin-top: 8px;
}

.paywall-signup {
    margin-top: 20px;
    font-size: 13px;
    color: var(--text-dim);
}

.paywall-signup a {
    color: var(--red-light);
    font-weight: 600;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-8px);
    }

    75% {
        transform: translateX(8px);
    }
}

/* ============== APP HEADER ============== */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 32px;
    border-bottom: 1px solid var(--border);
    background: rgba(10, 14, 26, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.app-logo {
    width: 32px;
    height: 32px;
    border-radius: 8px;
}

.app-title {
    font-size: 17px;
    font-weight: 800;
}

.app-nav {
    display: flex;
    gap: 4px;
}

.tab-btn {
    padding: 8px 20px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.tab-btn:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.03);
}

.tab-btn.active {
    color: var(--text);
    background: var(--bg-elevated);
}

/* ============== TAB CONTENT ============== */
.tab-content {
    display: none;
    padding: 32px;
    max-width: 1200px;
    margin: 0 auto;
}

.tab-content.active {
    display: block;
}

/* ============== DASHBOARD LAYOUT ============== */
.dashboard-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 32px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.panel-header h2 {
    font-size: 22px;
    font-weight: 800;
}

.key-count {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

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

/* ============== KEY CARDS ============== */
.keys-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.key-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition);
}

.key-card:hover {
    border-color: var(--border-light);
}

.key-card-left {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
}

.key-card-icon {
    font-size: 28px;
}

.key-card-name {
    font-size: 15px;
    font-weight: 700;
}

.key-card-provider {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.key-card-masked {
    font-size: 12px;
    color: var(--text-dim);
    font-family: 'JetBrains Mono', monospace;
    margin-top: 3px;
}

.key-card-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.status-active {
    background: var(--green);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

.status-revoked {
    background: var(--red-light);
}

.key-kill-btn {
    padding: 6px 14px;
    border-radius: 8px;
    background: var(--red-dark);
    border: none;
    color: white;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    opacity: 0;
}

.key-card:hover .key-kill-btn {
    opacity: 1;
}

.key-kill-btn:hover {
    background: var(--red);
}

.result-badge {
    text-align: center;
}

.result-badge-icon {
    font-size: 20px;
}

.result-badge-text {
    font-size: 10px;
    font-weight: 700;
    margin-top: 2px;
}

/* ============== KILL PANEL ============== */
.kill-panel {
    position: sticky;
    top: 100px;
}

.kill-card {
    background: var(--bg-card);
    border: 1px solid var(--red-dark);
    border-radius: var(--radius);
    padding: 40px 24px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.kill-glow {
    position: absolute;
    top: -50px;
    left: 50%;
    transform: translateX(-50%);
    width: 300px;
    height: 200px;
    background: radial-gradient(circle, var(--red-glow) 0%, transparent 70%);
    filter: blur(40px);
    pointer-events: none;
}

.kill-button {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: var(--red);
    border: none;
    color: white;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    position: relative;
    z-index: 1;
    box-shadow: 0 8px 40px var(--red-glow);
    animation: pulse-btn 3s ease-in-out infinite;
}

.kill-button:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 12px 50px rgba(220, 38, 38, 0.5);
}

.kill-button:active:not(:disabled) {
    transform: scale(0.95);
}

.kill-button:disabled {
    background: var(--border-light);
    box-shadow: none;
    cursor: not-allowed;
    animation: none;
}

.kill-button.killing {
    background: var(--red-dark);
    animation: none;
}

.kill-icon {
    font-size: 36px;
    margin-bottom: 4px;
}

.kill-text {
    font-size: 14px;
    font-weight: 900;
    letter-spacing: 1px;
}

.kill-hint {
    font-size: 12px;
    color: var(--text-dim);
}

@keyframes pulse-btn {

    0%,
    100% {
        box-shadow: 0 8px 40px var(--red-glow);
    }

    50% {
        box-shadow: 0 8px 60px rgba(220, 38, 38, 0.5);
    }
}

.kill-results {
    margin-top: 20px;
    text-align: left;
}

.kill-result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.kill-result-item:last-child {
    border-bottom: none;
}

/* ============== EMPTY STATE ============== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-icon {
    font-size: 56px;
    display: block;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* ============== AUDIT LOG ============== */
.audit-log {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.log-entry {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.log-entry-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.log-entry-icon {
    font-size: 20px;
}

.log-entry-name {
    font-size: 14px;
    font-weight: 600;
}

.log-entry-time {
    font-size: 11px;
    color: var(--text-dim);
    margin-top: 2px;
}

.log-entry-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.log-entry-result {
    font-size: 16px;
}

.log-entry-action {
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* ============== SETTINGS ============== */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    max-width: 800px;
}

.settings-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}

.settings-card h3 {
    font-size: 16px;
    font-weight: 800;
    margin-bottom: 16px;
}

.settings-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    color: var(--text-secondary);
}

.settings-row:last-of-type {
    border-bottom: none;
    margin-bottom: 16px;
}

.badge {
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
}

.badge-green {
    background: rgba(16, 185, 129, 0.15);
    color: var(--green);
}

.badge-red {
    background: rgba(220, 38, 38, 0.15);
    color: var(--red-light);
}

/* ============== MODAL ============== */
.modal {
    position: fixed;
    inset: 0;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
}

.modal-content {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 32px;
    max-width: 560px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-sm {
    max-width: 420px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 800;
}

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--bg-elevated);
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--text);
}

/* ============== PROVIDER GRID ============== */
.provider-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.provider-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.provider-card:hover {
    border-color: var(--border-light);
    transform: translateY(-2px);
}

.provider-card-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.provider-card-name {
    font-size: 13px;
    font-weight: 700;
}

.selected-provider {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
}

.selected-provider-icon {
    font-size: 24px;
}

.selected-provider-name {
    font-weight: 700;
}

/* ============== FORMS ============== */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

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

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

/* ============== CONFIRM KILL ============== */
.confirm-kill-content {
    text-align: center;
}

.confirm-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 16px;
}

.confirm-kill-content h2 {
    margin-bottom: 8px;
}

.confirm-kill-content p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 24px;
}

.confirm-kill-content .form-actions {
    justify-content: center;
}

/* ============== RESPONSIVE ============== */
@media (max-width: 900px) {
    .dashboard-layout {
        grid-template-columns: 1fr;
    }

    .kill-panel {
        position: static;
    }

    .settings-grid {
        grid-template-columns: 1fr;
    }

    .provider-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .app-header {
        padding: 12px 16px;
        flex-direction: column;
        gap: 12px;
    }

    .tab-content {
        padding: 20px;
    }
}