/**
 * APIKit — Public / User-Facing Page Styles
 * ------------------------------------------
 * Shared dark theme for all user-facing pages:
 * signup, login (public), activate-email, forgot-password, reset-password, home.
 *
 * Admin panel pages use admin-style.css instead.
 */

/* ── Variables ── */
:root {
    --bg:      #080f1a;
    --surface: #0d1829;
    --card:    #111f33;
    --border:  #1e3048;
    --accent:  #3b9eff;
    --accent2: #00d4a0;
    --text:    #e2eaf4;
    --muted:   #6b84a0;
    --dim:     #3d5470;
    --red:     #ff5b5b;
    --yellow:  #fbbf24;
}

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

/* ── Base ── */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* ── Background grid ── */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(59,158,255,.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(59,158,255,.04) 1px, transparent 1px);
    background-size: 48px 48px;
    pointer-events: none;
    z-index: 0;
}

/* ── Glow orbs ── */
.orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(110px);
    opacity: .14;
    pointer-events: none;
    z-index: 0;
}
.orb-1 { width: 500px; height: 500px; top: -150px; left: -150px;   background: #1a6fff; }
.orb-2 { width: 400px; height: 400px; bottom: -100px; right: -100px; background: #00d4a0; }

/* ── Centered card layout (signup, login, forgot, reset, activate) ── */
body.page-centered {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.card {
    position: relative;
    z-index: 1;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 40px 36px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 24px 48px rgba(0,0,0,.4);
}

.card.card-narrow { max-width: 400px; }
.card.card-center  { text-align: center; }

/* ── Typography helpers ── */
.card-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.card-subtitle {
    font-size: 13px;
    color: var(--muted);
    line-height: 1.6;
    margin-bottom: 24px;
}

.logo-text {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -.04em;
    background: linear-gradient(135deg, #3b9eff, #00d4a0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 6px;
}

/* ── Forms ── */
.form-group { margin-bottom: 16px; }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 6px;
    letter-spacing: .03em;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"] {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--text);
    font-size: 14px;
    outline: none;
    transition: border-color .15s;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="tel"]:focus {
    border-color: var(--accent);
}

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

/* ── Buttons ── */
.btn-primary {
    display: block;
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, #1a6fff, #3b9eff);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all .18s;
    box-shadow: 0 8px 20px rgba(26,111,255,.35);
    text-align: center;
    text-decoration: none;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 28px rgba(26,111,255,.5);
}

.btn-primary:disabled {
    opacity: .6;
    transform: none;
    cursor: not-allowed;
}

/* ── Messages ── */
.msg {
    font-size: 13px;
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
    display: none;
}
.msg-error   { background: rgba(255,91,91,.1);  border: 1px solid rgba(255,91,91,.25);  color: var(--red); }
.msg-success { background: rgba(0,212,160,.1);  border: 1px solid rgba(0,212,160,.25);  color: var(--accent2); }
.msg-warning { background: rgba(251,191,36,.1); border: 1px solid rgba(251,191,36,.25); color: var(--yellow); }

/* ── Utility ── */
.hidden { display: none !important; }

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--muted);
    text-decoration: none;
    margin-bottom: 24px;
}
.back-link:hover { color: var(--accent); }

.card-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 13px;
    color: var(--muted);
}
.card-footer a { color: var(--accent); text-decoration: none; }
.card-footer a:hover { text-decoration: underline; }

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

/* ── Topbar (home / full-page app layout) ── */
.app-topbar {
    position: relative;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 32px;
    border-bottom: 1px solid var(--border);
    background: rgba(8,15,26,.8);
    backdrop-filter: blur(12px);
}

.app-topbar-logo {
    font-size: 16px;
    font-weight: 700;
    background: linear-gradient(135deg, #3b9eff, #00d4a0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.app-topbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: var(--muted);
}

.btn-logout {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--muted);
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    transition: all .15s;
}
.btn-logout:hover { border-color: var(--red); color: var(--red); }

.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, #1a6fff, #3b9eff);
    font-weight: 700;
    font-size: 14px;
    color: #fff;
    flex-shrink: 0;
}

/* ── Page content area ── */
.app-page {
    position: relative;
    z-index: 1;
    max-width: 860px;
    margin: 0 auto;
    padding: 48px 24px;
}

.welcome { margin-bottom: 32px; }
.welcome h1 { font-size: 24px; font-weight: 800; margin-bottom: 6px; }
.welcome p { font-size: 14px; color: var(--muted); }

/* ── Toolbar (search + actions) ── */
.app-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.search-box {
    position: relative;
    flex: 1;
    min-width: 220px;
    max-width: 360px;
}
.search-box input[type="text"] { padding-left: 38px; }
.search-box .search-icon {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    font-size: 14px;
    pointer-events: none;
}

/* ── Buttons (secondary / danger / icon) ── */
.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 11px 20px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
    text-decoration: none;
    white-space: nowrap;
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

.btn-danger {
    background: rgba(255,91,91,.1);
    border: 1px solid rgba(255,91,91,.28);
    color: var(--red);
}
.btn-danger:hover { background: rgba(255,91,91,.18); color: var(--red); border-color: var(--red); }

.btn-icon {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--muted);
    cursor: pointer;
    font-size: 14px;
    transition: all .15s;
}
.btn-icon:hover { border-color: var(--accent); color: var(--accent); }
.btn-icon.btn-icon-danger:hover { border-color: var(--red); color: var(--red); }

/* ── Vault grid / cards ── */
.vault-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.vault-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    transition: border-color .15s;
}
.vault-card:hover { border-color: var(--accent); }

.vault-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}
.vault-card-title {
    font-size: 15px;
    font-weight: 700;
    word-break: break-word;
    line-height: 1.35;
}
.vault-card-link {
    display: inline-block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--accent);
    text-decoration: none;
    word-break: break-all;
}
.vault-card-link:hover { text-decoration: underline; }

.vault-field {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 13px;
}
.vault-field-label {
    width: 60px;
    flex-shrink: 0;
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.vault-field-value {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: 'SF Mono', Monaco, Menlo, monospace;
    font-size: 12.5px;
}
.vault-field-value.is-secret { letter-spacing: 2px; }

.vault-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}
.vault-card-actions .btn-icon:last-child { margin-left: auto; }

/* ── Empty / loading state ── */
.empty-state {
    text-align: center;
    padding: 64px 24px;
    color: var(--muted);
    grid-column: 1 / -1;
}
.empty-state .icon { font-size: 40px; display: block; margin-bottom: 14px; }
.empty-state h3 { color: var(--text); font-size: 15px; margin-bottom: 6px; }
.empty-state p { font-size: 13px; }

/* ── Pagination (dark theme) ── */
.app-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
}
.app-pagination button {
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 13px;
    cursor: pointer;
    transition: all .15s;
}
.app-pagination button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.app-pagination button.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.app-pagination button:disabled { opacity: .4; cursor: not-allowed; }
.pagination-info {
    text-align: center;
    font-size: 12px;
    color: var(--muted);
    margin-top: 10px;
}

/* ── Modal (dark theme) ── */
.app-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(5,10,18,.72);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 24px;
}
.app-modal-overlay.active { display: flex; }

.app-modal {
    position: relative;
    z-index: 1;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 32px;
    width: 100%;
    max-width: 460px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 24px 60px rgba(0,0,0,.5);
}
.app-modal h3 { font-size: 17px; font-weight: 700; margin-bottom: 20px; }

textarea {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--text);
    font-size: 14px;
    outline: none;
    resize: vertical;
    min-height: 70px;
    font-family: inherit;
    transition: border-color .15s;
}
textarea:focus { border-color: var(--accent); }
textarea::placeholder { color: var(--dim); }

.app-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
}
.app-modal-actions .btn-primary { width: auto; padding: 11px 24px; }

/* ── Input with inline action (reveal / generate / copy) ── */
.field-with-action { position: relative; }
.field-with-action input { padding-right: 44px; }
.field-with-action .field-action {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 14px;
    padding: 6px 8px;
    border-radius: 6px;
    transition: color .15s;
}
.field-with-action .field-action:hover { color: var(--accent); }

.toolbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* ── Section tabs (Passwords / Digital Safe) ── */
.app-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
}
.app-tab {
    padding: 11px 18px;
    border: none;
    background: transparent;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all .15s;
}
.app-tab:hover { color: var(--text); }
.app-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Breadcrumb (Digital Safe folder navigation) ── */
.breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 18px;
    font-size: 13px;
}
.breadcrumb-item {
    background: transparent;
    border: none;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 6px;
    transition: color .15s;
}
.breadcrumb-item:hover { color: var(--accent); }
.breadcrumb-item.current { color: var(--text); cursor: default; }
.breadcrumb-sep { color: var(--dim); }

/* ── Digital Safe — folder / file cards ── */
.safe-card-icon { font-size: 28px; line-height: 1; flex-shrink: 0; }
.safe-card-folder { cursor: pointer; }
.safe-card-folder:hover { border-color: var(--accent); }
.safe-card-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}
.safe-card-meta {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.safe-card-size {
    font-size: 11px;
    color: var(--dim);
    text-transform: uppercase;
    letter-spacing: .04em;
}

input[type="file"] {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 9px 12px;
    color: var(--muted);
    font-size: 13px;
}
