/* ========================================
   FONTS
   ======================================== */
@font-face {
    font-family: 'Noteworthy';
    src: url('/assets/fonts/Noteworthy.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Nunito';
    src: url('/assets/fonts/Nunito/Nunito-VariableFont_wght.ttf') format('truetype');
    font-weight: 200 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Nunito';
    src: url('/assets/fonts/Nunito/Nunito-Italic-VariableFont_wght.ttf') format('truetype');
    font-weight: 200 900;
    font-style: italic;
    font-display: swap;
}

/* ========================================
   CSS VARIABLEN
   ======================================== */
:root {
    --bg-hell: #ECBE92;
    --text-main: #2C3843;
    --text-main-lighter: #2d495f;
    --primary-btn: #F98313;
    --primary-btn-hover: #d86f0f;
    --text-white: #ffffff;

    /* Breakpoints als Referenz (nicht direkt in CSS nutzbar) */
    /* Mobile: < 500px */
    /* Tablet: 500px - 1023px */
    /* Desktop: >= 1024px */
}

/* ========================================
   BASE STYLES
   ======================================== */
html {
    height: 100%;
}

body {
    background-color: var(--bg-hell);
    color: var(--text-main);
    font-family: 'Nunito', sans-serif;
    min-height: 100%;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

h1, h2 {
    font-family: 'Noteworthy', cursive;
}

/* ========================================
   LAYOUT - Container
   ======================================== */
.container,
.container-fluid,
.container-xxl {
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
}

@media (min-width: 500px) {
    .container,
    .container-fluid,
    .container-xxl {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

/* ========================================
   NAVBAR
   ======================================== */
.navbar,
.navbar-brand,
.nav-link {
    font-family: 'Noteworthy', cursive;
    font-size: 1.05rem;
}

.navbar-toggler {
    border: none;
    padding: 0.25rem 0.5rem;
    background: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.navbar-toggler:hover,
.navbar-toggler:focus,
.navbar-toggler:active {
    background: none;
    border: none;
    box-shadow: none;
    outline: none;
}

.navbar-toggler .menu-open,
.navbar-toggler .menu-close {
    width: 40px;
    height: 32px;
    pointer-events: none;
}

.navbar-toggler .menu-open rect,
.navbar-toggler .menu-close rect {
    fill: #F2A935;
}

.navbar-toggler .menu-open { display: block; }
.navbar-toggler .menu-close { display: none; }
.navbar-toggler[aria-expanded="true"] .menu-open { display: none; }
.navbar-toggler[aria-expanded="true"] .menu-close { display: block; }

/* Desktop Navbar (>= 1024px) */
@media (min-width: 1024px) {
    .navbar {
        padding: 0.5rem 0;
    }

    .navbar > .container {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .navbar-brand {
        display: flex;
        align-items: center;
    }

    .navbar-toggler {
        display: none !important;
    }

    .navbar-collapse {
        display: flex !important;
        align-items: center;
        position: static;
        width: auto;
        height: auto;
        background: none;
        padding: 0;
        flex-basis: auto;
        flex-grow: 0;
    }

    .navbar-nav {
        flex-direction: row;
        align-items: center;
        gap: 0.5rem;
        margin: 0;
    }

    .nav-item {
        margin-bottom: 0;
    }

    .nav-link {
        color: #fff !important;
        padding: 0.5rem 0.75rem;
    }

    /* Dropdown als Overlay */
    .nav-item.dropdown {
        position: relative;
    }

    .nav-item.dropdown .dropdown-menu {
        position: absolute;
        top: 100%;
        right: 0;
        margin-top: 0.5rem;
    }
}

/* Mobile & Tablet Navbar (< 1024px) */
@media (max-width: 1023px) {
    .navbar {
        position: relative;
        z-index: 1060;
        min-height: 80px;
    }

    .navbar > .container {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .navbar-collapse {
        position: fixed;
        top: 80px;
        right: -66.66%;
        width: 66.66%;
        height: calc(100vh - 80px) !important;
        background-color: rgba(242, 169, 53, 0.85);
        backdrop-filter: blur(0.5em);
        -webkit-backdrop-filter: blur(0.5em);
        padding: 1.5rem 1rem;
        z-index: 1050;
        overflow-y: auto;
        display: block !important;
        transition: right 0.25s ease-out;
    }

    .navbar-collapse:not(.show) {
        pointer-events: none;
    }

    .navbar-collapse.show {
        right: 0;
        pointer-events: auto;
    }

    .navbar-collapse.collapsing {
        right: -66.66%;
        transition: right 0.25s ease-out;
    }

    .navbar-nav { margin-top: 0.5rem; }
    .nav-item { margin-bottom: 0.75rem; }

    .nav-link {
        color: var(--text-main) !important;
        font-size: 1.1rem;
        padding: 0.5rem 0.75rem;
    }
}

/* Mobile spezifisch (< 500px) */
@media (max-width: 499px) {
    .navbar { min-height: 70px; }

    .navbar-brand img { height: 40px !important; }

    .navbar-collapse {
        top: 70px;
        width: 80%;
        right: -80%;
        height: calc(100vh - 70px) !important;
    }

    .navbar-collapse.collapsing {
        right: -80%;
    }
}

/* ========================================
   HEADER
   ======================================== */
.bg-header {
    background-color: var(--text-main) !important;
}

.food-header {
    background-color: var(--bg-hell);
    z-index: 1020;
}

/* ========================================
   HERO SECTION
   ======================================== */
.hero-section {
    padding: 1rem 0;
    text-align: center;
}

.hero-flex {
    flex-direction: row;
    gap: 2rem;
    justify-content: center;
}

.hero-img {
    width: 320px;
    height: 320px;
    object-fit: cover;
    border-radius: 50%;
}

.hero-flex h1 {
    font-size: 2.5rem;
    line-height: 1.2;
}

/* Desktop (>= 1024px) */
@media (min-width: 1024px) {
    .hero-flex h1 {
        font-size: 3rem;
    }

    .hero-flex p {
        font-size: 1.25rem;
    }
}

/* Tablet (500px - 1023px) */
@media (min-width: 500px) and (max-width: 1023px) {
    .hero-img {
        width: 220px;
        height: 220px;
    }

    .hero-flex h1 {
        font-size: 1.85rem;
    }

    .hero-flex {
        gap: 1.5rem;
    }
}

/* Mobile (< 500px) */
@media (max-width: 499px) {
    .hero-section {
        margin-bottom: 0.5rem !important;
    }

    .hero-flex {
        flex-direction: column !important;
        text-align: center;
        gap: 1rem;
    }

    .hero-flex > div {
        width: 100%;
    }

    .hero-img {
        width: 160px;
        height: 160px;
    }

    .hero-flex h1 {
        font-size: 1.5rem;
    }

    .hero-flex p {
        font-size: 0.95rem !important;
    }
}

/* ========================================
   HOMEPAGE SEARCH
   ======================================== */
.search-section {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 1rem;
}

.search-form .search-group {
    max-width: 100%;
}

/* Desktop - Suchleiste so breit wie Hero */
@media (min-width: 1024px) {
    .search-section {
        max-width: 720px;
    }

    .search-section .search-input {
        padding: 0.75rem 1rem;
        font-size: 1.1rem;
    }

    .search-section .search-icon {
        padding: 0 1rem;
    }

    .search-section .search-icon i {
        font-size: 1.6rem;
    }
}

/* Tablet */
@media (min-width: 500px) and (max-width: 1023px) {
    .search-section {
        max-width: 500px;
    }
}

/* ========================================
   VIEW TOGGLE
   ======================================== */
.view-toggle input { display: none; }

.toggle-track {
    position: relative;
    display: flex;
    background: #fff;
    border: 2px solid var(--primary-btn);
    border-radius: 999px;
    overflow: hidden;
}

.toggle-option {
    z-index: 2;
    padding: 0.35rem 0.75rem;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
}

.toggle-indicator {
    position: absolute;
    inset: 0;
    width: 50%;
    background: var(--primary-btn);
    border-radius: 999px;
    transition: transform 0.25s ease;
}

#toggleList:checked ~ .toggle-track .toggle-indicator {
    transform: translateX(100%);
}

#toggleCards:checked ~ .toggle-track label[for="toggleCards"],
#toggleList:checked ~ .toggle-track label[for="toggleList"] {
    color: #fff;
}

/* ========================================
   SEARCH
   ======================================== */
.search-wrapper {
    width: 100%;
}

/* Desktop (>= 1024px) */
@media (min-width: 1024px) {
    .search-wrapper {
        width: 360px;
        flex-shrink: 0;
    }
}

.search-group {
    display: flex;
    align-items: center;
    background: #fff;
    border: 2px solid var(--primary-btn);
    border-radius: 0.5rem;
    overflow: hidden;
}

.search-input {
    flex: 1;
    border: 0;
    padding: 0.5rem 0.75rem;
    font-size: 1rem;
}

.search-input:focus {
    outline: none;
}

.search-icon {
    border: 0;
    background: none;
    padding: 0 0.75rem;
    display: flex;
    align-items: center;
    cursor: pointer;
}

.search-icon i {
    font-size: 1.4rem;
    color: var(--primary-btn);
}

/* ========================================
   CARDS
   ======================================== */
.card {
    border-radius: 0.75rem;
}

.food-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.food-card-link:hover {
    text-decoration: none;
    color: inherit;
}

.food-card-link:hover .card {
    transform: translateY(-3px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

.food-card-link .card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* ========================================
   BUTTONS
   ======================================== */
.btn-primary {
    background-color: var(--primary-btn);
    border-color: var(--primary-btn);
    color: #fff;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
    background-color: var(--primary-btn-hover);
    border-color: var(--primary-btn-hover);
    color: #fff;
}

.btn-outline-orange {
    color: var(--primary-btn);
    border-color: var(--primary-btn);
}

.btn-outline-orange:hover {
    color: #fff;
    background-color: var(--primary-btn);
    border-color: var(--primary-btn);
}

.btn-register {
    background-color: transparent;
    color: #fff;
    border: 2px solid var(--primary-btn);
    padding: 0.25rem 1rem;
    border-radius: 0.5rem;
}

.btn-register:hover {
    background-color: var(--primary-btn);
    color: #fff;
    border-color: var(--primary-btn);
}

.btn-outline-secondary {
    color: var(--text-main);
    border-color: var(--text-main);
}

.btn-outline-secondary:hover {
    color: #fff;
    background-color: var(--text-main);
    border-color: var(--text-main);
}

/* Passwort Toggle Button - passend zu Input-Feldern */
.input-group .btn-outline-secondary {
    border-color: #ced4da;
    color: #6c757d;
}

.input-group .btn-outline-secondary:hover {
    background-color: #e9ecef;
    border-color: #ced4da;
    color: var(--text-main);
}

/* ========================================
   ADMIN SIDEBAR
   ======================================== */
.admin-nav .nav-link {
    color: var(--text-main) !important;
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    transition: background-color 0.2s ease;
}

.admin-nav .nav-link:hover {
    background-color: rgba(249, 131, 19, 0.1);
    color: var(--primary-btn) !important;
}

.admin-nav .nav-link.active {
    background-color: var(--primary-btn);
    color: #fff !important;
}

/* ========================================
   BADGES
   ======================================== */
.badge-good { background: #2e7d32; color: #fff; }
.badge-bad { background: #b02a37; color: #fff; }

/* ========================================
   LEBENSMITTEL PAGE
   ======================================== */
.food-page {
    padding-bottom: 2rem;
}

.food-header-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.food-layout {
    display: flex;
    gap: 1.5rem;
}

.food-content {
    flex: 1;
    min-width: 0;
}

/* Filter Sidebar - nur auf Desktop (>= 1024px) */
.filter-sidebar {
    display: none;
    width: 280px;
    flex-shrink: 0;
}

/* Mobile Filter Button */
.mobile-filter-btn {
    display: block;
}

/* Food Grid */
.food-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

/* Desktop (>= 1024px) */
@media (min-width: 1024px) {
    .filter-sidebar {
        display: block;
    }

    .mobile-filter-btn {
        display: none;
    }

    .food-header-content {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .food-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Tablet (500px - 1023px) */
@media (min-width: 500px) and (max-width: 1023px) {
    .food-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .food-header-content {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
    }
}

/* Mobile (< 500px) */
@media (max-width: 499px) {
    .food-grid {
        grid-template-columns: 1fr;
    }

    .view-toggle .toggle-option span {
        display: none;
    }
}

/* ========================================
   LOGIN / REGISTER FORMS
   ======================================== */
.auth-page {
    display: flex;
    justify-content: center;
    padding: 1rem;
}

.auth-card {
    width: 100%;
    max-width: 400px;
}

@media (max-width: 499px) {
    .auth-card .card-body {
        padding: 1.25rem !important;
    }
}

/* ========================================
   DETAIL PAGE
   ======================================== */
.detail-page {
    padding-bottom: 2rem;
}

.detail-layout {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.detail-main .card {
    background: #E8D4B8;
    border: none;
}

.detail-main .card-body {
    background: var(--bs-card-bg, #fff);
    border-radius: 0 0 var(--bs-card-border-radius, 0.375rem) var(--bs-card-border-radius, 0.375rem);
}

.detail-img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    background: var(--bg-hell);
}

/* Desktop (>= 1024px) */
@media (min-width: 1024px) {
    .detail-layout {
        flex-direction: row;
    }

    .detail-main {
        flex: 0 0 40%;
        max-width: 40%;
    }

    .detail-info {
        flex: 1;
    }

    .detail-img {
        height: 300px;
    }
}

/* Tablet (500px - 1023px) */
@media (min-width: 500px) and (max-width: 1023px) {
    .detail-img {
        height: 280px;
    }
}

/* Mobile (< 500px) */
@media (max-width: 499px) {
    .detail-img {
        height: 200px;
    }
}

/* ========================================
   UTILITY CLASSES
   ======================================== */
.text-main { color: var(--text-main); }
.text-main-lighter { color: var(--text-main-lighter); }
.bg-primary-btn { background-color: var(--primary-btn); }

/* ========================================
   FLOATING FOOD ANIMATION
   ======================================== */
.floating-food-container {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 1200px;
    height: 60vh;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.floating-food {
    position: absolute;
    bottom: -80px;
    animation: floatUp linear infinite;
    opacity: 0.6;
}

.floating-food img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

@keyframes floatUp {
    0% {
        transform: translateY(0);
        opacity: 0;
    }
    10% {
        opacity: 0.6;
    }
    80% {
        opacity: 0.6;
    }
    100% {
        transform: translateY(-70vh);
        opacity: 0;
    }
}

/* Blur-Fadeout Overlay - endet hinter der Suchleiste */
.floating-food-fade {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60vh;
    pointer-events: none;
    z-index: 1;
    background: linear-gradient(
        to top,
        transparent 0%,
        transparent 40%,
        rgba(236, 190, 146, 0.5) 60%,
        rgba(236, 190, 146, 0.85) 80%,
        var(--bg-hell) 100%
    );
}

/* Content muss über der Animation liegen */
.hero-section,
.search-section {
    position: relative;
    z-index: 2;
}

/* Navbar muss über allem liegen */
.navbar {
    position: relative;
    z-index: 1060;
}

/* Mobile Anpassungen */
@media (max-width: 499px) {
    .floating-food-container,
    .floating-food-fade {
        height: 50vh;
    }

    .floating-food {
        opacity: 0.5;
    }

    @keyframes floatUp {
        0% {
            transform: translateY(0);
            opacity: 0;
        }
        10% {
            opacity: 0.5;
        }
        80% {
            opacity: 0.5;
        }
        100% {
            transform: translateY(-55vh);
            opacity: 0;
        }
    }
}

/* Tablet Anpassungen */
@media (min-width: 500px) and (max-width: 1023px) {
    .floating-food-container,
    .floating-food-fade {
        height: 55vh;
    }

    .floating-food {
        opacity: 0.55;
    }
}

/* ========================================
   FOOTER
   ======================================== */
.site-footer {
    background-color: var(--text-main);
    color: #fff;
    padding: 2rem 0;
    margin-top: auto;
    position: relative;
    z-index: 10;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    align-items: center;
}

/* Desktop: 4 Spalten */
@media (min-width: 1024px) {
    .footer-grid {
        grid-template-columns: 1.2fr 1fr 1fr 1fr;
        gap: 2.5rem;
    }
}

/* Tablet: 2x2 Grid */
@media (min-width: 500px) and (max-width: 1023px) {
    .footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
    }
}

/* Footer Brand */
.footer-brand {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.footer-logo {
    height: 45px;
    width: auto;
    object-fit: contain;
}

/* Mobile Footer: zentriert */
@media (max-width: 499px) {
    .footer-grid {
        text-align: center;
    }

    .footer-brand,
    .footer-links,
    .footer-legal {
        align-items: center;
    }

    .footer-links a,
    .footer-legal h4 {
        justify-content: center;
    }

    .footer-legal a {
        padding-left: 0;
    }
}

.footer-tagline {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.95rem;
    margin: 0;
}

/* Footer Links */
.footer-links {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.footer-links a {
    color: #fff;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 1rem;
    transition: color 0.2s ease;
}

.footer-links a:hover {
    color: var(--primary-btn);
}

.footer-links a i {
    font-size: 1.2rem;
    color: var(--primary-btn);
}

/* Footer Legal */
.footer-legal {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.footer-legal h4 {
    font-family: 'Nunito', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: #fff;
}

.footer-legal h4 i {
    font-size: 1.2rem;
    color: var(--primary-btn);
}

.footer-legal a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.2s ease;
    padding-left: 1.8rem;
}

.footer-legal a:hover {
    color: var(--primary-btn);
}
