/* ============================================================
   DESIGN TOKENS
   Breakpoints: --sm 480px | --md 768px | --lg 1024px
   ============================================================ */
:root {
    /* Brand colors */
    --c-blue:        #3b9eff;
    --c-blue-dark:   #1a7aff;

    /* Surfaces */
    --c-bg-app:      #f4f6f9;
    --c-surface:     #ffffff;
    --c-surface-sub: #fafbfc;
    --c-bg-dark:     #0f172a;

    /* Text */
    --c-text:        #1a1d23;
    --c-text-muted:  #6b7280;
    --c-text-faint:  #94a3b8;

    /* Borders */
    --c-border:      #e2e8f0;
    --c-border-sub:  #f0f2f5;

    /* Spacing */
    --page-px:       2rem;
    --page-py:       1.5rem;
    --card-p:        1.6rem;

    /* Shape */
    --r-card:        16px;
    --r-btn:         10px;

    /* Shadow */
    --shadow-card:   0 2px 10px rgba(0,0,0,0.06);
    --shadow-hover:  0 8px 24px rgba(0,0,0,0.1);

    /* Font */
    --font:          'Segoe UI', Helvetica, Arial, sans-serif;
}

html, body {
    font-family: var(--font);
    margin: 0;
    padding: 0;
}

a, .btn-link { color: var(--c-blue-dark); }

.content { padding-top: 1.1rem; }
h1:focus { outline: none; }

.valid.modified:not([type=checkbox]) { outline: 1px solid #26b050; }
.invalid { outline: 1px solid #e50000; }
.validation-message { color: #e50000; }

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}
.blazor-error-boundary::after { content: "Ein Fehler ist aufgetreten." }

/* ============================================================
   AUTH PAGES  (Login, Register, ForgotPassword, etc.)
   ============================================================ */

.auth-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 60%, #0f172a 100%);
    padding: 2rem 1rem;
    font-family: 'Segoe UI', sans-serif;
}

.auth-brand { text-align: center; color: #fff; }

.brand-logo {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    filter: drop-shadow(0 4px 16px rgba(59,158,255,0.5));
    display: block;
}

.brand-title {
    font-size: 2rem;
    font-weight: 800;
    margin: 0 0 0.4rem 0;
    background: linear-gradient(135deg, #fff, #a5c8ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.brand-sub {
    font-size: 0.9rem;
    color: #94a3b8;
    margin: 0;
}

.auth-card {
    background: #fff;
    border-radius: 20px;
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 24px 64px rgba(0,0,0,0.4);
}

.auth-heading {
    font-size: 1.4rem;
    font-weight: 800;
    color: #1a1d23;
    margin: 0 0 0.3rem 0;
}

.auth-sub {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 0 0 1.6rem 0;
}

.auth-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    margin-bottom: 1.2rem;
}

.auth-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #16a34a;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    margin-bottom: 1.2rem;
}

.auth-info {
    text-align: center;
    color: #4a5568;
    font-size: 0.9rem;
    line-height: 1.6;
    margin: 0.5rem 0 1.2rem 0;
}

.field-group {
    margin-bottom: 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.field-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #374151;
}

.field-input {
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    padding: 0.7rem 1rem;
    font-size: 0.9rem;
    color: #1a1d23;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    background: #fafbfc;
    width: 100%;
    box-sizing: border-box;
}

.field-input:focus {
    border-color: #3b9eff;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(59,158,255,0.12);
}

.field-error { font-size: 0.8rem; color: #dc2626; }

.remember-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.4rem;
}

.remember-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #4a5568;
    cursor: pointer;
}

.remember-check {
    width: 16px;
    height: 16px;
    accent-color: #1a7aff;
    cursor: pointer;
}

.forgot-link {
    font-size: 0.875rem;
    color: #1a7aff;
    text-decoration: none;
    font-weight: 500;
}
.forgot-link:hover { text-decoration: underline; }

.btn-auth {
    width: 100%;
    padding: 0.8rem;
    background: linear-gradient(135deg, #3b9eff, #1a7aff);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.15s;
    letter-spacing: 0.02em;
    margin-top: 0.2rem;
}
.btn-auth:hover { opacity: 0.92; transform: translateY(-1px); }
.btn-auth:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.auth-divider {
    text-align: center;
    margin: 1.4rem 0 1rem;
    position: relative;
    color: #9ca3af;
    font-size: 0.8rem;
}
.auth-divider::before, .auth-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 42%;
    height: 1px;
    background: #e5e7eb;
}
.auth-divider::before { left: 0; }
.auth-divider::after  { right: 0; }

.auth-switch {
    text-align: center;
    font-size: 0.875rem;
    color: #6b7280;
    margin: 0;
}

.auth-back-link {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.875rem;
    color: #1a7aff;
    text-decoration: none;
    font-weight: 500;
    margin-top: 1.2rem;
    justify-content: center;
}
.auth-back-link:hover { text-decoration: underline; }

.switch-link {
    color: #1a7aff;
    font-weight: 600;
    text-decoration: none;
    margin-left: 0.25rem;
}
.switch-link:hover { text-decoration: underline; }

/* ============================================================
   SETTINGS / MANAGE PAGES
   ============================================================ */

.settings-page {
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    display: flex;
    gap: 1.5rem;
    font-family: 'Segoe UI', sans-serif;
    align-items: flex-start;
}

.settings-sidebar {
    width: 220px;
    flex-shrink: 0;
    background: #fff;
    border-radius: 16px;
    padding: 1rem 0.75rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}

.settings-sidebar-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #9ca3af;
    padding: 0.25rem 0.75rem 0.75rem;
}

.settings-nav-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #4a5568;
    text-decoration: none;
    transition: background 0.12s, color 0.12s;
    margin-bottom: 0.15rem;
}
.settings-nav-link:hover { background: #f4f6f9; color: #1a1d23; }
.settings-nav-link.active { background: #e8f1ff; color: #1a7aff; font-weight: 600; }

.settings-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    min-width: 0;
}

.settings-card {
    background: #fff;
    border-radius: 16px;
    padding: 1.6rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}

.settings-card-title {
    font-size: 1rem;
    font-weight: 700;
    color: #1a1d23;
    margin: 0 0 0.2rem;
}

.settings-card-sub {
    font-size: 0.85rem;
    color: #6b7280;
    margin: 0 0 1.4rem;
}

.settings-message-ok {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #16a34a;
    border-radius: 10px;
    padding: 0.7rem 1rem;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.settings-message-err {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    border-radius: 10px;
    padding: 0.7rem 1rem;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.settings-warning {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
    border-radius: 10px;
    padding: 0.8rem 1rem;
    font-size: 0.875rem;
    margin-bottom: 1.2rem;
    display: flex;
    gap: 0.6rem;
    align-items: flex-start;
}

.btn-settings {
    padding: 0.65rem 1.4rem;
    background: linear-gradient(135deg, #3b9eff, #1a7aff);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.15s;
}
.btn-settings:hover { opacity: 0.9; transform: translateY(-1px); }

.btn-settings-danger {
    padding: 0.65rem 1.4rem;
    background: #ef4444;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
}
.btn-settings-danger:hover { opacity: 0.88; }

.btn-settings-ghost {
    padding: 0.55rem 1rem;
    background: none;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #4a5568;
    cursor: pointer;
    transition: background 0.12s;
}
.btn-settings-ghost:hover { background: #f4f6f9; }

.member-row {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0.7rem 0.9rem;
    border-radius: 10px;
    border: 1px solid #f0f2f5;
    background: #fafbfc;
    margin-bottom: 0.5rem;
}
.member-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b9eff, #a855f7);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
    flex-shrink: 0;
}
.member-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.1rem; }
.member-email { font-size: 0.88rem; font-weight: 600; color: #1a1d23; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-label { font-size: 0.75rem; color: #6b7280; }

.badge-you {
    font-size: 0.7rem;
    font-weight: 600;
    background: #e8f1ff;
    color: #1a7aff;
    border-radius: 20px;
    padding: 0.15rem 0.55rem;
    margin-left: 0.4rem;
}

/* ============================================================
   HAUSHALT-META ROW  (settings header with icon + name + action button)
   ============================================================ */

.house-meta-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.house-meta-row > .btn-settings-ghost {
    margin-left: auto;
    text-decoration: none;
    flex-shrink: 0;
}

/* ============================================================
   RESPONSIVE — AUTH PAGES  (≤ 768px tablet, ≤ 480px mobile)
   ============================================================ */

@media (max-width: 768px) {
    .auth-page {
        padding: 1.5rem 1rem;
        gap: 1.5rem;
    }
    .auth-card {
        padding: 2rem 1.5rem;
    }
    .brand-title {
        font-size: 1.75rem;
    }
}

@media (max-width: 480px) {
    .auth-page {
        padding: 1.25rem 0.75rem;
        gap: 1.25rem;
    }
    .auth-card {
        padding: 1.6rem 1.25rem;
        border-radius: 16px;
    }
    .brand-title {
        font-size: 1.5rem;
    }
    .brand-sub {
        font-size: 0.82rem;
    }
    /* Prevent iOS from zooming inputs smaller than 16px */
    .field-input {
        font-size: 1rem;
    }
}

/* ============================================================
   RESPONSIVE — SETTINGS PAGE  (≤ 768px)
   ============================================================ */

@media (max-width: 768px) {
    .settings-page {
        flex-direction: column;
        padding: 1.25rem 1rem;
        gap: 1rem;
    }
    .settings-sidebar {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .settings-page {
        padding: 1rem 0.75rem;
    }
    .settings-card {
        padding: 1.2rem 1rem;
    }
    /* Haushalt-header: stack vertically on small screens */
    .house-meta-row {
        flex-direction: column;
        align-items: flex-start;
    }
    .house-meta-row > .btn-settings-ghost {
        margin-left: 0;
        align-self: stretch;
        text-align: center;
    }
    /* Member rows: truncate email on tiny screens */
    .member-row {
        padding: 0.65rem 0.75rem;
        gap: 0.6rem;
    }
}
