/* ==========================================
   2FA Authenticator - Design System
   ========================================== */

/* -- CSS Variables & Design Tokens -- */
:root {
    --bg-primary: #f0f4f8;
    --bg-secondary: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.7);
    --bg-card-hover: rgba(255, 255, 255, 0.85);
    --bg-glass: rgba(59, 130, 246, 0.05);
    --bg-input: rgba(59, 130, 246, 0.04);

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-code: #1e293b;

    --accent-primary: #3b82f6;
    --accent-primary-hover: #1d4ed8;
    --accent-glow: rgba(59, 130, 246, 0.15);
    --accent-gradient: linear-gradient(135deg, #3b82f6, #1d4ed8, #00d2ff);
    --accent-gradient-btn: linear-gradient(135deg, #3b82f6, #1d4ed8);

    --success: #10b981;
    --success-glow: rgba(16, 185, 129, 0.12);
    --warning: #f59e0b;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --danger-glow: rgba(239, 68, 68, 0.12);

    --border-subtle: rgba(59, 130, 246, 0.1);
    --border-input: rgba(59, 130, 246, 0.15);
    --border-focus: rgba(37, 99, 235, 0.4);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    --shadow-sm: 0 2px 8px rgba(59, 130, 246, 0.04);
    --shadow-md: 0 8px 24px rgba(59, 130, 246, 0.08);
    --shadow-lg: 0 16px 40px rgba(59, 130, 246, 0.12);
    --shadow-glow: 0 0 20px var(--accent-glow);

    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);

    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

/* -- Reset & Base -- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hidden {
    display: none !important;
}

/* -- Background Animation -- */
.bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.bg-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.22;
    animation: float 20s ease-in-out infinite;
}

.bg-orb-1 {
    width: 600px;
    height: 600px;
    background: var(--accent-primary);
    top: -200px;
    right: -100px;
    animation-delay: 0s;
}

.bg-orb-2 {
    width: 500px;
    height: 500px;
    background: #60a5fa;
    bottom: -150px;
    left: -100px;
    animation-delay: -7s;
}

.bg-orb-3 {
    width: 400px;
    height: 400px;
    background: #00d2ff;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -14s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(30px, -40px) scale(1.05); }
    50% { transform: translate(-20px, 20px) scale(0.95); }
    75% { transform: translate(40px, 30px) scale(1.02); }
}

/* -- App Container -- */
.app-container {
    position: relative;
    z-index: 1;
    max-width: 560px;
    width: 100%;
    margin: 0 auto;
    padding: 24px 16px 40px;
}

/* -- Header -- */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 0 32px;
    gap: 16px;
}

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

.logo-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: var(--shadow-glow);
    flex-shrink: 0;
}

.logo-text h1 {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.tagline {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 400;
    margin-top: 2px;
}

.security-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--success-glow);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    color: var(--success);
    font-weight: 500;
    white-space: nowrap;
}

/* -- Quick Get 2FA Section -- */
.quick-get-section {
    margin-bottom: 28px;
}

.quick-get-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.85) 0%, rgba(240, 246, 255, 0.75) 100%);
    border: 1.5px solid rgba(59, 130, 246, 0.2);
    border-radius: var(--radius-xl);
    padding: 24px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(59, 130, 246, 0.08), 0 1px 3px rgba(59, 130, 246, 0.04);
    transition: all var(--transition-base);
}

.quick-get-card:hover {
    box-shadow: 0 16px 40px rgba(59, 130, 246, 0.15), 0 2px 8px rgba(59, 130, 246, 0.06);
    transform: translateY(-2px);
    border-color: rgba(59, 130, 246, 0.35);
}

.quick-get-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #3b82f6, #1d4ed8, #00d2ff, #10b981);
    background-size: 300% 100%;
    animation: shimmerBar 4s ease-in-out infinite;
}

@keyframes shimmerBar {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.quick-get-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}

.quick-get-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, #3b82f6, #00d2ff);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 0 16px rgba(59, 130, 246, 0.25);
}

.quick-get-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.quick-get-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.quick-get-input-row {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.quick-get-input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.quick-get-input-icon {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    pointer-events: none;
    z-index: 1;
}

.quick-get-input-wrapper input {
    width: 100%;
    padding: 13px 40px 13px 40px;
    background: var(--bg-input);
    border: 1.5px solid var(--border-input);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    outline: none;
    transition: all var(--transition-fast);
}

.quick-get-input-wrapper input::placeholder {
    color: var(--text-muted);
    text-transform: none;
    font-family: var(--font-sans);
    letter-spacing: normal;
}

.quick-get-input-wrapper input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
    background: #ffffff;
}

.quick-get-clear-btn {
    position: absolute;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    z-index: 1;
}

.quick-get-clear-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.quick-get-clear-btn.hidden {
    display: none;
}

.btn-quick-get {
    padding: 13px 20px;
    background: linear-gradient(135deg, #f59e0b, #f97316);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    transition: all var(--transition-fast);
    box-shadow: 0 2px 10px rgba(245, 158, 11, 0.25);
}

.btn-quick-get:hover {
    box-shadow: 0 4px 20px rgba(245, 158, 11, 0.35);
    transform: translateY(-1px);
}

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

/* -- Quick Get Result -- */
.quick-get-result {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    animation: resultSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.quick-get-result.hidden {
    display: none;
}

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

.quick-result-code-section {
    flex: 1;
}

.quick-result-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 500;
    margin-bottom: 8px;
}

.quick-result-code {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: all var(--transition-fast);
    padding: 4px 0;
}

.quick-result-code:hover {
    opacity: 0.85;
}

.quick-result-code .otp-digit {
    width: 40px;
    height: 48px;
    font-size: 1.5rem;
    background: rgba(59, 130, 246, 0.06);
    border-color: rgba(59, 130, 246, 0.15);
}

.quick-result-code:hover .otp-digit {
    background: rgba(59, 130, 246, 0.12);
    border-color: rgba(59, 130, 246, 0.25);
}

.quick-result-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.quick-copy-btn,
.quick-save-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    border: 1.5px solid transparent;
}

.quick-copy-btn span,
.quick-save-btn span {
    font-family: var(--font-sans);
}

.quick-copy-btn {
    background: rgba(59, 130, 246, 0.06);
    border-color: rgba(59, 130, 246, 0.15);
    color: var(--accent-primary);
}

.quick-copy-btn:hover {
    background: var(--accent-gradient-btn);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
    transform: translateY(-1px);
}

.quick-save-btn {
    background: rgba(16, 185, 129, 0.06);
    border-color: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.quick-save-btn:hover {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
    transform: translateY(-1px);
}

.quick-copy-btn:active,
.quick-save-btn:active {
    transform: translateY(0);
}

.quick-result-timer {
    flex-shrink: 0;
}

/* -- Quick Get Error -- */
.quick-get-error {
    margin-top: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--danger-glow);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-sm);
    color: var(--danger);
    font-size: 0.8rem;
    font-weight: 500;
    animation: shakeIn 0.4s ease;
}

.quick-get-error.hidden {
    display: none;
}

@keyframes shakeIn {
    0% { transform: translateX(-8px); opacity: 0; }
    25% { transform: translateX(6px); }
    50% { transform: translateX(-4px); }
    75% { transform: translateX(2px); }
    100% { transform: translateX(0); opacity: 1; }
}

/* -- Quick Save Inline -- */
.quick-save-inline {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 12px;
    animation: resultSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.quick-save-inline.hidden {
    display: none;
}

#quickSaveNameInput {
    flex: 1;
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1.5px solid var(--border-input);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.85rem;
    outline: none;
    transition: all var(--transition-fast);
}

#quickSaveNameInput:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
    background: #ffffff;
}

.quick-save-inline-actions {
    display: flex;
    gap: 6px;
}

.btn-save-inline-cancel,
.btn-save-inline-confirm {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.btn-save-inline-cancel {
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

.btn-save-inline-cancel:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
}

.btn-save-inline-confirm {
    background: var(--accent-gradient-btn);
    color: white;
    box-shadow: 0 2px 8px var(--accent-glow);
}

.btn-save-inline-confirm:hover {
    box-shadow: 0 4px 16px var(--accent-glow);
    transform: translateY(-1px);
}

.btn-save-inline-confirm:active {
    transform: translateY(0);
}

/* -- Section Divider -- */
.section-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.divider-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-subtle), transparent);
}

.divider-text {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
    white-space: nowrap;
}

/* -- Add Key Section -- */
.add-key-section {
    margin-bottom: 24px;
}

.btn-add-toggle {
    width: 100%;
    padding: 14px 20px;
    background: rgba(59, 130, 246, 0.04);
    border: 1.5px dashed rgba(59, 130, 246, 0.35);
    border-radius: var(--radius-lg);
    color: var(--accent-primary-hover);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all var(--transition-base);
}

.btn-add-toggle:hover {
    background: rgba(59, 130, 246, 0.08);
    border-color: rgba(59, 130, 246, 0.6);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.12);
    transform: translateY(-2px);
}

.btn-add-toggle.hidden {
    display: none;
}

/* -- Add Form -- */
.add-form-wrapper {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.3s ease;
    opacity: 0;
}

.add-form-wrapper.open {
    max-height: 400px;
    opacity: 1;
}

.add-form {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.85) 0%, rgba(240, 246, 255, 0.75) 100%);
    border: 1.5px solid rgba(59, 130, 246, 0.2);
    border-radius: var(--radius-lg);
    padding: 24px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 10px 30px rgba(59, 130, 246, 0.08), 0 1px 3px rgba(59, 130, 246, 0.04);
    transition: all var(--transition-base);
}

.add-form:hover {
    box-shadow: 0 16px 40px rgba(59, 130, 246, 0.15), 0 2px 8px rgba(59, 130, 246, 0.06);
    border-color: rgba(59, 130, 246, 0.35);
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1.5px solid var(--border-input);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    transition: all var(--transition-fast);
    outline: none;
}

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

.form-group input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
    background: #ffffff;
}

#secretKey {
    font-family: var(--font-mono);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

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

/* -- Buttons -- */
.btn {
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all var(--transition-fast);
}

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

.btn-cancel:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.btn-submit {
    background: var(--accent-gradient-btn);
    color: white;
    box-shadow: 0 2px 8px var(--accent-glow);
}

.btn-submit:hover {
    box-shadow: 0 4px 16px var(--accent-glow);
    transform: translateY(-1px);
}

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

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

/* -- OTP List -- */
.otp-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* -- OTP Card -- */
.otp-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 20px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transition: all var(--transition-base);
    animation: cardIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
    position: relative;
    overflow: hidden;
}

.otp-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent-gradient);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.otp-card:hover {
    background: var(--bg-card-hover);
    border-color: rgba(99, 102, 241, 0.15);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

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

@keyframes cardIn {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.otp-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.otp-account-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.otp-account-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: white;
    flex-shrink: 0;
    text-transform: uppercase;
}

.otp-account-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.otp-card-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.btn-icon:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
}

.btn-icon.btn-icon-danger:hover {
    background: var(--danger-glow);
    color: var(--danger);
}

/* -- OTP Code Display -- */
.otp-code-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.otp-code-display {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    padding: 8px 0;
    transition: all var(--transition-fast);
}

.otp-code-display:hover {
    opacity: 0.85;
}

.otp-digit-group {
    display: flex;
    gap: 4px;
}

.otp-digit {
    width: 36px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(59, 130, 246, 0.06);
    border: 1px solid rgba(59, 130, 246, 0.15);
    border-radius: 8px;
    font-family: var(--font-mono);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-code);
    transition: all var(--transition-fast);
}

.otp-code-display:hover .otp-digit {
    background: rgba(59, 130, 246, 0.12);
    border-color: rgba(59, 130, 246, 0.25);
}

.otp-separator {
    width: 8px;
    height: 3px;
    background: var(--text-muted);
    border-radius: 2px;
    margin: 0 2px;
}

/* -- Timer Ring -- */
.otp-timer-section {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.timer-ring-container {
    position: relative;
    width: 40px;
    height: 40px;
}

.timer-ring {
    width: 40px;
    height: 40px;
    transform: rotate(-90deg);
}

.timer-ring-bg {
    fill: none;
    stroke: rgba(59, 130, 246, 0.1);
    stroke-width: 3;
}

.timer-ring-progress {
    fill: none;
    stroke: var(--accent-primary);
    stroke-width: 3;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s linear, stroke 0.3s ease;
    filter: drop-shadow(0 0 3px var(--accent-glow));
}

.timer-ring-progress.warning {
    stroke: var(--warning);
    filter: drop-shadow(0 0 3px rgba(245, 158, 11, 0.3));
}

.timer-ring-progress.danger {
    stroke: var(--danger);
    filter: drop-shadow(0 0 3px rgba(239, 68, 68, 0.3));
}

.timer-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* -- Empty State -- */
.empty-state {
    text-align: center;
    padding: 32px 20px;
    animation: fadeIn 0.5s ease;
}

.empty-state.hidden {
    display: none;
}

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

.empty-icon {
    color: var(--text-muted);
    margin-bottom: 12px;
    opacity: 0.4;
    animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.4; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.05); }
}

.empty-state h2 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 0.85rem;
    color: var(--text-muted);
    max-width: 320px;
    margin: 0 auto;
    line-height: 1.6;
}

.empty-hint {
    margin-top: 20px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.75rem !important;
    color: var(--success) !important;
    opacity: 0.7;
}

/* -- Footer -- */
.app-footer {
    text-align: center;
    padding: 32px 0 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.footer-contact {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.footer-contact svg {
    color: var(--accent-primary);
}

.contact-link {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 600;
    transition: color var(--transition-fast);
}

.contact-link:hover {
    color: var(--accent-primary-hover);
    text-decoration: underline;
}

.contact-separator {
    color: var(--text-muted);
    opacity: 0.5;
}

.footer-note {
    font-size: 0.72rem;
    color: var(--text-muted);
    opacity: 0.6;
}

/* -- Modal -- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
    padding: 16px;
}

.modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 32px;
    max-width: 380px;
    width: 100%;
    text-align: center;
    transform: scale(0.9) translateY(20px);
    transition: transform var(--transition-slow);
    box-shadow: var(--shadow-lg);
}

.modal-overlay.open .modal-content {
    transform: scale(1) translateY(0);
}

.modal-icon {
    color: var(--warning);
    margin-bottom: 16px;
}

.modal-content h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.modal-content p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 24px;
    line-height: 1.5;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.modal-actions .btn {
    flex: 1;
    justify-content: center;
}

/* -- Toast -- */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    padding: 10px 20px;
    font-size: 0.82rem;
    color: var(--text-primary);
    z-index: 200;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
    white-space: nowrap;
}

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

/* -- Copied animation -- */
.copied-flash .otp-digit {
    animation: copiedFlash 0.5s ease;
}

@keyframes copiedFlash {
    0% { background: rgba(59, 130, 246, 0.06); }
    40% { background: rgba(16, 185, 129, 0.25); border-color: rgba(16, 185, 129, 0.4); }
    100% { background: rgba(59, 130, 246, 0.06); }
}

/* -- Scrollbar -- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.12);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
}

/* -- Responsive & Adaptive Design -- */

/* === Fluid Typography === */
html {
    font-size: clamp(14px, 3.5vw, 16px);
}

/* === Touch Device Optimizations === */
@media (pointer: coarse) {
    /* Enlarge all touch targets to 44x44px minimum */
    .btn-icon {
        width: 44px;
        height: 44px;
    }

    .btn {
        padding: 12px 22px;
        min-height: 44px;
    }

    .btn-add-toggle {
        padding: 16px 20px;
        min-height: 48px;
    }

    .btn-quick-get {
        padding: 14px 22px;
        min-height: 48px;
    }

    .quick-get-clear-btn {
        width: 36px;
        height: 36px;
    }

    .quick-copy-btn,
    .quick-save-btn {
        padding: 10px 14px;
        min-height: 44px;
    }

    .otp-card-actions {
        gap: 2px;
    }

    .form-group input,
    .quick-get-input-wrapper input {
        padding: 14px 16px;
        padding-left: 40px;
        font-size: 1rem;
        min-height: 48px;
    }

    /* Active state feedback for touch (no hover) */
    .otp-card:active {
        transform: scale(0.985);
    }

    .btn-icon:active {
        background: rgba(255, 255, 255, 0.12);
    }

    .btn-quick-get:active {
        transform: scale(0.97);
    }

    .btn-submit:active {
        transform: scale(0.97);
    }

    .otp-code-display:active {
        opacity: 0.7;
    }

    .quick-result-code:active {
        opacity: 0.7;
    }
}

/* === Hover states only for pointer devices === */
@media (hover: hover) and (pointer: fine) {
    .otp-card:hover {
        background: var(--bg-card-hover);
        border-color: rgba(99, 102, 241, 0.15);
        box-shadow: var(--shadow-md);
        transform: translateY(-2px);
    }

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

    .btn-submit:hover {
        box-shadow: 0 4px 16px var(--accent-glow);
        transform: translateY(-1px);
    }

    .btn-quick-get:hover {
        box-shadow: 0 4px 20px rgba(245, 158, 11, 0.35);
        transform: translateY(-1px);
    }

    .btn-add-toggle:hover {
        background: rgba(99, 102, 241, 0.08);
        border-color: rgba(99, 102, 241, 0.5);
        box-shadow: var(--shadow-glow);
        transform: translateY(-1px);
    }
}

/* Remove hover transforms on touch-only devices */
@media (hover: none) {
    .otp-card:hover {
        transform: none;
        box-shadow: none;
    }

    .btn-submit:hover,
    .btn-quick-get:hover,
    .btn-add-toggle:hover {
        transform: none;
    }
}

/* === Extra Small Mobile (320px - 374px) === */
@media (max-width: 374px) {
    .app-container {
        padding: 12px 10px 28px;
    }

    .app-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 12px 0 20px;
    }

    .logo-icon {
        width: 40px;
        height: 40px;
    }

    .logo-icon svg {
        width: 24px;
        height: 24px;
    }

    .logo-text h1 {
        font-size: 1.05rem;
    }

    .tagline {
        font-size: 0.7rem;
    }

    .security-badge {
        font-size: 0.65rem;
        padding: 4px 10px;
    }

    /* Quick Get - stack vertically */
    .quick-get-card {
        padding: 16px;
        border-radius: var(--radius-lg);
    }

    .quick-get-icon {
        width: 34px;
        height: 34px;
    }

    .quick-get-icon svg {
        width: 18px;
        height: 18px;
    }

    .quick-get-title {
        font-size: 0.88rem;
    }

    .quick-get-subtitle {
        font-size: 0.68rem;
    }

    .quick-get-input-row {
        flex-direction: column;
        gap: 8px;
    }

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

    /* OTP digits - smaller for tiny screens */
    .otp-digit {
        width: 26px;
        height: 34px;
        font-size: 0.95rem;
        border-radius: 6px;
    }

    .otp-digit-group {
        gap: 3px;
    }

    .otp-separator {
        width: 6px;
        height: 2px;
    }

    .quick-result-code .otp-digit {
        width: 30px;
        height: 38px;
        font-size: 1.15rem;
    }

    .quick-get-result {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .quick-result-timer {
        align-self: flex-end;
    }

    /* OTP Card compact */
    .otp-card {
        padding: 14px;
        border-radius: var(--radius-md);
    }

    .otp-card-header {
        margin-bottom: 10px;
    }

    .otp-account-avatar {
        width: 30px;
        height: 30px;
        font-size: 0.75rem;
    }

    .otp-account-name {
        font-size: 0.8rem;
    }

    .otp-code-section {
        gap: 8px;
    }

    .timer-ring-container {
        width: 34px;
        height: 34px;
    }

    .timer-ring {
        width: 34px;
        height: 34px;
    }

    .timer-text {
        font-size: 0.6rem;
    }

    /* Quick result actions stack */
    .quick-result-actions {
        flex-direction: column;
        gap: 6px;
    }

    .quick-copy-btn,
    .quick-save-btn {
        width: 100%;
        justify-content: center;
    }

    /* Add form */
    .add-form {
        padding: 14px;
        border-radius: var(--radius-md);
    }

    .form-actions {
        flex-direction: column;
    }

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

    /* Modal */
    .modal-content {
        padding: 24px 20px;
        border-radius: var(--radius-lg);
    }

    .modal-content h3 {
        font-size: 1rem;
    }

    .modal-actions {
        flex-direction: column;
        gap: 8px;
    }

    /* Divider */
    .divider-text {
        font-size: 0.65rem;
    }

    .section-divider {
        gap: 10px;
    }

    /* Footer */
    .app-footer p {
        font-size: 0.65rem;
    }

    /* Toast */
    .toast {
        font-size: 0.75rem;
        padding: 8px 16px;
        max-width: calc(100vw - 24px);
        white-space: normal;
        text-align: center;
    }
}

/* === Small Mobile (375px - 479px) === */
@media (min-width: 375px) and (max-width: 479px) {
    .app-container {
        padding: 14px 14px 32px;
    }

    .app-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 14px 0 22px;
    }

    .logo-text h1 {
        font-size: 1.15rem;
    }

    /* Quick Get - stack input & button */
    .quick-get-card {
        padding: 18px;
    }

    .quick-get-input-row {
        flex-direction: column;
        gap: 8px;
    }

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

    /* OTP digits */
    .otp-digit {
        width: 30px;
        height: 38px;
        font-size: 1.1rem;
    }

    .quick-result-code .otp-digit {
        width: 34px;
        height: 42px;
        font-size: 1.3rem;
    }

    .otp-code-section {
        gap: 12px;
    }

    .otp-card {
        padding: 16px;
    }

    /* Add form */
    .add-form {
        padding: 18px;
    }

    /* Toast */
    .toast {
        max-width: calc(100vw - 32px);
        white-space: normal;
        text-align: center;
    }
}

/* === Mobile Landscape === */
@media (max-width: 767px) and (orientation: landscape) {
    .app-container {
        max-width: 480px;
        padding-top: 12px;
        padding-bottom: 24px;
    }

    .app-header {
        padding: 8px 0 16px;
    }

    .quick-get-card {
        padding: 16px;
    }

    .quick-get-header {
        margin-bottom: 12px;
    }

    .quick-get-input-row {
        flex-direction: row;
    }

    .btn-quick-get {
        width: auto;
    }

    .empty-state {
        padding: 30px 20px;
    }

    /* Reduce bg orb sizes for landscape mobile */
    .bg-orb-1 { width: 300px; height: 300px; }
    .bg-orb-2 { width: 250px; height: 250px; }
    .bg-orb-3 { width: 200px; height: 200px; }
}

/* === Tablet (768px - 1023px) === */
@media (min-width: 768px) and (max-width: 1023px) {
    html {
        font-size: 16px;
    }

    .app-container {
        max-width: 600px;
        padding: 28px 24px 48px;
    }

    .app-header {
        padding: 24px 0 36px;
    }

    .logo-icon {
        width: 52px;
        height: 52px;
    }

    .logo-text h1 {
        font-size: 1.45rem;
    }

    /* Quick Get - side by side with more room */
    .quick-get-card {
        padding: 28px;
        border-radius: var(--radius-xl);
    }

    .quick-get-input-row {
        flex-direction: row;
    }

    .quick-result-code .otp-digit {
        width: 44px;
        height: 52px;
        font-size: 1.6rem;
    }

    /* OTP cards */
    .otp-card {
        padding: 22px;
    }

    .otp-digit {
        width: 38px;
        height: 46px;
        font-size: 1.35rem;
    }

    /* Modal wider */
    .modal-content {
        max-width: 420px;
        padding: 36px;
    }
}

/* === Desktop (1024px+) === */
@media (min-width: 1024px) {
    html {
        font-size: 16px;
    }

    .app-container {
        max-width: 640px;
        padding: 32px 24px 60px;
    }

    .app-header {
        padding: 28px 0 40px;
    }

    .logo-icon {
        width: 52px;
        height: 52px;
    }

    .logo-text h1 {
        font-size: 1.5rem;
    }

    /* Quick Get */
    .quick-get-card {
        padding: 28px;
    }

    .quick-result-code .otp-digit {
        width: 44px;
        height: 52px;
        font-size: 1.6rem;
    }

    /* OTP cards with comfortable spacing */
    .otp-list {
        gap: 14px;
    }

    .otp-card {
        padding: 24px;
    }

    .otp-digit {
        width: 40px;
        height: 48px;
        font-size: 1.4rem;
    }

    /* Modal */
    .modal-content {
        max-width: 440px;
        padding: 40px;
    }
}

/* === Large Desktop (1440px+) === */
@media (min-width: 1440px) {
    .app-container {
        max-width: 680px;
    }

    /* Larger bg orbs for more visual impact */
    .bg-orb-1 { width: 800px; height: 800px; }
    .bg-orb-2 { width: 700px; height: 700px; }
    .bg-orb-3 { width: 500px; height: 500px; }
}

/* === Safe Areas (iPhone notch/Dynamic Island, etc.) === */
@supports (padding: env(safe-area-inset-top)) {
    .app-container {
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
        padding-bottom: max(40px, env(safe-area-inset-bottom));
    }

    .toast {
        bottom: max(24px, env(safe-area-inset-bottom));
    }

    .modal-overlay {
        padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    }
}

/* === Reduced Motion Accessibility === */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .bg-orb {
        animation: none;
    }

    .quick-get-card::before {
        animation: none;
    }

    .otp-card {
        animation: none;
    }

    .toast {
        transition: opacity 0.01ms;
    }
}

/* === High Contrast / Forced Colors === */
@media (forced-colors: active) {
    .otp-digit {
        border: 2px solid CanvasText;
    }

    .btn-submit,
    .btn-quick-get,
    .btn-delete {
        border: 2px solid ButtonText;
    }

    .quick-get-card,
    .otp-card,
    .add-form,
    .modal-content {
        border: 2px solid CanvasText;
    }

    .logo-icon,
    .quick-get-icon,
    .otp-account-avatar {
        border: 2px solid CanvasText;
    }
}

/* === Print Styles === */
@media print {
    body {
        background: white;
        color: black;
    }

    .bg-animation,
    .btn-add-toggle,
    .btn-icon,
    .btn-quick-get,
    .quick-get-section,
    .app-footer,
    .toast,
    .modal-overlay,
    .form-actions,
    .otp-card-actions,
    .quick-result-actions,
    .quick-get-clear-btn,
    .security-badge,
    .section-divider {
        display: none !important;
    }

    .app-container {
        max-width: 100%;
        padding: 0;
    }

    .otp-card {
        background: white;
        border: 1px solid #ccc;
        box-shadow: none;
        page-break-inside: avoid;
        color: black;
    }

    .otp-digit {
        background: #f5f5f5;
        border-color: #999;
        color: black;
    }

    .otp-account-name {
        color: black;
    }

    .logo-text h1 {
        -webkit-text-fill-color: black;
        background: none;
        color: black;
    }

    .timer-ring-container {
        display: none;
    }
}
