/* =========================================================
   PSM – Password Manager  |  site.css
   ========================================================= */

:root {
    --psm-bg:          #f5f6fa;
    --psm-surface:     #ffffff;
    --psm-border:      #e5e7eb;
    --psm-primary:     #4f46e5;
    --psm-primary-h:   #4338ca;
    --psm-text:        #111827;
    --psm-muted:       #6b7280;
    --psm-radius:      12px;
    --psm-radius-sm:   8px;
    --psm-shadow:      0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.05);
    --psm-shadow-md:   0 4px 16px rgba(0,0,0,.08);
}

/* ── Base ── */
*, *::before, *::after { box-sizing: border-box; }

body.psm-body {
    background: var(--psm-bg);
    color: var(--psm-text);
    font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
    font-size: .9375rem;
    -webkit-font-smoothing: antialiased;
}

/* ── Navbar ── */
.psm-navbar {
    background: var(--psm-surface);
    border-bottom: 1px solid var(--psm-border);
    box-shadow: var(--psm-shadow);
    min-height: 58px;
}

.psm-logo-icon {
    font-size: 1.3rem;
    color: var(--psm-primary);
    line-height: 1;
}

.psm-logo-text {
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: -.5px;
    color: var(--psm-text);
}

.psm-navbar .nav-link {
    color: var(--psm-muted);
    font-size: .875rem;
    font-weight: 500;
    padding: .4rem .75rem;
    border-radius: var(--psm-radius-sm);
    transition: color .15s, background .15s;
}

.psm-navbar .nav-link:hover,
.psm-navbar .nav-link.active {
    color: var(--psm-primary);
    background: rgba(79,70,229,.07);
}

/* ── Role badges in nav ── */
.psm-badge-admin {
    background: rgba(79,70,229,.12);
    color: var(--psm-primary);
    font-size: .7rem;
    padding: .25rem .6rem;
    border-radius: 20px;
    font-weight: 600;
}

.psm-badge-user {
    background: rgba(107,114,128,.12);
    color: var(--psm-muted);
    font-size: .7rem;
    padding: .25rem .6rem;
    border-radius: 20px;
    font-weight: 600;
}

/* ── Main content ── */
.psm-main {
    max-width: 1280px;
    margin: 0 auto;
}

/* ── Cards ── */
.psm-card {
    background: var(--psm-surface);
    border: 1px solid var(--psm-border);
    border-radius: var(--psm-radius);
    box-shadow: var(--psm-shadow);
    overflow: hidden;
}

/* ── Login card ── */
.psm-login-card {
    background: var(--psm-surface);
    border: 1px solid var(--psm-border);
    border-radius: var(--psm-radius);
    box-shadow: var(--psm-shadow-md);
    padding: 2.25rem 2rem;
    width: 100%;
    max-width: 420px;
}

.psm-login-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--psm-primary), #7c3aed);
    color: #fff;
    font-size: 1.6rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(79,70,229,.35);
}

/* ── Tabs ── */
.psm-tabs {
    background: var(--psm-surface);
    border: 1px solid var(--psm-border);
    border-radius: var(--psm-radius-sm);
    padding: .25rem;
    gap: .25rem;
}

.psm-tabs .nav-link {
    color: var(--psm-muted);
    font-size: .8125rem;
    font-weight: 500;
    padding: .35rem .85rem;
    border-radius: 6px;
    transition: all .15s;
    border: none;
}

.psm-tabs .nav-link.active {
    color: var(--psm-primary);
    background: rgba(79,70,229,.08);
    font-weight: 600;
}

.psm-tabs .nav-link:hover:not(.active) {
    color: var(--psm-text);
    background: var(--psm-bg);
}

/* ── Accordion ── */
.psm-accordion { gap: 0; }

.psm-acc-item {
    background: var(--psm-surface);
    border: 1px solid var(--psm-border) !important;
    border-radius: var(--psm-radius) !important;
    box-shadow: var(--psm-shadow);
    overflow: visible;
}

.psm-acc-header {
    border-radius: var(--psm-radius);
    transition: background .15s;
    min-height: 58px;
}

.psm-acc-header:hover { background: rgba(79,70,229,.02); }

.psm-acc-toggle {
    background: none;
    border: none;
    padding: .25rem;
    border-radius: 6px;
    color: var(--psm-muted);
    transition: background .15s;
    flex-shrink: 0;
}

.psm-acc-toggle:hover { background: rgba(79,70,229,.08); color: var(--psm-primary); }

.psm-chevron {
    font-size: .9rem;
    transition: transform .2s ease;
    display: block;
}

.psm-chevron.rotated { transform: rotate(90deg); }

/* ── Inputs ── */
.psm-input {
    border-color: var(--psm-border);
    border-radius: var(--psm-radius-sm) !important;
    font-size: .875rem;
    color: var(--psm-text);
    background: var(--psm-surface);
    transition: border-color .15s, box-shadow .15s;
}

.psm-input:focus {
    border-color: var(--psm-primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,.12);
    background: var(--psm-surface);
}

.input-group .psm-input:not(:first-child) { border-left: none; }
.input-group .psm-input:not(:last-child)  { border-right: none; }
.input-group-text { border-color: var(--psm-border); font-size: .875rem; }

/* ── Buttons ── */
.psm-btn-primary {
    background: var(--psm-primary);
    color: #fff;
    border: none;
    border-radius: var(--psm-radius-sm);
    font-weight: 500;
    font-size: .875rem;
    transition: background .15s, transform .1s, box-shadow .15s;
}

.psm-btn-primary:hover {
    background: var(--psm-primary-h);
    color: #fff;
    box-shadow: 0 4px 12px rgba(79,70,229,.28);
    transform: translateY(-1px);
}

.psm-btn-primary:active { transform: translateY(0); }

.psm-btn-share {
    background: #0ea5e9;
    color: #fff;
    border: none;
    border-radius: var(--psm-radius-sm);
    font-weight: 500;
    font-size: .875rem;
    transition: background .15s, transform .1s;
}

.psm-btn-share:hover { background: #0284c7; color: #fff; transform: translateY(-1px); }

/* ── Table ── */
.psm-table { font-size: .875rem; }

.psm-table thead th {
    font-size: .72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--psm-muted);
    border-bottom: 1px solid var(--psm-border);
    padding: .75rem 1rem;
    white-space: nowrap;
    background: #fafafa;
}

.psm-table tbody td {
    padding: .75rem 1rem;
    border-bottom: 1px solid var(--psm-border);
    vertical-align: middle;
}

.psm-table tbody tr:last-child td { border-bottom: none; }
.psm-table tbody tr { transition: background .1s; }
.psm-table tbody tr:hover { background: rgba(79,70,229,.02); }

/* ── App icon ── */
.psm-app-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--psm-primary), #7c3aed);
    color: #fff;
    font-size: .8rem;
    font-weight: 700;
    flex-shrink: 0;
}

.psm-app-icon-sm {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    font-size: .7rem;
}

/* ── Label badge ── */
.psm-label-badge {
    display: inline-block;
    background: rgba(79,70,229,.08);
    color: var(--psm-primary);
    font-size: .72rem;
    font-weight: 600;
    padding: .2rem .55rem;
    border-radius: 20px;
    white-space: nowrap;
}

/* ── Shared badge ── */
.psm-shared-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: .68rem;
    font-weight: 600;
    color: #0ea5e9;
    background: rgba(14,165,233,.1);
    padding: .15rem .45rem;
    border-radius: 20px;
}

/* ── Credential count badge ── */
.psm-badge-count {
    background: rgba(107,114,128,.1);
    color: var(--psm-muted);
    font-size: .7rem;
    font-weight: 600;
    padding: .25rem .6rem;
    border-radius: 20px;
    white-space: nowrap;
}

/* ── Copy btn ── */
.psm-copy-btn {
    cursor: pointer;
    color: var(--psm-text);
    display: inline-flex;
    align-items: center;
    padding: .25rem .5rem;
    border-radius: 6px;
    transition: background .15s, color .15s;
    user-select: none;
    font-size: .875rem;
}

.psm-copy-btn:hover {
    background: rgba(79,70,229,.08);
    color: var(--psm-primary);
}

.psm-copy-btn:active { transform: scale(.97); }

/* ── URL link ── */
.psm-link {
    color: var(--psm-primary);
    text-decoration: none;
    font-size: .8125rem;
    transition: color .15s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
    display: inline-block;
}

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

/* ── Reveal button ── */
.psm-reveal-btn {
    background: transparent;
    border: none;
    color: var(--psm-muted);
    padding: .2rem .35rem;
    border-radius: 6px;
    transition: color .15s, background .15s;
    flex-shrink: 0;
}

.psm-reveal-btn:hover { color: var(--psm-primary); background: rgba(79,70,229,.08); }

/* ── Action buttons ── */
.psm-action-btn {
    background: transparent;
    border: 1px solid var(--psm-border);
    color: var(--psm-muted);
    border-radius: 6px;
    width: 30px;
    height: 30px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .78rem;
    transition: all .15s;
    flex-shrink: 0;
}

.psm-action-btn:hover {
    background: rgba(79,70,229,.06);
    border-color: var(--psm-primary);
    color: var(--psm-primary);
}

.psm-action-btn.text-danger:hover {
    background: #fef2f2;
    border-color: #ef4444;
    color: #ef4444 !important;
}

/* ── Search ── */
.psm-search-group .form-control { border-left: none; }
.psm-search-group .input-group-text { border-right: none; }

/* ── Share modal user list ── */
.psm-user-list {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    max-height: 260px;
    overflow-y: auto;
}

.psm-user-check-item {
    padding: .6rem .75rem;
    border: 1px solid var(--psm-border);
    border-radius: var(--psm-radius-sm);
    cursor: pointer;
    transition: background .15s, border-color .15s;
    user-select: none;
}

.psm-user-check-item:hover { background: rgba(79,70,229,.04); border-color: var(--psm-primary); }

.psm-user-check-item input:checked ~ * { color: var(--psm-primary); }

/* ── Empty state ── */
.psm-empty-state {
    min-height: 280px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* ── Modal ── */
.psm-modal {
    border-radius: var(--psm-radius);
    border: 1px solid var(--psm-border);
}

/* ── Toast ── */
.psm-toast {
    border-radius: var(--psm-radius-sm);
    font-size: .875rem;
    min-width: 260px;
    box-shadow: var(--psm-shadow-md);
    border: 1px solid var(--psm-border);
}

/* ── Strength bar ── */
#strengthFill { transition: width .3s, background-color .3s; }

/* ── Responsive ── */
@media (max-width: 768px) {
    .psm-login-card { padding: 1.75rem 1.25rem; margin: 1rem; }
    .psm-main { padding: 1rem !important; }
    .psm-acc-header { min-height: auto; padding-top: .75rem; padding-bottom: .75rem; }
}

@media (max-width: 576px) {
    .psm-tabs { width: 100%; }
}
