/* Gluttire UI theme
   Purpose: establish a consistent design line (colors, spacing, typography)
   Loaded AFTER Bootstrap + existing styles.css so it can gently override.
*/

:root {
    /* Palette derived from logo.png sampling:
       - Dominant: #400000
       - Accents:  #d09020 (warm gold), #e07080 (rose)
    */
    --g-brand: #400000;
    --g-brand-2: #2f0000;
    --g-accent: #d09020;
    --g-accent-2: #e07080;

    /* Sweet / pastry surfaces */
    --g-bg: #fff7f4;
    --g-surface: #ffffff;
    --g-surface-2: #fff1ea;

    --g-text: #111827;
    --g-muted: #6b7280;
    --g-border: #e5e7eb;

    --g-radius: 16px;
    --g-radius-sm: 12px;

    --g-shadow: 0 14px 40px rgba(17, 24, 39, 0.10);
    --g-shadow-sm: 0 8px 22px rgba(17, 24, 39, 0.10);

    --g-focus: 0 0 0 0.22rem rgba(224, 112, 128, 0.20);
}

/* Base */
html, body {
    height: 100%;
}

body {
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
    background:
        radial-gradient(1200px 700px at 15% -10%, rgba(224, 112, 128, 0.16), transparent 62%),
        radial-gradient(900px 520px at 95% 0%, rgba(208, 144, 32, 0.14), transparent 58%),
        var(--g-bg);
    background-attachment: fixed;
    background-repeat: no-repeat;
    color: var(--g-text);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a {
    color: var(--g-brand);
}

a:hover {
    color: var(--g-brand-2);
}

h1, h2, h3 {
    letter-spacing: -0.01em;
}

h1 {
    font-size: 2rem;
}

/* Global page spacing */
.container {
    padding-top: 0.75rem;
    padding-bottom: 2rem;
}

/* Layout helpers */
.g-page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin: 1.25rem 0;
}

.g-page-title {
    margin: 0;
    font-weight: 800;
}

.g-subtitle {
    margin: 0.25rem 0 0;
    color: var(--g-muted);
}

/* Toolbar/actions row (Bootstrap 4 friendly, no gap utilities needed) */
.g-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

.g-actions > * {
    margin-bottom: 0.25rem;
}

.g-actions > * + * {
    margin-left: 0.5rem;
}

/* Filter bar */
.g-filterbar {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--g-border);
    border-radius: var(--g-radius);
    box-shadow: var(--g-shadow-sm);
    padding: 0.75rem;
}

.g-filterbar .form-control {
    background: rgba(255, 255, 255, 0.98);
}

/* Entries: keep material rows on a single line (desktop) */
@media (min-width: 1200px) {
    .g-entry-row {
        flex-wrap: nowrap;
        align-items: flex-start;
    }

    .g-entry-row > [class*="col-"] {
        padding-left: 0.25rem;
        padding-right: 0.25rem;
    }

    .g-entry-row .g-col-material { flex: 0 0 20%; max-width: 20%; }
    .g-entry-row .g-col-brand { flex: 0 0 10%; max-width: 10%; }
    .g-entry-row .g-col-weight { flex: 0 0 18%; max-width: 18%; }
    .g-entry-row .g-col-format { flex: 0 0 16%; max-width: 16%; }
    .g-entry-row .g-col-count { flex: 0 0 8%; max-width: 8%; }
    .g-entry-row .g-col-total { flex: 0 0 12%; max-width: 12%; }
    .g-entry-row .g-col-lot { flex: 0 0 12%; max-width: 12%; }
    .g-entry-row .g-col-expiry { flex: 0 0 14%; max-width: 14%; }
    .g-entry-row .g-col-actions { flex: 0 0 12%; max-width: 12%; }

    .g-entry-row .form-control {
        height: calc(1.5em + 0.5rem + 2px);
        padding: 0.2rem 0.45rem;
        font-size: 0.85rem;
    }

    .g-entry-row small {
        font-size: 0.68rem;
        line-height: 1.1;
        text-align: center;
    }

    .g-entry-row .g-help-stack {
        min-height: 0;
    }

    .g-entry-row .btn {
        padding: 0.2rem 0.5rem;
    }

    .g-entry-row-new .g-col-material { flex: 0 0 18%; max-width: 18%; }
    .g-entry-row-new .g-col-brand { flex: 0 0 10%; max-width: 10%; }
    .g-entry-row-new .g-col-weight { flex: 0 0 18%; max-width: 18%; }
    .g-entry-row-new .g-col-count { flex: 0 0 7%; max-width: 7%; }
    .g-entry-row-new .g-col-format { flex: 0 0 14%; max-width: 14%; }
    .g-entry-row-new .g-col-lot { flex: 0 0 9%; max-width: 9%; }
    .g-entry-row-new .g-col-expiry { flex: 0 0 14%; max-width: 14%; }
    .g-entry-row-new .g-col-actions { flex: 0 0 6%; max-width: 6%; }
}

/* Entries form: tighten card padding */
.g-entry-card-body {
    padding: 1rem 1.25rem;
}

/* Entries: widen the form container on desktop */
@media (min-width: 1200px) {
    .g-entry-container {
        max-width: 1400px;
    }
}

/* Auth (Login) */
.g-auth {
    width: 100%;
    max-width: 420px;
}

.g-auth .card {
    border-radius: 18px;
}

.g-auth .card-header {
    text-align: center;
}

.g-auth-logo {
    width: 84px;
    height: 84px;
    object-fit: contain;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.85);
    padding: 10px;
    box-shadow: 0 10px 18px rgba(17, 24, 39, 0.18);
}

.g-auth-title {
    margin: 0.75rem 0 0;
    font-weight: 900;
    letter-spacing: -0.02em;
}

.g-auth-hint {
    margin: 0.25rem 0 0;
    color: rgba(255, 255, 255, 0.88);
    font-size: 0.95rem;
}

/* Split login (desktop) */
.g-auth-split {
    width: 100%;
    max-width: 1040px;
}

.g-auth-split .card {
    border-radius: 22px;
}

.g-auth-left {
    padding: 1.25rem 1.25rem 1rem;
}

.g-auth-left .card-header {
    background: transparent;
    border-bottom: none;
    padding: 0;
    color: var(--g-text);
}

.g-auth-left .g-auth-hint {
    color: var(--g-muted);
}

.g-auth-right {
    position: relative;
    color: #fff;
    padding: 1.5rem;
    border-radius: 22px;
    overflow: hidden;
    background:
        radial-gradient(900px 520px at 20% 0%, rgba(224, 112, 128, 0.55), transparent 60%),
        radial-gradient(900px 520px at 90% 15%, rgba(208, 144, 32, 0.45), transparent 58%),
        linear-gradient(180deg, rgba(64, 0, 0, 0.96), rgba(47, 0, 0, 0.98));
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.g-auth-right::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 15% 30%, rgba(255,255,255,0.10) 0 2px, transparent 3px),
        radial-gradient(circle at 65% 70%, rgba(255,255,255,0.10) 0 2px, transparent 3px),
        radial-gradient(circle at 85% 20%, rgba(255,255,255,0.08) 0 2px, transparent 3px);
    background-size: 120px 120px;
    opacity: 0.55;
    pointer-events: none;
}

.g-auth-right > * {
    position: relative;
    z-index: 1;
}

.g-auth-right h2 {
    font-weight: 900;
    letter-spacing: -0.02em;
    margin: 0 0 0.75rem;
}

.g-auth-right p {
    color: rgba(255, 255, 255, 0.88);
    margin: 0 0 1rem;
    max-width: 38ch;
}

.g-auth-bullets {
    margin: 1.25rem 0 0;
    padding: 0;
    list-style: none;
}

.g-auth-bullets li {
    display: flex;
    gap: 0.6rem;
    align-items: flex-start;
    margin: 0.6rem 0;
    color: rgba(255, 255, 255, 0.92);
}

.g-auth-bullets .g-dot {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.14);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

@media (max-width: 991.98px) {
    .g-auth-split {
        max-width: 520px;
    }
}

/* New Login layout (OVH-like split screen) */
.g-login--ovh {
    --g-login-pad-x: clamp(1.25rem, 6vw, 5rem);
    --g-login-pad-y: 2rem;
    --g-login-pink-1: #ffe3ec;
    --g-login-pink-2: #fff1f6;
    --g-login-choco-1: #3a1b16;
    --g-login-choco-2: #2a0f0c;
}

.g-login-mobile-logo {
    display: none;
}

.g-login-mobile-logo-img {
    width: 180px;
    max-width: 60vw;
    height: auto;
    object-fit: contain;
}

.g-login {
    min-height: 100vh;
    display: flex;
    background: #fff;
}

/* OVH-like two columns */
.g-login.g-login--ovh {
    display: grid;
    grid-template-columns: 58% 42%;
    min-height: 100vh;
}

.g-login-left {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, var(--g-login-pink-1), var(--g-login-pink-2));
    padding: var(--g-login-pad-y, 2rem) var(--g-login-pad-x, 2rem);
    position: relative;
}

.g-login--ovh .g-login-topbar {
    display: flex;
    align-items: center;
    padding: 0;
    position: absolute;
    top: var(--g-login-pad-y, 2rem);
    left: var(--g-login-pad-x, 2rem);
}

.g-login--ovh .g-login-toplogo {
    width: 150px;
    max-width: 44vw;
    height: auto;
    object-fit: contain;
}

.g-login--ovh .g-login-formwrap {
    width: 100%;
    max-width: 520px;
    margin: auto;
    padding-bottom: 1rem;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(58, 27, 22, 0.12);
    border-radius: 14px;
    box-shadow: 0 18px 40px rgba(17, 24, 39, 0.10);
    padding: 1.75rem;
}

.g-login-title {
    margin: 0;
    font-weight: 800;
    letter-spacing: -0.01em;
    font-size: 1.75rem;
}

.g-login-subtitle {
    margin: 0.25rem 0 0;
    color: var(--g-muted);
}

.g-login-meta {
    margin-top: 1rem;
}

.g-login-right {
    flex: 0 0 44%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3.5rem clamp(1.75rem, 4vw, 4rem);
    color: #fff;
    position: relative;
    overflow: hidden;
    background: linear-gradient(180deg, var(--g-login-choco-1), var(--g-login-choco-2));
}

.g-login-right::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.95;
    background:
        radial-gradient(720px 420px at 80% 12%, rgba(255, 211, 155, 0.22), transparent 62%),
        radial-gradient(700px 520px at 20% 88%, rgba(255, 178, 198, 0.18), transparent 64%),
        linear-gradient(135deg, rgba(255, 255, 255, 0.10) 24%, transparent 24%) 0 0 / 220px 220px,
        linear-gradient(225deg, rgba(255, 255, 255, 0.07) 24%, transparent 24%) 0 0 / 260px 260px,
        linear-gradient(315deg, rgba(255, 255, 255, 0.05) 22%, transparent 22%) 0 0 / 320px 320px;
}

.g-login-hero {
    width: 100%;
    max-width: 520px;
    position: relative;
    z-index: 1;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.g-login-hero-logo {
    width: 240px;
    max-width: 70%;
    height: auto;
    object-fit: contain;
    margin: 0 0 1.75rem;
    filter: drop-shadow(0 18px 38px rgba(0, 0, 0, 0.45));
}

.g-login-hero h2 {
    font-weight: 900;
    letter-spacing: -0.02em;
    font-size: 2.25rem;
    margin: 0 0 1rem;
}

.g-login-hero p {
    margin: 0 0 1.25rem;
    color: rgba(255, 255, 255, 0.90);
    max-width: 48ch;
}

.g-login-hero-text {
    font-size: 1.25rem;
    line-height: 1.6;
    max-width: 40ch;
    margin: 0;
}

.g-login--ovh .form-control {
    height: calc(1.5em + 0.95rem + 2px);
    border-radius: 0.35rem;
}

.g-login--ovh .form-control:focus {
    border-color: rgba(64, 0, 0, 0.40);
    box-shadow: 0 0 0 0.18rem rgba(208, 144, 32, 0.18);
}

.g-login-features {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    margin-top: 1rem;
}

.g-login-feature {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0.9rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.12);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.g-login-badge {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.16);
}

@media (max-width: 991.98px) {
    .g-login {
        display: block;
        min-height: 100vh;
        background: linear-gradient(180deg, var(--g-login-pink-1), var(--g-login-pink-2));
    }

    .g-login.g-login--ovh {
        display: block;
    }
    .g-login-left {
        padding: 2rem 1rem;
        min-height: 100vh;
    }

    .g-login-mobile-logo {
        display: flex;
        justify-content: center;
        padding: 0.5rem 0 1.25rem;
    }

    .g-login--ovh .g-login-formwrap {
        margin: 0 auto;
    }

    .g-login--ovh .g-login-right {
        display: none;
    }
}

/* Navbar */
.navbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    background: linear-gradient(180deg, rgba(64, 0, 0, 0.96), rgba(47, 0, 0, 0.96));
    box-shadow: var(--g-shadow-sm);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.navbar .navbar-brand {
    font-weight: 800;
    letter-spacing: 0.2px;
}

.navbar .navbar-brand,
.navbar .nav-link {
    color: #fff !important;
}

.navbar .nav-link {
    opacity: 0.92;
    transition: opacity 120ms ease, transform 140ms ease;
}

.navbar .nav-link:hover {
    opacity: 1;
    transform: translateY(-1px);
    color: #fff !important;
}

.navbar .nav-link.active {
    opacity: 1;
    position: relative;
}

.navbar .nav-link.active::after {
    content: "";
    position: absolute;
    left: 0.5rem;
    right: 0.5rem;
    bottom: 0.25rem;
    height: 2px;
    background: linear-gradient(90deg, var(--g-accent), var(--g-accent-2));
    border-radius: 2px;
}

.navbar-toggler {
    border-color: rgba(255, 255, 255, 0.25) !important;
}

.dropdown-menu {
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid var(--g-border);
    border-radius: var(--g-radius-sm);
    box-shadow: var(--g-shadow-sm);
    padding: 0.5rem;
}

.dropdown-item {
    border-radius: 8px;
    color: var(--g-text) !important;
}

.dropdown-item:hover,
.dropdown-item:focus {
    background: rgba(224, 112, 128, 0.12) !important;
    color: var(--g-text) !important;
}

/* Cards */
.card {
    border: 1px solid var(--g-border);
    border-radius: var(--g-radius);
    box-shadow: var(--g-shadow-sm);
    overflow: hidden;
}

.card-header {
    background: linear-gradient(180deg, rgba(64, 0, 0, 0.92), rgba(47, 0, 0, 0.92));
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

/* Recipes collapsible list */
.g-recipe-toggle {
    text-decoration: none !important;
    font-weight: 800;
    letter-spacing: -0.01em;
    text-align: left;
}

#recipe-list .card {
    box-shadow: 0 8px 22px rgba(17, 24, 39, 0.08);
}

#recipe-list .card-header {
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
}

.g-recipe-toggle:focus {
    outline: none;
    box-shadow: var(--g-focus);
    border-radius: 10px;
}

.g-recipe-toggle i {
    transition: transform 160ms ease;
}

.g-recipe-toggle[aria-expanded="true"] i {
    transform: rotate(180deg);
}

/* Buttons */
.btn {
    border-radius: 14px;
    font-weight: 700;
    letter-spacing: 0.1px;
    transition: transform 140ms ease, box-shadow 140ms ease, background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

.btn:focus {
    box-shadow: var(--g-focus) !important;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 26px rgba(17, 24, 39, 0.14);
}

.btn-primary {
    background-color: var(--g-brand);
    border-color: var(--g-brand);
}

.btn-primary:hover {
    background-color: var(--g-accent);
    border-color: var(--g-accent);
    color: #2a1b00;
}

.btn-warning {
    background-color: rgba(224, 112, 128, 0.92);
    border-color: rgba(224, 112, 128, 0.92);
    color: #3a0a18;
}

.btn-warning:hover {
    background-color: var(--g-accent-2);
    border-color: var(--g-accent-2);
}

.btn-danger {
    background-color: #900000;
    border-color: #900000;
}

/* Forms */
label {
    font-weight: 700;
    color: var(--g-text);
}

.form-control {
    border: 1px solid rgba(17, 24, 39, 0.18);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.95);
}

.form-control:focus {
    border-color: rgba(224, 112, 128, 0.55);
    box-shadow: var(--g-focus);
}

/* Tables */
.table {
    background: var(--g-surface);
    border: 1px solid var(--g-border);
    border-radius: var(--g-radius);
    overflow: hidden;
}

.table thead th {
    background: linear-gradient(180deg, rgba(64, 0, 0, 0.92), rgba(47, 0, 0, 0.92));
    color: #fff;
    border-bottom: none;
}

.table tbody tr:hover {
    background-color: rgba(208, 144, 32, 0.12);
    color: inherit;
}

.pagination .page-item.active .page-link {
    background-color: var(--g-brand);
    border-color: var(--g-brand);
}

/* Lists (recipes ingredients) */
.list-group-item {
    border-color: var(--g-border);
}

/* Footer */
.footer {
    border-top: 1px solid var(--g-border);
    background: var(--g-surface);
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
}
