/* Klarweg Journaling App */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600;700&family=DM+Serif+Display&display=swap');

:root {
    --green: #1D9E75;
    --green-light: #e8f5f0;
    --green-dark: #167a5b;
    --bg: #f8f9fa;
    --white: #ffffff;
    --text: #1f1e1d;
    --text-secondary: #737268;
    --text-muted: #a0a0a0;
    --border: #e2e2e0;
    --border-light: #f0f0ee;
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.05), 0 2px 4px rgba(0,0,0,0.04);
    --radius: 12px;
    --radius-sm: 8px;
}

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

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

h1, h2, h3 {
    font-family: 'DM Serif Display', serif;
    font-weight: 400;
}

/* Header / Navigation */
.header {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text);
}

.header-logo svg,
.header-logo img {
    height: 36px;
    width: auto;
}

.header-logo span {
    font-family: 'DM Serif Display', serif;
    font-size: 22px;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-nav a {
    text-decoration: none;
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.header-nav a:hover,
.header-nav a.active {
    color: var(--green);
    background: var(--green-light);
}

.header-nav .nav-user {
    margin-left: 16px;
    padding-left: 16px;
    border-left: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-nav .nav-user span {
    font-size: 13px;
    color: var(--text-muted);
}

.header-nav .btn-logout {
    color: var(--text-muted);
    font-size: 13px;
}

/* Mobile nav toggle */
.nav-toggle { display: none; }

/* Main content */
.main {
    max-width: 900px;
    margin: 0 auto;
    padding: 32px 24px;
}

.main-wide {
    max-width: 1100px;
}

/* Cards */
.card {
    background: var(--white);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 32px;
    margin-bottom: 24px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-light);
}

.card-header h2 {
    font-size: 24px;
    color: var(--text);
}

.card-header .badge {
    background: var(--green-light);
    color: var(--green);
    font-size: 13px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
}

/* Section dividers in journal */
.section-title {
    font-family: 'DM Serif Display', serif;
    font-size: 20px;
    color: var(--green);
    margin: 32px 0 20px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--green-light);
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title:first-child {
    margin-top: 0;
}

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

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

.form-group .hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: 'DM Sans', sans-serif;
    font-size: 15px;
    color: var(--text);
    background: var(--white);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(29, 158, 117, 0.1);
}

textarea.form-control {
    min-height: 80px;
    resize: vertical;
}

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

.form-row-3 {
    grid-template-columns: 1fr 1fr 1fr;
}

.form-row-4 {
    grid-template-columns: 1fr 1fr 1fr 1fr;
}

/* Numbered inputs (for Dankbarkeit 1-4) */
.numbered-inputs {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.numbered-input {
    display: flex;
    align-items: center;
    gap: 8px;
}

.numbered-input .num {
    font-weight: 600;
    font-size: 14px;
    color: var(--green);
    min-width: 20px;
}

.numbered-input .form-control {
    flex: 1;
}

/* Checkbox */
.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.form-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--green);
    cursor: pointer;
}

.form-check label {
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    margin-bottom: 0;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'DM Sans', sans-serif;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: var(--green);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--green-dark);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--green-light);
    color: var(--green);
}

.btn-secondary:hover {
    background: #d4ede4;
}

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-outline:hover {
    border-color: var(--green);
    color: var(--green);
}

.btn-danger {
    background: #fee;
    color: #c00;
    border: 1px solid #fcc;
}

.btn-danger:hover {
    background: #fdd;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border-light);
}

/* Auth pages */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--bg);
}

.auth-card {
    background: var(--white);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    padding: 48px 40px;
    width: 100%;
    max-width: 440px;
}

.auth-logo {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo svg,
.auth-logo img {
    height: 60px;
    width: auto;
    margin-bottom: 8px;
}

.auth-logo h1 {
    font-size: 28px;
    color: var(--text);
}

.auth-logo p {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 14px;
    color: var(--text-secondary);
}

.auth-footer a {
    color: var(--green);
    text-decoration: none;
    font-weight: 500;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 20px;
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

/* Dashboard */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
}

.stat-card .stat-value {
    font-family: 'DM Serif Display', serif;
    font-size: 36px;
    color: var(--green);
}

.stat-card .stat-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

.quick-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 32px;
}

.quick-action {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
    transition: all 0.2s;
    box-shadow: var(--shadow);
}

.quick-action:hover {
    border-color: var(--green);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.quick-action .icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--green-light);
    color: var(--green);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.quick-action .label {
    font-weight: 600;
    font-size: 15px;
}

.quick-action .sublabel {
    font-size: 13px;
    color: var(--text-muted);
}

/* Calendar grid */
.calendar-month {
    margin-bottom: 24px;
}

.calendar-month h3 {
    font-size: 16px;
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.calendar-day {
    aspect-ratio: 1;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid transparent;
}

.calendar-day.empty {
    background: transparent;
}

.calendar-day.no-entry {
    background: var(--border-light);
    color: var(--text-muted);
}

.calendar-day.has-entry {
    background: var(--green-light);
    color: var(--green);
    font-weight: 600;
}

.calendar-day.today {
    border-color: var(--green);
}

.calendar-day.has-entry.today {
    background: var(--green);
    color: var(--white);
}

/* History page */
.filter-bar {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.filter-bar select,
.filter-bar input {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    background: var(--white);
}

.entry-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.entry-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text);
    transition: all 0.2s;
}

.entry-item:hover {
    border-color: var(--green);
    box-shadow: var(--shadow);
}

.entry-item .entry-date {
    font-weight: 600;
}

.entry-item .entry-type {
    font-size: 12px;
    padding: 2px 10px;
    border-radius: 12px;
    font-weight: 500;
}

.entry-type.daily {
    background: #e0f2fe;
    color: #0369a1;
}

.entry-type.weekly {
    background: var(--green-light);
    color: var(--green);
}

.entry-item .entry-preview {
    font-size: 13px;
    color: var(--text-muted);
    flex: 1;
    margin: 0 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Toast notification */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 14px 24px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-md);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.success {
    background: var(--green);
    color: var(--white);
}

.toast.error {
    background: #dc2626;
    color: var(--white);
}

/* Responsive */
@media (max-width: 768px) {
    .header { padding: 0 16px; }

    .header-nav {
        position: fixed;
        top: 64px;
        left: 0;
        right: 0;
        background: var(--white);
        border-bottom: 1px solid var(--border);
        flex-direction: column;
        padding: 16px;
        display: none;
        box-shadow: var(--shadow-md);
    }

    .header-nav.open { display: flex; }

    .header-nav .nav-user {
        margin-left: 0;
        padding-left: 0;
        border-left: none;
        padding-top: 12px;
        border-top: 1px solid var(--border);
    }

    .nav-toggle {
        display: block;
        background: none;
        border: none;
        font-size: 24px;
        cursor: pointer;
        color: var(--text);
        padding: 4px;
    }

    .main { padding: 20px 16px; }
    .card { padding: 20px; }
    .auth-card { padding: 32px 24px; }

    .dashboard-grid,
    .quick-actions {
        grid-template-columns: 1fr;
    }

    .form-row,
    .form-row-3,
    .form-row-4 {
        grid-template-columns: 1fr;
    }

    .form-actions {
        flex-direction: column;
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }
}

/* Print styles */
@media print {
    .header, .form-actions, .btn { display: none; }
    .card { border: none; box-shadow: none; padding: 0; }
}
