/* ============================================
   TOTP Generator — Styles
   Theme: Dark mode with Rose Pink palette
   ============================================ */

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

:root {
    --primary: #FD79A8;
    --primary-hover: #FF8FBB;
    --secondary: #FFCCCC;
    --accent: #00CEC9;
    --accent-hover: #26E6E0;
    --bg: #1A0A14;
    --bg-card: rgba(30, 15, 25, 0.8);
    --bg-card-hover: rgba(45, 25, 38, 0.85);
    --bg-input: rgba(40, 18, 30, 0.7);
    --border: rgba(253, 121, 168, 0.2);
    --border-hover: rgba(253, 121, 168, 0.4);
    --text: #F0E4EA;
    --text-muted: #B098A8;
    --text-dim: #786070;
    --danger: #FF4757;
    --success: #2ED573;
    --radius: 12px;
    --radius-sm: 8px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --mono: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
    --transition: 250ms ease;
    --shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    --glass: blur(12px);
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.hidden {
    display: none !important;
}

/* --- Header --- */
.app-header {
    background: linear-gradient(135deg, rgba(253, 121, 168, 0.1), rgba(0, 206, 201, 0.05));
    border-bottom: 1px solid var(--border);
    backdrop-filter: var(--glass);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo h1 {
    font-size: 1.2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-actions {
    display: flex;
    gap: 0.4rem;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 0.9rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-family: var(--font);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #E66B94);
    color: #1A0A14;
    font-weight: 600;
    box-shadow: 0 2px 10px rgba(253, 121, 168, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 4px 18px rgba(253, 121, 168, 0.5);
    transform: translateY(-1px);
}

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

.btn-ghost:hover {
    border-color: var(--border-hover);
    color: var(--text);
}

.btn-icon {
    background: transparent;
    color: var(--text-muted);
    padding: 0.35rem;
    border-radius: var(--radius-sm);
}

.btn-icon:hover {
    background: rgba(253, 121, 168, 0.1);
    color: var(--text);
}

.btn-danger {
    background: rgba(255, 71, 87, 0.15);
    color: var(--danger);
    border: 1px solid rgba(255, 71, 87, 0.2);
}

.btn-danger:hover {
    background: rgba(255, 71, 87, 0.25);
}

.btn-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
}

.btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* --- Main --- */
.app-main {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-icon {
    margin-bottom: 1.5rem;
    opacity: 0.7;
}

.empty-state h2 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

/* --- Account Cards --- */
.accounts-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.account-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    backdrop-filter: var(--glass);
    transition: all var(--transition);
    animation: fadeIn 300ms ease;
    position: relative;
    overflow: hidden;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

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

.account-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow);
}

.account-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.account-info {
    display: flex;
    flex-direction: column;
}

.account-issuer {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
}

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

.account-actions {
    display: flex;
    gap: 0.3rem;
}

.code-display {
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
}

.code-value {
    font-family: var(--mono);
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: var(--primary);
    user-select: all;
    transition: color var(--transition);
}

.code-value:hover {
    color: var(--primary-hover);
}

.code-value.copied {
    color: var(--success) !important;
}

.timer-ring {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    position: relative;
}

.timer-ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.timer-ring .ring-bg {
    fill: none;
    stroke: rgba(253, 121, 168, 0.12);
    stroke-width: 3;
}

.timer-ring .ring-fg {
    fill: none;
    stroke: var(--accent);
    stroke-width: 3;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s linear, stroke 200ms ease;
}

.timer-ring .ring-fg.low {
    stroke: var(--danger);
}

.timer-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--mono);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
}

.account-type-badge {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    background: rgba(0, 206, 201, 0.15);
    color: var(--accent);
}

.account-type-badge.hotp {
    background: rgba(253, 121, 168, 0.15);
    color: var(--primary);
}

/* HOTP next button */
.hotp-next-btn {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--accent);
    padding: 0.3rem 0.6rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all var(--transition);
}

.hotp-next-btn:hover {
    border-color: var(--accent);
    background: rgba(0, 206, 201, 0.1);
}

/* --- Modals --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 2rem;
}

.modal-content {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    max-width: 500px;
    width: 100%;
    padding: 1.5rem;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

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

.modal-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
}

/* --- Forms --- */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.input-control,
.select-control {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: 0.55rem 0.75rem;
    font-size: 0.9rem;
    font-family: var(--font);
    transition: all var(--transition);
}

.input-control.mono,
textarea.mono {
    font-family: var(--mono);
    font-size: 0.85rem;
    letter-spacing: 0.05em;
}

textarea.input-control {
    resize: vertical;
    min-height: 100px;
}

.input-control:focus,
.select-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(253, 121, 168, 0.15);
}

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

.form-hint {
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-top: 0.25rem;
    display: block;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.75rem;
}

.form-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 1.25rem;
}

/* --- Footer --- */
.app-footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-dim);
    font-size: 0.8rem;
    border-top: 1px solid var(--border);
    margin-top: 2rem;
}

/* --- Responsive --- */
@media (max-width: 600px) {
    .app-header {
        padding: 0.75rem 1rem;
    }

    .header-content {
        flex-direction: column;
        align-items: stretch;
    }

    .header-actions {
        justify-content: flex-end;
    }

    .app-main {
        padding: 1rem;
    }

    .code-value {
        font-size: 1.6rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}