/* =========================================================
   RECIPEFINDER
   Custom CSS
   ---------------------------------------------------------
   Tailwind CSS tetap menjadi framework utama.
   File ini hanya menambahkan visual polish dan konsistensi.
========================================================= */


/* =========================================================
   1. ROOT & GLOBAL
========================================================= */

:root {
    --rf-green: #059669;
    --rf-green-dark: #047857;
    --rf-green-light: #ecfdf5;

    --rf-orange: #f97316;
    --rf-orange-light: #fff7ed;

    --rf-slate-900: #0f172a;
    --rf-slate-800: #1e293b;
    --rf-slate-700: #334155;
    --rf-slate-600: #475569;
    --rf-slate-500: #64748b;
    --rf-slate-400: #94a3b8;
    --rf-slate-300: #cbd5e1;
    --rf-slate-200: #e2e8f0;
    --rf-slate-100: #f1f5f9;
    --rf-slate-50: #f8fafc;

    --rf-white: #ffffff;

    --rf-radius-sm: 10px;
    --rf-radius-md: 14px;
    --rf-radius-lg: 20px;
    --rf-radius-xl: 24px;

    --rf-shadow-sm:
        0 2px 8px rgba(15, 23, 42, 0.05);

    --rf-shadow-md:
        0 8px 24px rgba(15, 23, 42, 0.08);

    --rf-shadow-lg:
        0 16px 40px rgba(15, 23, 42, 0.10);

    --rf-transition:
        180ms ease;
}


/* =========================================================
   2. HTML & BODY
========================================================= */

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;

    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    background:
        linear-gradient(
            180deg,
            #f8fafc 0%,
            #f8fafc 100%
        );

    color: var(--rf-slate-800);

    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}


/* =========================================================
   3. SELECTION
========================================================= */

::selection {
    background: rgba(16, 185, 129, 0.18);
    color: var(--rf-slate-900);
}


/* =========================================================
   4. SCROLLBAR
========================================================= */

::-webkit-scrollbar {
    width: 9px;
}

::-webkit-scrollbar-track {
    background: var(--rf-slate-100);
}

::-webkit-scrollbar-thumb {
    background: var(--rf-slate-300);
    border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--rf-slate-400);
}


/* =========================================================
   5. NAVBAR
========================================================= */

header {
    position: relative;
    z-index: 20;

    background: rgba(255, 255, 255, 0.94);

    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);

    box-shadow:
        0 1px 0 rgba(15, 23, 42, 0.04);
}

header nav {
    min-height: 72px;
}

header a {
    text-decoration: none;
}


/* Logo */

header nav > a:first-child {
    letter-spacing: -0.025em;

    transition:
        color var(--rf-transition),
        transform var(--rf-transition);
}

header nav > a:first-child:hover {
    transform: translateY(-1px);
}


/* Navigation links */

header nav a:not(:first-child) {
    transition:
        color var(--rf-transition),
        opacity var(--rf-transition);
}


/* =========================================================
   6. HERO
========================================================= */

main > section:first-child {
    position: relative;
    overflow: hidden;
}

main > section:first-child::before {
    content: "";

    position: absolute;

    width: 360px;
    height: 360px;

    top: -180px;
    left: -160px;

    border-radius: 50%;

    background:
        radial-gradient(
            circle,
            rgba(16, 185, 129, 0.08) 0%,
            rgba(16, 185, 129, 0) 70%
        );

    pointer-events: none;
}

main > section:first-child::after {
    content: "";

    position: absolute;

    width: 360px;
    height: 360px;

    right: -170px;
    bottom: -190px;

    border-radius: 50%;

    background:
        radial-gradient(
            circle,
            rgba(249, 115, 22, 0.07) 0%,
            rgba(249, 115, 22, 0) 70%
        );

    pointer-events: none;
}


/* =========================================================
   7. FORM ELEMENTS
========================================================= */

input[type="text"],
input[type="search"],
select {
    transition:
        border-color var(--rf-transition),
        box-shadow var(--rf-transition),
        background-color var(--rf-transition);
}

input[type="text"]:focus,
input[type="search"]:focus,
select:focus {
    outline: none;

    border-color: rgba(16, 185, 129, 0.65);

    box-shadow:
        0 0 0 3px rgba(16, 185, 129, 0.10);
}


/* Search input */

#ingredient-search {
    background-color: rgba(255, 255, 255, 0.96);
}

#ingredient-search::placeholder {
    color: var(--rf-slate-400);
}


/* =========================================================
   8. INGREDIENT LIST
========================================================= */

#ingredient-list label {
    background: rgba(255, 255, 255, 0.82);

    transition:
        border-color var(--rf-transition),
        background-color var(--rf-transition),
        transform var(--rf-transition),
        box-shadow var(--rf-transition);
}

#ingredient-list label:hover {
    transform: translateY(-1px);

    background:
        rgba(236, 253, 245, 0.75);

    box-shadow:
        var(--rf-shadow-sm);
}


/* Checkbox */

#ingredient-list input[type="checkbox"] {
    flex-shrink: 0;

    accent-color: var(--rf-green);

    cursor: pointer;
}

#ingredient-list input[type="checkbox"]:focus {
    outline: none;

    box-shadow:
        0 0 0 3px rgba(16, 185, 129, 0.12);
}


/* =========================================================
   9. SELECTED INGREDIENT CHIPS
========================================================= */

#selected-ingredients > * {
    transition:
        transform var(--rf-transition),
        box-shadow var(--rf-transition);
}

#selected-ingredients > *:hover {
    transform: translateY(-1px);

    box-shadow:
        var(--rf-shadow-sm);
}


/* =========================================================
   10. BUTTONS
========================================================= */

button {
    font-family: inherit;
}

#search-button {
    box-shadow:
        0 8px 18px rgba(5, 150, 105, 0.16);

    transition:
        transform var(--rf-transition),
        box-shadow var(--rf-transition),
        background-color var(--rf-transition);
}

#search-button:hover {
    box-shadow:
        0 12px 24px rgba(5, 150, 105, 0.20);
}

#reset-button {
    transition:
        transform var(--rf-transition),
        border-color var(--rf-transition),
        background-color var(--rf-transition);
}


/* =========================================================
   11. RECIPE RESULT CARDS
========================================================= */

#recipe-list > article {
    position: relative;

    display: flex;
    flex-direction: column;

    min-width: 0;

    background: rgba(255, 255, 255, 0.96);

    box-shadow:
        var(--rf-shadow-sm);

    transition:
        transform 220ms ease,
        box-shadow 220ms ease,
        border-color 220ms ease;
}

#recipe-list > article:hover {
    box-shadow:
        var(--rf-shadow-lg);
}


/* Card image */

#recipe-list > article img {
    display: block;

    width: 100%;
    height: 100%;

    object-fit: cover;
}


/* Image wrapper */

#recipe-list > article .relative:first-child {
    background:
        linear-gradient(
            135deg,
            #ecfdf5 0%,
            #fff7ed 100%
        );
}


/* =========================================================
   12. RECIPE CARD TYPOGRAPHY
========================================================= */

#recipe-list > article h3 {
    letter-spacing: -0.015em;
}

#recipe-list > article p {
    line-height: 1.55;
}


/* =========================================================
   13. RECIPE CARD BUTTON
========================================================= */

#recipe-list > article a {
    transition:
        color var(--rf-transition),
        background-color var(--rf-transition),
        transform var(--rf-transition);
}

#recipe-list > article a:hover {
    transform: translateX(2px);
}


/* =========================================================
   14. MATCH BADGE
========================================================= */

#recipe-list > article .absolute {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}


/* =========================================================
   15. LOADING STATE
========================================================= */

#loading {
    color: var(--rf-slate-500);
}

#loading p {
    display: inline-flex;

    align-items: center;
    gap: 10px;
}

#loading p::before {
    content: "";

    width: 18px;
    height: 18px;

    border: 2px solid #d1fae5;
    border-top-color: var(--rf-green);

    border-radius: 50%;

    animation:
        rf-spin 0.8s linear infinite;
}

@keyframes rf-spin {
    to {
        transform: rotate(360deg);
    }
}


/* =========================================================
   16. ERROR STATE
========================================================= */

#error-message {
    box-shadow:
        var(--rf-shadow-sm);
}


/* =========================================================
   17. EMPTY STATE
========================================================= */

#empty-message {
    box-shadow:
        var(--rf-shadow-sm);
}


/* =========================================================
   18. DETAIL PAGE
========================================================= */

#recipe-detail {
    animation:
        rf-fade-up 350ms ease both;
}

@keyframes rf-fade-up {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* Detail image */

#recipe-image {
    display: block;

    width: 100%;
    height: 100%;

    object-fit: cover;
}


/* Detail image placeholder */

#recipe-image-placeholder {
    background:
        linear-gradient(
            135deg,
            #ecfdf5 0%,
            #fff7ed 100%
        );
}


/* Detail title */

#recipe-name {
    letter-spacing: -0.025em;
}


/* Detail metadata */

#recipe-time,
#recipe-difficulty,
#recipe-id {
    white-space: nowrap;
}


/* =========================================================
   19. DETAIL CARDS
========================================================= */

#recipe-detail > section {
    transition:
        box-shadow var(--rf-transition),
        border-color var(--rf-transition);
}

#recipe-detail > section:hover {
    box-shadow:
        var(--rf-shadow-md);
}


/* =========================================================
   20. INGREDIENT DETAIL LIST
========================================================= */

#ingredient-list > div {
    transition:
        background-color var(--rf-transition),
        transform var(--rf-transition);
}

#ingredient-list > div:hover {
    background-color: #f8fafc;

    transform: translateX(2px);
}


/* =========================================================
   21. TOOL LIST
========================================================= */

#tool-list > * {
    transition:
        transform var(--rf-transition),
        box-shadow var(--rf-transition);
}

#tool-list > *:hover {
    transform: translateY(-1px);

    box-shadow:
        var(--rf-shadow-sm);
}


/* =========================================================
   22. INSTRUCTION LIST
========================================================= */

#instruction-list > * {
    transition:
        background-color var(--rf-transition),
        transform var(--rf-transition);
}

#instruction-list > *:hover {
    transform: translateX(2px);
}


/* =========================================================
   23. TAG LIST
========================================================= */

#tag-list > * {
    transition:
        transform var(--rf-transition),
        box-shadow var(--rf-transition);
}

#tag-list > *:hover {
    transform: translateY(-1px);

    box-shadow:
        var(--rf-shadow-sm);
}


/* =========================================================
   24. FOOTER
========================================================= */

footer {
    margin-top: auto;

    background: rgba(255, 255, 255, 0.94);
}


/* =========================================================
   25. RESPONSIVE
========================================================= */

@media (max-width: 767px) {

    header nav {
        min-height: 64px;
    }

    header nav > a:first-child {
        font-size: 1.25rem;
    }

    main > section:first-child::before,
    main > section:first-child::after {
        display: none;
    }

    #recipe-list > article {
        border-radius: 18px;
    }

    #recipe-list > article .relative:first-child {
        height: 190px;
    }

    #recipe-detail > section {
        border-radius: 18px;
    }

    #recipe-detail h1 {
        line-height: 1.15;
    }

    #ingredient-list > div {
        padding-top: 0.75rem;
        padding-bottom: 0.75rem;
    }
}


/* =========================================================
   26. REDUCED MOTION
========================================================= */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;

        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;

        transition-duration: 0.01ms !important;
    }
}