/* Personal Life Dashboard — Light Theme CSS Design System */
:root {
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --bg-card-hover: #ffffff;
    --border-color: #e2e8f0;
    --border-color-glow: rgba(37, 99, 235, 0.4);
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    
    --accent-blue: #2563eb;
    --accent-green: #059669;
    --accent-purple: #7c3aed;
    --accent-amber: #d97706;
    --accent-rose: #dc2626;
    
    --font-heading: 'Outfit', -apple-system, sans-serif;
    --font-body: 'Inter', -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    
    --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.04);
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.5;
    min-height: 100vh;
    padding-bottom: 60px;
}

/* LOGIN PAGE */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: radial-gradient(circle at 50% 30%, #e2e8f0 0%, var(--bg-main) 70%);
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
}

.logo-box {
    text-align: center;
    margin-bottom: 28px;
}

.logo-icon {
    font-size: 42px;
    display: block;
    margin-bottom: 8px;
}

.logo-box h1 {
    font-family: var(--font-heading);
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.logo-box p {
    color: var(--text-secondary);
    font-size: 14px;
}

.error-alert {
    background: rgba(220, 38, 38, 0.08);
    border: 1px solid var(--accent-rose);
    color: var(--accent-rose);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 20px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-group input, .form-group select {
    width: 100%;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.btn-primary {
    width: 100%;
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    border: none;
    border-radius: var(--radius-sm);
    color: #ffffff;
    font-family: var(--font-heading);
    font-size: 15px;
    font-weight: 600;
    padding: 12px 20px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #047857 0%, #059669 100%);
}

.btn-secondary {
    background: #f1f5f9;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 500;
    padding: 10px 16px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-secondary:hover {
    background: #e2e8f0;
    border-color: var(--text-muted);
}

/* HEADER */
.app-header {
    background: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 16px 24px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    font-size: 28px;
    background: rgba(37, 99, 235, 0.08);
    padding: 8px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(37, 99, 235, 0.2);
}

.brand-text h1 {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.brand-text .subtitle {
    font-size: 13px;
    color: var(--accent-blue);
    font-weight: 600;
}

.header-actions {
    display: flex;
    gap: 12px;
}

/* DASHBOARD CONTAINER */
.dashboard-container {
    max-width: 1200px;
    margin: 32px auto 0;
    padding: 0 24px;
    display: flex;
    flex-direction: column;
    gap: 36px;
}

.dashboard-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border-color);
}

.section-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title h2 {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.section-icon {
    font-size: 22px;
}

.section-badge {
    font-size: 12px;
    color: var(--text-secondary);
    background: #f1f5f9;
    border: 1px solid var(--border-color);
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 500;
}

/* CARDS GRID & ALIGNMENT */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    align-items: stretch;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
    transition: border-color 0.2s ease, background-color 0.2s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 175px;
}

.card-top-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    min-height: 42px;
    margin-bottom: 6px;
}

.card-title-text {
    font-family: var(--font-heading);
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.35;
    flex: 1;
}

.card-middle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

/* CARD RED / GREEN HIGHLIGHT STATUS */
.card.card-behind {
    border: 1.5px solid #fca5a5;
    background-color: #fff8f8;
}

.card.card-on-track {
    border: 1.5px solid #86efac;
    background-color: #f0fdf4;
}

.val-behind {
    color: #dc2626 !important;
}

.val-ok {
    color: #059669 !important;
}

.card-status-strip {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    font-size: 11px;
    gap: 6px;
    min-height: 24px;
}

.status-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.badge-behind {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fca5a5;
}

.badge-ok {
    background: #d1fae5;
    color: #059669;
    border: 1px solid #6ee7b7;
}

.month-pace-text {
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.metric-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 12px;
    gap: 8px;
}

.metric-title-box {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    flex: 1;
    min-height: 42px;
}

.metric-name {
    font-family: var(--font-heading);
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}

.btn-trend {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 15px;
    padding: 2px;
    border-radius: 4px;
    line-height: 1;
    margin-top: 1px;
}

.btn-trend:hover {
    background: rgba(0,0,0,0.06);
}

.card-skeleton {
    height: 144px;
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

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

.metric-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.metric-counter {
    text-align: right;
    white-space: nowrap;
}

.metric-val-big {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 800;
    color: var(--text-primary);
}

.metric-target-sm {
    font-size: 12px;
    color: var(--text-secondary);
}

/* COMPACT TOP-RIGHT PLUS BUTTON */
.btn-card-plus {
    width: 28px;
    height: 28px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    color: var(--accent-blue);
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.btn-card-plus:hover {
    background: var(--accent-blue);
    color: #ffffff;
    border-color: var(--accent-blue);
}

/* PROGRESS BAR WITH IDEAL PACE MARKER */
.progress-container {
    position: relative;
    margin-top: auto;
}

.progress-track {
    height: 12px;
    background: #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    border: 1px solid #cbd5e1;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #059669 0%, #10b981 100%);
    border-radius: 6px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.progress-fill.ahead {
    background: linear-gradient(90deg, #10b981 0%, #2563eb 100%);
}

.progress-fill.behind {
    background: linear-gradient(90deg, #dc2626 0%, #f87171 100%);
}

/* Ideal Pace Vertical Marker */
.ideal-pace-line {
    position: absolute;
    top: -4px;
    bottom: -4px;
    width: 3px;
    background: #0f172a;
    box-shadow: 0 0 4px rgba(15, 23, 42, 0.5);
    z-index: 10;
    border-radius: 2px;
    pointer-events: none;
}

.ideal-pace-line::after {
    content: 'темп';
    position: absolute;
    top: -18px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 9px;
    font-weight: 700;
    color: #ffffff;
    background: #0f172a;
    border: 1px solid #334155;
    padding: 1px 4px;
    border-radius: 4px;
    text-transform: uppercase;
}

/* ACHIEVEMENTS (MAX & BOOLEAN) */
.achievement-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.boolean-card {
    cursor: pointer;
    user-select: none;
}

.boolean-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    background: #f8fafc;
    border: 1px solid var(--border-color);
    margin-top: 6px;
}

.boolean-box.done {
    background: rgba(16, 185, 129, 0.12);
    border-color: var(--accent-green);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.15);
}

.boolean-icon {
    font-size: 24px;
}

.boolean-text {
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.boolean-box.done .boolean-text {
    color: var(--accent-green);
}

/* MINI RECORD CHART STYLES */
.max-record-chart-box {
    margin-top: 6px;
}

.mini-chart-container {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 6px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mini-record-svg {
    width: 100%;
    height: 44px;
    overflow: visible;
}

.mini-chart-label {
    font-size: 10px;
    color: var(--text-muted);
    text-anchor: middle;
    text-align: center;
    font-weight: 500;
}

/* WEIGHT CHART CARD */
.weight-card {
    padding: 24px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.weight-current-display {
    display: flex;
    align-baseline: flex-end;
    gap: 4px;
}

.weight-value {
    font-family: var(--font-heading);
    font-size: 32px;
    font-weight: 800;
    color: var(--accent-blue);
}

.weight-unit {
    font-size: 14px;
    color: var(--text-secondary);
}

.chart-container {
    position: relative;
    width: 100%;
    height: 220px;
    background: #f8fafc;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    padding: 10px;
}

#weight-svg-chart {
    width: 100%;
    height: 100%;
    overflow: visible;
}

.chart-path {
    fill: none;
    stroke: var(--accent-blue);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.chart-area {
    fill: url(#weight-gradient);
    opacity: 0.2;
}

.chart-point {
    fill: #ffffff;
    stroke: var(--accent-blue);
    stroke-width: 3;
    r: 5;
    cursor: pointer;
}

.chart-point:hover {
    r: 7;
    fill: var(--accent-blue);
}

.chart-tooltip {
    position: absolute;
    background: #ffffff;
    border: 1px solid var(--accent-blue);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    pointer-events: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    z-index: 50;
    transform: translate(-50%, -120%);
}

.chart-tooltip.hidden {
    display: none;
}

/* JOURNAL TABLE */
.journal-card {
    padding: 0;
    overflow: hidden;
}

.table-responsive {
    overflow-x: auto;
}

.journal-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 14px;
}

.journal-table th {
    background: #f8fafc;
    color: var(--text-secondary);
    font-family: var(--font-heading);
    font-weight: 600;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.journal-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.journal-table tr:last-child td {
    border-bottom: none;
}

.journal-table tr:hover td {
    background: #f1f5f9;
}

.btn-delete-sm {
    background: rgba(220, 38, 38, 0.08);
    border: 1px solid rgba(220, 38, 38, 0.25);
    color: var(--accent-rose);
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
}

.btn-delete-sm:hover {
    background: var(--accent-rose);
    color: #ffffff;
}

/* MODAL */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.modal-overlay.hidden {
    display: none;
}

.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 28px;
    width: 100%;
    max-width: 460px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
}

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

.modal-header h3 {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.btn-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}
