/* =======================================================
   Life Map v2  Unified Visual System
   Modern glassmorphism palette applied across all screens
   ======================================================= */

:root {
    --brand-50: #f1f5ff;
    --brand-100: #e2e8ff;
    --brand-200: #c7d4ff;
    --brand-300: #9fb5ff;
    --brand-400: #7390f9;
    --brand-500: #5d76f1;
    --brand-600: #4c61dd;
    --brand-700: #3c4ec0;
    --brand-800: #2d3e95;
    --brand-900: #1d2a63;
    --ink-900: #0b1221;
    --ink-700: #111827;
    --ink-500: #1f2937;
    --ink-300: #4b5563;
    --muted: #6b7280;
    --border: rgba(255,255,255,0.08);
    --card: rgba(255,255,255,0.9);
    --card-strong: rgba(255,255,255,0.7);
    --frost: rgba(255,255,255,0.45);
    --shadow-sm: 0 10px 30px rgba(10, 28, 68, 0.08);
    --shadow-md: 0 20px 60px rgba(10, 28, 68, 0.12);
    --shadow-lg: 0 25px 80px rgba(10, 28, 68, 0.16);
    --radius-lg: 18px;
    --radius-pill: 999px;
    --primary-gradient: linear-gradient(135deg, #5d76f1 0%, #3c4ec0 100%);
    --accent-gradient: linear-gradient(135deg, #3c4ec0 0%, #23c4c9 100%);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--ink-900);
    min-height: 100vh;
    background: radial-gradient(circle at 10% 20%, rgba(93,118,241,0.15), transparent 25%),
                radial-gradient(circle at 90% 10%, rgba(35,196,201,0.14), transparent 25%),
                radial-gradient(circle at 50% 80%, rgba(60,78,192,0.16), transparent 30%),
                #0f172a;
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
}

::selection {
    background: rgba(93,118,241,0.25);
    color: #fff;
}

a {
    color: var(--brand-600);
    text-decoration: none;
    transition: color 0.2s ease, opacity 0.2s ease;
}

a:hover {
    color: var(--brand-700);
}

.page-shell {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 18px 48px;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    background: linear-gradient(120deg, rgba(255,255,255,0.82), rgba(255,255,255,0.75));
    border-bottom: 1px solid rgba(255,255,255,0.45);
    box-shadow: var(--shadow-sm);
}

.topbar-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.topbar nav a {
    padding: 9px 12px;
    border-radius: 10px;
    color: var(--muted);
    font-weight: 600;
}

.topbar nav a:hover,
.topbar nav a.active {
    color: var(--brand-700);
    background: rgba(93,118,241,0.12);
}

.glass-card {
    background: linear-gradient(180deg, rgba(255,255,255,0.94), rgba(255,255,255,0.86));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.glass-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(93,118,241,0.2);
}

.section-heading {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--ink-900);
    font-weight: 700;
    letter-spacing: -0.01em;
}

.section-subtle {
    color: var(--muted);
    font-size: 14px;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
}

.stat {
    padding: 18px;
    border-radius: var(--radius-lg);
    background: rgba(255,255,255,0.9);
    border: 1px solid rgba(255,255,255,0.35);
    box-shadow: var(--shadow-sm);
}

.stat .label {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
}

.stat .value {
    font-size: 26px;
    font-weight: 800;
    color: var(--ink-900);
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: var(--radius-pill);
    background: rgba(93,118,241,0.14);
    color: var(--brand-800);
    font-weight: 600;
    font-size: 13px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 12px;
    background: rgba(17,24,39,0.06);
    color: var(--ink-700);
    font-weight: 600;
    font-size: 12px;
}

.btn {
    border: none;
    outline: none;
    cursor: pointer;
    font-weight: 700;
    border-radius: 12px;
    padding: 12px 16px;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.btn-primary {
    background: var(--primary-gradient);
    color: #fff;
    box-shadow: 0 14px 40px rgba(93,118,241,0.3);
}

.btn-ghost {
    background: rgba(93,118,241,0.12);
    color: var(--brand-700);
}

.btn-plain {
    background: rgba(255,255,255,0.8);
    color: var(--ink-700);
    border: 1px solid rgba(17,24,39,0.05);
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 32px rgba(10,28,68,0.12);
}

.btn:active {
    transform: translateY(0);
    box-shadow: none;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="number"],
textarea,
select {
    width: 100%;
    border: 1px solid rgba(17,24,39,0.08);
    border-radius: 12px;
    padding: 12px 14px;
    background: rgba(255,255,255,0.9);
    color: var(--ink-900);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: rgba(93,118,241,0.65);
    box-shadow: 0 10px 30px rgba(93,118,241,0.16);
    background: #fff;
}

input::placeholder,
textarea::placeholder {
    color: var(--muted);
}

textarea {
    resize: vertical;
    min-height: 120px;
}

.form-label {
    font-weight: 700;
    color: var(--ink-900);
}

.form-hint {
    color: var(--muted);
    font-size: 13px;
}

.table-wrap {
    overflow: hidden;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(255,255,255,0.95);
}

table thead {
    background: linear-gradient(90deg, rgba(93,118,241,0.12), rgba(35,196,201,0.12));
}

table th, table td {
    padding: 12px 14px;
    text-align: left;
}

table th {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 12px;
    color: var(--muted);
}

table tbody tr + tr {
    border-top: 1px solid rgba(17,24,39,0.06);
}

table tbody tr:hover {
    background: rgba(93,118,241,0.06);
}

.alert {
    border-radius: 14px;
    padding: 14px 16px;
    border: 1px solid rgba(17,24,39,0.06);
    background: rgba(255,255,255,0.8);
    box-shadow: var(--shadow-sm);
}

.alert-info { border-left: 4px solid var(--brand-400); color: var(--ink-700); }
.alert-success { border-left: 4px solid #16a34a; color: #14532d; }
.alert-warning { border-left: 4px solid #f59e0b; color: #92400e; }
.alert-error { border-left: 4px solid #ef4444; color: #991b1b; }

.progress-indicator {
    height: 10px;
    border-radius: 10px;
    background: rgba(17,24,39,0.06);
    position: relative;
    overflow: hidden;
}

.progress-indicator::after {
    content: '';
    position: absolute;
    inset: 0;
    width: var(--progress, 35%);
    background: var(--accent-gradient);
    border-radius: inherit;
}

.chip-set {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip {
    padding: 8px 12px;
    border-radius: var(--radius-pill);
    background: rgba(17,24,39,0.06);
    color: var(--ink-700);
    font-weight: 600;
}

.dimension-card {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255,255,255,0.35);
    background: linear-gradient(135deg, rgba(255,255,255,0.96), rgba(255,255,255,0.88));
    box-shadow: var(--shadow-md);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.dimension-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, rgba(93,118,241,0.12), rgba(35,196,201,0.12));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.dimension-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

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

.dimension-card > * { position: relative; z-index: 1; }

.mood-btn,
.energy-btn {
    position: relative;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
    border-radius: 12px;
    border: 1px solid rgba(17,24,39,0.08);
    background: rgba(255,255,255,0.9);
    box-shadow: var(--shadow-sm);
}

.mood-btn:hover,
.energy-btn:hover {
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 14px 32px rgba(93,118,241,0.18);
}

.mood-btn.active,
.energy-btn.active {
    background: var(--primary-gradient);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 14px 36px rgba(93,118,241,0.25);
}

.tooltip {
    position: relative;
}

.tooltip::before,
.tooltip::after {
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.tooltip::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translate(-50%, 6px);
    background: #0b1221;
    color: #fff;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 5;
}

.tooltip::after {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translate(-50%, 6px);
    border: 6px solid transparent;
    border-top-color: #0b1221;
}

.tooltip:hover::before,
.tooltip:hover::after {
    opacity: 1;
    transform: translate(-50%, 0);
}

.skeleton {
    background: linear-gradient(90deg, #eef2ff 25%, #e0e7ff 50%, #eef2ff 75%);
    background-size: 200% 100%;
    animation: loading 1.4s ease-in-out infinite;
    border-radius: 12px;
}

.loading-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    background: rgba(15,23,42,0.45);
    z-index: 60;
    animation: fadeIn 0.3s ease;
}

.modal {
    background: rgba(255,255,255,0.98);
    border-radius: 20px;
    padding: 28px;
    min-width: 360px;
    box-shadow: var(--shadow-lg);
}

.tag-cloud {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.tag {
    padding: 8px 10px;
    border-radius: var(--radius-pill);
    background: rgba(93,118,241,0.1);
    color: var(--brand-800);
    font-weight: 600;
}

.timeline {
    position: relative;
    padding-left: 18px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, rgba(93,118,241,0.4), rgba(35,196,201,0.5));
}

.timeline-item {
    position: relative;
    padding-left: 14px;
    margin-bottom: 18px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -11px;
    top: 6px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid #5d76f1;
    box-shadow: 0 6px 16px rgba(93,118,241,0.3);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

*:focus-visible {
    outline: 2px solid #5d76f1;
    outline-offset: 3px;
}

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(16px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes floating {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-8px); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.03); opacity: 0.92; }
}

@keyframes ripple {
    0% { transform: scale(0); opacity: 0.9; }
    100% { transform: scale(4); opacity: 0; }
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.fade-in-up { animation: fadeInUp 0.6s ease forwards; opacity: 0; }
.fade-in { animation: fadeIn 0.3s ease forwards; }
.slide-in-right { animation: slideInRight 0.4s ease forwards; }
.floating { animation: floating 3s ease-in-out infinite; }

@media (max-width: 960px) {
    .page-shell { padding: 24px 16px 32px; }
    .topbar-inner { padding: 12px 14px; }
    .card-grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
}

@media (max-width: 640px) {
    body { background-position: center; }
    .topbar nav a { padding: 8px 10px; }
    .glass-card, .stat { padding: 14px; }
    .btn { width: 100%; text-align: center; }
}

@media print {
    body { background: #fff; }
    .topbar { position: static; box-shadow: none; }
    .btn, .topbar nav { display: none !important; }
    .glass-card { box-shadow: none; border: 1px solid #e5e7eb; }
}
