:root {
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --danger-color: #ef4444;
    --danger-hover: #dc2626;
    --secondary-bg: #374151;
    --border-color: #333;
    --accent-color: #10b981;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    display: flex;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

h1 { font-size: 1.5rem; font-weight: 700; }
h2 { font-size: 1rem; color: var(--text-secondary); margin-bottom: 15px; }

.secure-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--accent-color);
    background: rgba(16, 185, 129, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
}

.secure-badge svg { width: 14px; height: 14px; }

.card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
}

/* Input Section */
.input-group textarea {
    width: 100%;
    background: #111;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 8px;
    padding: 12px;
    font-family: monospace;
    font-size: 1rem;
    resize: none;
    height: 80px;
    transition: border-color 0.2s;
}

.input-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.error-msg {
    color: var(--danger-color);
    font-size: 0.85rem;
    margin-top: 8px;
    min-height: 20px;
}

.actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.btn {
    border: none;
    padding: 10px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
    font-size: 0.9rem;
}

.btn.primary { background: var(--primary-color); color: white; flex: 2; }
.btn.primary:hover { background: var(--primary-hover); }
.btn.primary:disabled { background: #333; color: #666; cursor: not-allowed; }

.btn.secondary { background: var(--secondary-bg); color: white; }
.btn.secondary:hover { background: #4b5563; }

.btn.danger { background: rgba(239, 68, 68, 0.2); color: var(--danger-color); }
.btn.danger:hover { background: rgba(239, 68, 68, 0.3); }

.warning {
    margin-top: 20px;
    background: rgba(234, 179, 8, 0.1);
    color: #fbbf24;
    padding: 12px;
    border-radius: 8px;
    display: flex;
    gap: 10px;
    align-items: center;
    font-size: 0.85rem;
}

.warning svg { min-width: 20px; width: 20px; }

/* Output Section */
.totp-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.timer {
    font-variant-numeric: tabular-nums;
    font-weight: bold;
    color: var(--text-secondary);
}

.totp-display {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 15px 0;
    background: #000;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.code-box {
    flex: 1;
    text-align: center;
    font-family: monospace;
    font-size: 2.5rem;
    letter-spacing: 4px;
    font-weight: 700;
    color: var(--primary-color);
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover { background: rgba(255,255,255,0.1); color: white; }
.icon-btn svg { width: 24px; height: 24px; }

.progress-container {
    height: 4px;
    background: #333;
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--primary-color);
    width: 100%;
    transition: width 1s linear;
}

footer {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: auto;
}

footer a { color: var(--text-secondary); text-decoration: underline; }
.disclaimer { margin-top: 5px; opacity: 0.7; }

.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--accent-color);
    color: #000;
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: bold;
    opacity: 0;
    transition: transform 0.3s, opacity 0.3s;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Animations */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.code-box.refreshing {
    animation: pulse 1s infinite;
}