/* =============================================================
   MyRecipes — Warm Pantry Theme
   Loaded after Bootstrap; overrides CSS custom properties.
   ============================================================= */

/* ----- Typography ----- */
:root {
    --mr-font-heading: 'Spectral', Georgia, serif;
    --mr-font-body: 'Source Sans 3', system-ui, sans-serif;
}

body {
    font-family: var(--mr-font-body);
}

h1, h2, h3, h4, h5, h6,
.display-1, .display-2, .display-3, .display-4, .display-5, .display-6 {
    font-family: var(--mr-font-heading);
}


/* =============================================================
   Light Theme
   ============================================================= */
[data-bs-theme="light"] {
    --bs-primary:                   #B5451B;
    --bs-primary-rgb:               181, 69, 27;
    --bs-body-bg:                   #FAF7F2;
    --bs-body-bg-rgb:               250, 247, 242;
    --bs-body-color:                #2D1B0E;
    --bs-body-color-rgb:            45, 27, 14;
    --bs-emphasis-color:            #1C1008;
    --bs-secondary-color:           rgba(45, 27, 14, 0.65);
    --bs-secondary-bg:              #F0EAE0;
    --bs-tertiary-bg:               #F0EAE0;
    --bs-border-color:              #E2D5C3;
    --bs-border-color-translucent:  rgba(45, 27, 14, 0.1);
    --bs-link-color:                #B5451B;
    --bs-link-color-rgb:            181, 69, 27;
    --bs-link-hover-color:          #8e3515;
    --bs-link-hover-color-rgb:      142, 53, 21;
    --mr-nav-bg:                    #2D1B0E;
    --mr-surface:                   #F0EAE0;
    --mr-accent:                    #C47A2B;
}

[data-bs-theme="light"] .card {
    --bs-card-bg:           #FFFFFF;
    --bs-card-border-color: #E2D5C3;
}

[data-bs-theme="light"] .btn-primary {
    --bs-btn-color:                 #fff;
    --bs-btn-bg:                    #B5451B;
    --bs-btn-border-color:          #B5451B;
    --bs-btn-hover-bg:              #9a3a17;
    --bs-btn-hover-border-color:    #8e3515;
    --bs-btn-active-bg:             #8e3515;
    --bs-btn-active-border-color:   #833112;
    --bs-btn-focus-shadow-rgb:      181, 69, 27;
    --bs-btn-disabled-bg:           #B5451B;
    --bs-btn-disabled-border-color: #B5451B;
}

[data-bs-theme="light"] .btn-outline-primary {
    --bs-btn-color:             #B5451B;
    --bs-btn-border-color:      #B5451B;
    --bs-btn-hover-color:       #fff;
    --bs-btn-hover-bg:          #B5451B;
    --bs-btn-hover-border-color: #B5451B;
    --bs-btn-active-color:      #fff;
    --bs-btn-active-bg:         #B5451B;
    --bs-btn-active-border-color: #B5451B;
    --bs-btn-focus-shadow-rgb:  181, 69, 27;
}

[data-bs-theme="light"] .form-control:focus,
[data-bs-theme="light"] .form-select:focus {
    border-color: #B5451B;
    box-shadow: 0 0 0 0.25rem rgba(181, 69, 27, 0.18);
}


/* =============================================================
   Dark Theme
   ============================================================= */
[data-bs-theme="dark"] {
    --bs-primary:                   #C4622D;
    --bs-primary-rgb:               196, 98, 45;
    --bs-body-bg:                   #1A1007;
    --bs-body-bg-rgb:               26, 16, 7;
    --bs-body-color:                #F0E8D8;
    --bs-body-color-rgb:            240, 232, 216;
    --bs-emphasis-color:            #FAF7F2;
    --bs-secondary-color:           rgba(240, 232, 216, 0.65);
    --bs-secondary-bg:              #2D1E0F;
    --bs-tertiary-bg:               #241507;
    --bs-border-color:              #3D2A15;
    --bs-border-color-translucent:  rgba(240, 232, 216, 0.1);
    --bs-link-color:                #D4892E;
    --bs-link-color-rgb:            212, 137, 46;
    --bs-link-hover-color:          #E8A838;
    --bs-link-hover-color-rgb:      232, 168, 56;
    --mr-nav-bg:                    #0F0805;
    --mr-surface:                   #2D1E0F;
    --mr-accent:                    #D4892E;
}

[data-bs-theme="dark"] .card {
    --bs-card-bg:           #241A0C;
    --bs-card-border-color: #3D2A15;
}

[data-bs-theme="dark"] .btn-primary {
    --bs-btn-color:                 #fff;
    --bs-btn-bg:                    #C4622D;
    --bs-btn-border-color:          #C4622D;
    --bs-btn-hover-bg:              #a85226;
    --bs-btn-hover-border-color:    #9d4d23;
    --bs-btn-active-bg:             #9d4d23;
    --bs-btn-active-border-color:   #934820;
    --bs-btn-focus-shadow-rgb:      196, 98, 45;
    --bs-btn-disabled-bg:           #C4622D;
    --bs-btn-disabled-border-color: #C4622D;
}

[data-bs-theme="dark"] .btn-outline-primary {
    --bs-btn-color:              #C4622D;
    --bs-btn-border-color:       #C4622D;
    --bs-btn-hover-color:        #fff;
    --bs-btn-hover-bg:           #C4622D;
    --bs-btn-hover-border-color: #C4622D;
    --bs-btn-active-color:       #fff;
    --bs-btn-active-bg:          #C4622D;
    --bs-btn-active-border-color: #C4622D;
    --bs-btn-focus-shadow-rgb:   196, 98, 45;
}

[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
    background-color: #241A0C;
    border-color: var(--bs-border-color);
    color: var(--bs-body-color);
}

[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus {
    background-color: #241A0C;
    border-color: #C4622D;
    box-shadow: 0 0 0 0.25rem rgba(196, 98, 45, 0.2);
    color: var(--bs-body-color);
}

[data-bs-theme="dark"] .form-control::placeholder,
[data-bs-theme="dark"] .form-select::placeholder {
    color: rgba(240, 232, 216, 0.35);
}


/* =============================================================
   Navbar — always espresso, regardless of page theme
   ============================================================= */
.site-navbar {
    background-color: var(--mr-nav-bg) !important;
    border-bottom: 1px solid rgba(240, 232, 216, 0.07);
    min-height: 58px;
    padding-top: 0;
    padding-bottom: 0;
}

.site-brand {
    font-family: var(--mr-font-heading) !important;
    font-size: 1.3rem !important;
    font-weight: 700 !important;
    letter-spacing: -0.02em;
    color: #F0E8D8 !important;
}

.site-navbar .nav-link {
    font-size: 0.9rem;
    font-family: var(--mr-font-body);
}

.site-navbar .nav-link.active {
    color: var(--mr-accent) !important;
    font-weight: 600;
}

.theme-toggle {
    color: rgba(240, 232, 216, 0.7) !important;
    font-size: 1rem;
    text-decoration: none;
}

.theme-toggle:hover {
    color: #F0E8D8 !important;
}


/* =============================================================
   Blazor-specific (preserved from template)
   ============================================================= */
h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #5F7A61;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

[data-bs-theme="dark"] .validation-message {
    color: #ff8a6b;
}

.blazor-error-boundary {
    background-color: #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}


/* =============================================================
   Auth pages (login, register, forgot-password, reset-password)
   ============================================================= */
.auth-page {
    min-height: calc(100vh - 58px);
}

.auth-card {
    width: 100%;
    max-width: 420px;
}


/* =============================================================
   Recipe card
   ============================================================= */
.recipe-card {
    display: block;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.recipe-card:hover .recipe-card-inner {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12) !important;
}

/* Landscape thumbnail — 16:9 */
.recipe-card-img {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

/* Placeholder keeps the same 16:9 height */
.recipe-card-img-placeholder {
    height: 180px;
}

.recipe-card-author:hover {
    color: var(--bs-link-color) !important;
}


/* =============================================================
   Utility — font sizes below Bootstrap's .small / .fs-6
   ============================================================= */
.fs-xs  { font-size: .75rem; }
.fs-2xs { font-size: .7rem; }
.fs-3xs { font-size: .65rem; }


/* =============================================================
   Utility — page container width constraints
   ============================================================= */
.page-narrow     { max-width: 820px; }
.tag-input-group { max-width: 320px; }


/* =============================================================
   Utility — sticky content below fixed navbar
   ============================================================= */
.sticky-below-nav { top: 72px; }


/* =============================================================
   Utility — compact form input column widths
   ============================================================= */
.col-qty  { width: 80px; }
.col-unit { width: 90px; }


/* =============================================================
   Bottom navigation bar — mobile only (hidden at md+)
   ============================================================= */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background-color: var(--mr-nav-bg);
    border-top: 1px solid rgba(240, 232, 216, 0.07);
    z-index: 1030;
    /* Respect iOS home indicator / Android gesture bar */
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: rgba(240, 232, 216, 0.5);
    text-decoration: none;
    font-size: 0.65rem;
    font-family: var(--mr-font-body);
    padding: 6px 0;
    transition: color 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.bottom-nav-item i {
    font-size: 1.25rem;
    line-height: 1;
}

.bottom-nav-item.active {
    color: var(--mr-accent);
}

.bottom-nav-item:hover,
.bottom-nav-item:focus {
    color: #F0E8D8;
}


/* =============================================================
   Mobile — push content above bottom nav and account for
   safe-area-inset so nothing is clipped by the notch/indicator
   ============================================================= */
@media (max-width: 991.98px) {
    main {
        padding-bottom: calc(68px + env(safe-area-inset-bottom, 0px));
    }

    /* Tighten page horizontal padding on narrower screens */
    .container,
    .container-fluid,
    .container-xl {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}
