/*
 * Bella AI — shared application chrome (header, nav, dashboard, base layout).
 * Ported from the approved bella-templates plugin's [bella_dashboard] shortcode
 * styling (bella-templates/assets/bella-templates.css) so the standalone app
 * matches existing approved visual language rather than inventing a new one.
 */

*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f4f5f7;
    color: #1f2937;
    overflow-x: hidden;
}

img { max-width: 100%; height: auto; }

a { color: #6d28d9; }

/* ---------------------------------------------------------------------
   App header / top nav — consistent across every /app page
   --------------------------------------------------------------------- */

.bella-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    padding: 14px 20px;
    background: #1e1b4b;
    color: #fff;
}

.bella-header__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 1.15rem;
    text-decoration: none;
    color: #fff;
}

.bella-header__brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: #6d28d9;
    font-size: 1rem;
}

.bella-header__right {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.bella-header__user {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #e5e7eb;
}

.bella-header__username {
    font-weight: 700;
    color: #fff;
}

.bella-role-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    background: #4338ca;
    color: #fff;
}

.bella-role-badge--owner { background: #b91c4a; }
.bella-role-badge--admin { background: #0369a1; }

.bella-header__logout {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0 14px;
    border-radius: 8px;
    background: rgba(255,255,255,0.12);
    color: #fff;
    font-weight: 600;
    font-size: 0.88rem;
    text-decoration: none;
    border: 1px solid rgba(255,255,255,0.25);
    cursor: pointer;
}

.bella-header__logout:hover { background: rgba(255,255,255,0.22); }

.bella-header__back {
    color: #e5e7eb;
    text-decoration: none;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 44px;
}
.bella-header__back:hover { color: #fff; }

.bella-main {
    max-width: 1080px;
    margin: 0 auto;
    padding: 24px 20px 60px;
}

/* ---------------------------------------------------------------------
   Dashboard grid (ported from the plugin's [bella_dashboard] component)
   --------------------------------------------------------------------- */

.bella-dashboard__intro {
    margin: 0 0 24px;
    color: #4b5563;
    font-size: 1rem;
}

.bella-dashboard__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
}

.bella-dashboard__card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 28px 24px;
    border-radius: 14px;
    background: #fff;
    border: 2px solid transparent;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
    cursor: pointer;
    min-height: 170px;
    border-left: 5px solid var(--card-accent, #6d28d9);
}

.bella-dashboard__card:hover,
.bella-dashboard__card:focus-visible {
    box-shadow: 0 6px 24px rgba(0,0,0,0.15);
    transform: translateY(-3px);
    border-color: var(--card-accent, #6d28d9);
    text-decoration: none;
    color: inherit;
    outline: none;
}

.bella-dashboard__card-icon {
    font-size: 2rem;
    margin-bottom: 10px;
    line-height: 1;
}

.bella-dashboard__card-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0 0 6px 0;
    color: var(--card-accent, #1e1b4b);
}

.bella-dashboard__card-desc {
    font-size: 0.88rem;
    color: #4b5563;
    margin: 0;
    flex-grow: 1;
    line-height: 1.5;
}

.bella-dashboard__card-arrow {
    margin-top: 14px;
    font-size: 1.2rem;
    color: var(--card-accent, #6d28d9);
    font-weight: 700;
    align-self: flex-end;
}

@media (max-width: 500px) {
    .bella-dashboard__grid { grid-template-columns: 1fr; }
    .bella-dashboard__card { padding: 20px 18px; }
}

/* ---------------------------------------------------------------------
   Login card
   --------------------------------------------------------------------- */

.bella-login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.bella-login-card {
    width: 100%;
    max-width: 380px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.12);
    padding: 32px 28px;
}

.bella-login-card__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 1.3rem;
    color: #1e1b4b;
    margin: 0 0 6px;
}

.bella-login-card__brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: #6d28d9;
    color: #fff;
    font-size: 1rem;
}

.bella-login-card__subtitle {
    margin: 0 0 24px;
    color: #6b7280;
    font-size: 0.9rem;
}

.bella-field { margin-bottom: 16px; }
.bella-field label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.88rem;
    color: #374151;
}
.bella-field input {
    width: 100%;
    padding: 10px 12px;
    font-size: 1rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    min-height: 44px;
}
.bella-field input:focus {
    outline: 2px solid #6d28d9;
    outline-offset: 1px;
    border-color: #6d28d9;
}

.bella-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    min-width: 44px;
    padding: 0 18px;
    border-radius: 8px;
    border: none;
    background: #6d28d9;
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
}
.bella-btn:hover { background: #5b21b6; }
.bella-btn:disabled { background: #a78bfa; cursor: wait; opacity: 0.8; }
.bella-btn--block { width: 100%; }
.bella-btn--secondary { background: #fff; color: #6d28d9; border: 1px solid #6d28d9; }
.bella-btn--secondary:hover { background: #f5f3ff; }

.bella-alert {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.88rem;
    margin: 0 0 14px;
}
.bella-alert--error { background: #fdeaea; color: #8a1f1f; border: 1px solid #f0c0c0; }
.bella-alert--warn { background: #fff8ec; color: #8a6d1b; border: 1px solid #f0d9b5; }
.bella-alert--ok { background: #f0fdf4; color: #14532d; border: 1px solid #bbf7d0; }

/* ---------------------------------------------------------------------
   Global touch-target + overflow fixes (desktop + iPad)
   --------------------------------------------------------------------- */

button, [type="submit"], [type="button"], [type="reset"], a.bella-btn {
    min-height: 44px;
}

:focus-visible {
    outline: 2px solid #6d28d9;
    outline-offset: 2px;
}
