/* ============================================
   LifeMemoriam Partner Portal — Stylesheet
   partners.lifememoriam.com
   A Service of ProSynServ, Inc.
   ============================================ */

/* ── CSS Variables (Brand Palette) ── */
:root {
    --purple-deep: #3B0A5E;
    --purple-primary: #5C1A8C;
    --purple-mid: #7B2FBF;
    --purple-light: #A855F7;
    --purple-pale: #E9D5FF;
    --purple-wash: #F5EDFF;
    --gold-warm: #D4A843;
    --gold-light: #F2E2B6;
    --green-soft: #C8E6C0;
    --gray-800: #262626;
    --gray-600: #525252;
    --gray-400: #A3A3A3;
    --gray-200: #E5E5E5;
    --gray-100: #F5F5F5;
    --white: #FFFFFF;
    --red-600: #DC2626;
    --red-100: #FEE2E2;
    --green-600: #16A34A;
    --green-100: #DCFCE7;
    --blue-600: #2563EB;
    --blue-100: #DBEAFE;
    --amber-600: #D97706;
    --amber-100: #FEF3C7;

    --font-display: 'Cormorant Garamond', Georgia, serif;
    --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 3px rgba(59,10,94,0.08);
    --shadow-md: 0 4px 12px rgba(59,10,94,0.1);
    --shadow-lg: 0 8px 30px rgba(59,10,94,0.12);
    --transition: 0.2s ease;
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-font-smoothing: antialiased; }
body {
    font-family: var(--font-body);
    color: var(--gray-800);
    background: var(--gray-100);
    line-height: 1.6;
    min-height: 100vh;
}
a { color: var(--purple-primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--purple-mid); }
img { max-width: 100%; height: auto; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }

/* ── Layout ── */
.app-wrapper { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
    width: 260px;
    background: var(--purple-deep);
    color: var(--white);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: transform 0.3s ease;
}
.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 12px;
}
.sidebar-logo { width: 40px; height: 40px; }
.sidebar-brand h1 {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--white);
    line-height: 1.2;
}
.sidebar-brand span {
    font-size: 0.7rem;
    color: var(--purple-pale);
    text-transform: uppercase;
    letter-spacing: 1.5px;
}
.sidebar-nav { flex: 1; padding: 16px 0; overflow-y: auto; }
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 20px;
    color: rgba(255,255,255,0.7);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition);
    border-left: 3px solid transparent;
}
.sidebar-nav a:hover {
    color: var(--white);
    background: rgba(255,255,255,0.06);
}
.sidebar-nav a.active {
    color: var(--white);
    background: rgba(255,255,255,0.1);
    border-left-color: var(--gold-warm);
}
.sidebar-nav a svg { width: 20px; height: 20px; flex-shrink: 0; }
.sidebar-nav .nav-divider {
    height: 1px;
    background: rgba(255,255,255,0.08);
    margin: 12px 20px;
}
.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 0.75rem;
    color: rgba(255,255,255,0.4);
}

/* ── Main Content ── */
.main-content {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
}

/* ── Top Bar ── */
.topbar {
    background: var(--white);
    padding: 16px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 50;
}
.topbar-left h2 {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--purple-deep);
}
.topbar-left p {
    font-size: 0.8rem;
    color: var(--gray-400);
    margin-top: 2px;
}
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition);
}
.topbar-user:hover { background: var(--gray-100); }
.topbar-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--purple-primary);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
}
.topbar-user-info { line-height: 1.3; }
.topbar-user-name { font-weight: 600; font-size: 0.85rem; }
.topbar-user-role { font-size: 0.7rem; color: var(--gray-400); }

/* ── Mobile menu toggle ── */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--purple-deep);
    cursor: pointer;
    padding: 8px;
}
.menu-toggle svg { width: 24px; height: 24px; }

/* ── Page Content ── */
.page-content { padding: 32px; flex: 1; }

/* ── Cards ── */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    overflow: hidden;
}
.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.card-header h3 {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--purple-deep);
}
.card-body { padding: 24px; }
.card-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--gray-200);
    background: var(--gray-100);
}

/* ── Stat Cards ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}
.stat-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: box-shadow var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-md); }
.stat-icon {
    width: 48px; height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.stat-icon svg { width: 24px; height: 24px; }
.stat-icon.purple { background: var(--purple-wash); color: var(--purple-primary); }
.stat-icon.gold { background: var(--amber-100); color: var(--amber-600); }
.stat-icon.green { background: var(--green-100); color: var(--green-600); }
.stat-icon.blue { background: var(--blue-100); color: var(--blue-600); }
.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--purple-deep);
    line-height: 1.1;
}
.stat-label {
    font-size: 0.8rem;
    color: var(--gray-400);
    margin-top: 4px;
}

/* ── Tables ── */
.table-wrapper { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
}
table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--gray-200);
    white-space: nowrap;
}
table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--gray-200);
    font-size: 0.9rem;
    vertical-align: middle;
}
table tr:last-child td { border-bottom: none; }
table tr:hover td { background: var(--purple-wash); }

/* ── Status Badges ── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}
.badge-available, .badge-active, .badge-transferred, .badge-paid {
    background: var(--green-100); color: var(--green-600);
}
.badge-redeemed, .badge-building, .badge-custodial, .badge-pending {
    background: var(--amber-100); color: var(--amber-600);
}
.badge-voided, .badge-suspended, .badge-closed, .badge-failed {
    background: var(--red-100); color: var(--red-600);
}
.badge-unused {
    background: var(--blue-100); color: var(--blue-600);
}
.badge::before {
    content: '';
    width: 6px; height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    border: none;
    transition: all var(--transition);
    white-space: nowrap;
}
.btn svg { width: 18px; height: 18px; }
.btn-primary {
    background: linear-gradient(135deg, var(--purple-primary), var(--purple-mid));
    color: var(--white);
    box-shadow: 0 2px 8px rgba(92,26,140,0.3);
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(92,26,140,0.4);
}
.btn-secondary {
    background: var(--white);
    color: var(--purple-primary);
    border: 1px solid var(--purple-pale);
}
.btn-secondary:hover { background: var(--purple-wash); }
.btn-gold {
    background: linear-gradient(135deg, var(--gold-warm), #E8B94D);
    color: var(--purple-deep);
    box-shadow: 0 2px 8px rgba(212,168,67,0.3);
}
.btn-gold:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(212,168,67,0.4);
}
.btn-danger {
    background: var(--red-600);
    color: var(--white);
}
.btn-danger:hover { opacity: 0.9; }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ── Forms ── */
.form-group { margin-bottom: 20px; }
.form-group label {
    display: block;
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--gray-600);
    margin-bottom: 6px;
}
.form-group label .required { color: var(--red-600); }
.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    color: var(--gray-800);
    background: var(--white);
    transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus {
    outline: none;
    border-color: var(--purple-light);
    box-shadow: 0 0 0 3px rgba(168,85,247,0.15);
}
.form-control::placeholder { color: var(--gray-400); }
.form-control.error { border-color: var(--red-600); }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%23525252'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
textarea.form-control { resize: vertical; min-height: 100px; }
.form-hint { font-size: 0.75rem; color: var(--gray-400); margin-top: 4px; }
.form-error { font-size: 0.75rem; color: var(--red-600); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ── Alerts ── */
.alert {
    padding: 14px 20px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}
.alert svg { width: 20px; height: 20px; flex-shrink: 0; margin-top: 1px; }
.alert-success { background: var(--green-100); color: var(--green-600); border: 1px solid #BBF7D0; }
.alert-warning { background: var(--amber-100); color: var(--amber-600); border: 1px solid #FDE68A; }
.alert-danger { background: var(--red-100); color: var(--red-600); border: 1px solid #FECACA; }
.alert-info { background: var(--blue-100); color: var(--blue-600); border: 1px solid #BFDBFE; }

/* ── Modal ── */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(59,10,94,0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}
.modal-overlay.active .modal { transform: translateY(0); }
.modal-header {
    padding: 24px 24px 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}
.modal-header h3 {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--purple-deep);
}
.modal-close {
    background: none; border: none; cursor: pointer;
    color: var(--gray-400); padding: 4px;
    transition: color var(--transition);
}
.modal-close:hover { color: var(--gray-800); }
.modal-body { padding: 20px 24px; }
.modal-footer {
    padding: 16px 24px 24px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* ── Pagination ── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 20px;
}
.pagination a, .pagination span {
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
}
.pagination a {
    color: var(--gray-600);
    transition: all var(--transition);
}
.pagination a:hover { background: var(--purple-wash); color: var(--purple-primary); }
.pagination .active {
    background: var(--purple-primary);
    color: var(--white);
}

/* ── Empty State ── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray-400);
}
.empty-state svg { width: 64px; height: 64px; margin-bottom: 16px; color: var(--purple-pale); }
.empty-state h4 {
    font-family: var(--font-display);
    font-size: 1.2rem;
    color: var(--gray-600);
    margin-bottom: 8px;
}
.empty-state p { font-size: 0.9rem; margin-bottom: 20px; }

/* ── Token Display ── */
.token-code {
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--purple-deep);
}
.token-code.lg {
    font-size: 1.5rem;
    background: var(--purple-wash);
    padding: 12px 20px;
    border-radius: var(--radius-md);
    display: inline-block;
}

/* ── Activity Feed ── */
.activity-item {
    display: flex;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--gray-200);
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    margin-top: 6px;
    flex-shrink: 0;
}
.activity-dot.purchase { background: var(--purple-primary); }
.activity-dot.redeem { background: var(--gold-warm); }
.activity-dot.transfer { background: var(--green-600); }
.activity-dot.build { background: var(--blue-600); }
.activity-text { font-size: 0.85rem; color: var(--gray-600); }
.activity-text strong { color: var(--gray-800); }
.activity-time { font-size: 0.75rem; color: var(--gray-400); margin-top: 3px; }

/* ── Pricing Cards ── */
.pricing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.pricing-card {
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 24px;
    text-align: center;
    transition: all var(--transition);
    cursor: pointer;
}
.pricing-card:hover { border-color: var(--purple-pale); }
.pricing-card.selected {
    border-color: var(--purple-primary);
    background: var(--purple-wash);
    box-shadow: var(--shadow-md);
}
.pricing-qty {
    font-size: 2rem;
    font-weight: 700;
    color: var(--purple-deep);
}
.pricing-label { font-size: 0.85rem; color: var(--gray-400); margin-bottom: 8px; }
.pricing-price {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--purple-primary);
}
.pricing-unit { font-size: 0.75rem; color: var(--gray-400); }
.pricing-card.best-value { border-color: var(--gold-warm); position: relative; }
.pricing-card.best-value::before {
    content: 'Best Value';
    position: absolute;
    top: -12px; left: 50%;
    transform: translateX(-50%);
    background: var(--gold-warm);
    color: var(--white);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 12px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ── Progress Steps ── */
.steps {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 32px;
}
.step {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--gray-400);
}
.step-num {
    width: 28px; height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.75rem;
    border: 2px solid var(--gray-200);
    background: var(--white);
}
.step.active .step-num {
    background: var(--purple-primary);
    color: var(--white);
    border-color: var(--purple-primary);
}
.step.completed .step-num {
    background: var(--green-600);
    color: var(--white);
    border-color: var(--green-600);
}
.step-line {
    width: 40px;
    height: 2px;
    background: var(--gray-200);
}
.step.completed + .step-line,
.step-line.completed { background: var(--green-600); }

/* ── Login / Apply Pages ── */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--purple-deep) 0%, var(--purple-primary) 100%);
    padding: 40px 20px;
}
.auth-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 480px;
    padding: 40px;
}
.auth-card.wide { max-width: 720px; }
.auth-logo {
    text-align: center;
    margin-bottom: 32px;
}
.auth-logo img { width: 60px; height: 60px; margin-bottom: 12px; }
.auth-logo h1 {
    font-family: var(--font-display);
    font-size: 1.6rem;
    color: var(--purple-deep);
}
.auth-logo span {
    display: block;
    font-size: 0.75rem;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-top: 4px;
}
.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 0.8rem;
    color: var(--gray-400);
}
.auth-footer a { font-weight: 500; }

/* ── Responsive ── */
@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .menu-toggle { display: block; }
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .page-content { padding: 20px 16px; }
    .topbar { padding: 12px 16px; }
    .stats-grid { grid-template-columns: 1fr; }
    .auth-card { padding: 28px 20px; }
}

/* ── Utilities ── */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--gray-400); }
.text-small { font-size: 0.8rem; }
.text-purple { color: var(--purple-primary); }
.text-gold { color: var(--gold-warm); }
.mb-0 { margin-bottom: 0; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mb-32 { margin-bottom: 32px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.gap-12 { gap: 12px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.hidden { display: none !important; }