:root {
    --primary: #FFF7ED;
    --text: #333333;
    --text-light: #5E5E5E;
    --white: #ffffff;
    --border-light: #d1d1d1;
    --shadow-color: rgba(0,0,0,0.1);
    --accent-red: #F53100;
    --tag-accent: #FECACA;
    --tag-text: #431407;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    /* Remove blue tap highlight on mobile */
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

html {
    padding: 0;
    margin: 0;
    font-family: 'Poppins', sans-serif;
    color: var(--text);
    background-color: var(--primary);
}

body, p, h3, h2, h1, ul, li {
    padding: 0;
    margin: 0;
}

.col {
    flex-direction: column !important;
}

input[type="text"],
textarea {
    font-family: 'Poppins', sans-serif;
}

.hidden { display: none !important; }
.col { display: flex; flex-direction: column; }
.row { display: flex; }

.error-message {
    color: var(--accent-red);
    font-size: 0.85rem;
    margin-top: 0.25rem;
    margin-bottom: 0.25rem;
}

.ingredientsNode,
.stepsNode {
    display: flex;
    flex-direction: column;
    margin-bottom: 1rem;
    position: relative;
}

.ingredientsNode .input-row,
.stepsNode .input-row {
    display: flex;
    flex-direction: row;
    align-items: start;
    width: 100%;
}

.ingredientsNode .error-message,
.stepsNode .error-message {
    width: 100%;
    margin-left: 2.5rem;
    padding-top: 0.25rem;
    color: var(--accent-red);
    font-size: 0.85rem;
}

.ingredientsNode input,
.stepsNode textarea {
    margin-bottom: 0;
}

.form-group {
    margin-bottom: 1rem;
    position: relative;
}

input.invalid {
    border-color: var(--accent-red) !important;
    box-shadow: 0 0 0 1px var(--accent-red) !important;
}

.delete-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.delete-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.delete-modal-content {
    background-color: var(--white);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
    text-align: center;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.delete-modal h3 {
    color: var(--text);
    margin-bottom: 1rem;
    font-size: 1.25rem;
    font-weight: 600;
}

.delete-modal p {
    color: var(--text-light);
    margin-bottom: 2rem;
    line-height: 1.5;
}

.delete-modal-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.delete-modal-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 100px;
    font-size: 1rem !important;
    display: inline-block !important;
}

.delete-modal-btn.cancel {
    background-color: var(--border-light);
    color: var(--text);
}

.delete-modal-btn.cancel:hover {
    background-color: #bbb;
}

.delete-modal-btn.confirm {
    background-color: var(--accent-red);
    color: var(--white);
}

.delete-modal-btn.confirm:hover {
    background-color: #d42700;
}

.delete-modal-btn:focus {
    outline: none;
}

ul {
    list-style: none;
}

.header {
    position: relative;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 8px var(--shadow-color);
    background-color: var(--primary);
}

.logoWrapper {
    display: flex;
    width: 100%;
    padding: 0 1rem;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    padding: 1rem 0;
}

.logoName {
    text-decoration: none;
    height: 3rem;
    display: flex;
    min-width: 100px;
}

.logoName h1 {
    padding-right: 0.5rem;
    display: none;
}

.firstHalfEnd { 
    display: flex; 
}

.searchBar {
    display: none;
}

.searchButton {
    background-color: transparent;
    border: none;
    align-self: center;
    height: 100%;
}

.searchButtonMobile {
    display: flex;
}

.searchBarMobileWrapper {
    padding: 1.5rem;
}

.searchBarMobileWrapper .searchInput {
    border-radius: 12px;
    box-shadow: 0 0 0 2px var(--border-light);
    display: flex;
    background-color: var(--white);
}

.searchBarMobileWrapper .searchInput:focus-within {
    box-shadow: 0 0 0 2px var(--accent-red);
}

.searchBarMobileWrapper .searchInput input {
    width: 100%;
    border-radius: 0 12px 12px 0;
    border: none;
    font-size: 1.2rem;
    box-shadow: none !important;
    margin: 0;
    padding: 0.1rem;
}

.searchBarMobileWrapper .searchInput input:focus {
    outline: none;
}

.searchInput input:focus {
    box-shadow: none !important;
}

.searchBarMobileWrapper .searchInput button {
    border: none;
    background-color: var(--white);
    border-radius: 12px 0 0 12px;
    padding: 0;
    display: flex;
    align-items: center;
}

.searchBarMobileWrapper .searchInput button img {
    height: 2.5rem;
    padding: 0.5rem;
    display: block;
}

span {
    align-self: center;
    color: red;
}

.mobileMenu {
    padding-bottom: 1rem;
}

.menu {
    display: none;
    list-style: none;
    font-size: 0.5rem;
    list-style-type: none;
}

ul.mainMenu, ul.user-bar {
    list-style: none;
}

.usernameLink {
    padding: 0 !important;
}

.menuShelf {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: var(--primary);
    flex-direction: column;
    box-shadow: 0 4px 8px var(--shadow-color);
    z-index: 1000;
    padding: 0.5rem 0;
    align-items: center;
    gap: 1rem;
    color: var(--text);
    font-weight: 600;
    list-style: none;
}

.menuShelf.active {
    display: flex;
}

.menuShelf a, .menuShelf a:visited {
    color: var(--text);
    text-decoration: none;
    transition: color 0.2s ease;
    padding: 0.3rem 0.5rem;
    border-radius: 4px;
}

.mainMenu a.current,
.mainMenu a:hover {
    color: var(--accent-red);
}

.mainMenu, .user-bar {
    display: flex;
    gap: 1rem;
}

.mainMenu {
    flex-direction: column;
}

.menuShelf li {
    width: 100%;
    text-align: center;
    padding: 0;
    border-bottom: 1px solid var(--primary);
    box-sizing: border-box;
}

.menuShelf li:last-child {
    border-bottom: none;
}

.menuShelf li a, .menuShelf li.user-greeting {
    display: block;
    padding: 12px 0;
    color: var(--text);
    text-decoration: none;
}

.menuShelf li a:hover {
    background-color: var(--primary);
}

.searchButton img {
    height: 1.7rem;
    margin-top: 0.3rem;
}

.user-greeting {
    color: var(--text);
    font-weight: 500;
}

.firstHalfHeader, .secondHalfHeader {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.firstHalfHeader {
    gap: 2rem;
    width: 100%;
    justify-content: space-between;
}

.secondHalfHeader {
    gap: 2rem;
}

.searchBarMobileWrapper {
    padding: 0rem 1rem 1rem 1rem;
}

.searchBarMobileWrapper .searchInput button img {
    height: 2.3rem;
}

.searchBarMobileWrapper .searchInput input {
    font-size: 1rem;
}

.hamburger-button {
    display: block;
    background: none;
    border: none;
    color: var(--text);
    font-size: 1.8rem;
    cursor: pointer;
    padding: 0 0.5rem;
    align-self: center;
}

.mobileMenu.active {
    display: flex;
}

.sortOptions {
    padding-bottom: 2rem;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    display: flex;
    gap: 1rem;
}

.sort-dropdown {
    position: relative;
    display: inline-block;
}

.sort-dropdown-toggle {
    background: var(--white); 
    border: 1px solid var(--border-light); 
    padding: 0.5rem .75rem; 
    margin: 0;
    font-family: 'Poppins', sans-serif;
    font-size: 0.95rem;
    color: var(--text); 
    cursor: pointer; 
    display: flex; 
    align-items: center;
    gap: 0.5rem;
    border-radius: 12px;
    transition: all 0.2s ease;
    font-weight: 500;
    min-width: 110px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    /* Remove mobile tap highlight */
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    outline: none;
}

/* Remove all focus styles by default */
.sort-dropdown-toggle:focus {
    outline: none !important;
}

/* Completely disable focus styles on touch devices and mobile simulation */
@media (hover: none) and (pointer: coarse) {
    .sort-dropdown-toggle:focus {
        border-color: var(--border-light) !important;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05) !important;
    }
}

/* Also disable for DevTools mobile simulation */
@media (max-width: 768px) {
    .sort-dropdown-toggle:focus {
        border-color: var(--border-light) !important;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05) !important;
    }
}

/* Only show red outline when dropdown is active (opened) */
.sort-dropdown.active .sort-dropdown-toggle {
    border-color: var(--accent-red) !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1) !important;
}

/* Override hover when active to maintain red styling */
.sort-dropdown.active .sort-dropdown-toggle:hover {
    border-color: var(--accent-red) !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1) !important;
}

.sort-dropdown-toggle:hover {
    border-color: var(--accent-red);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.sort-dropdown-toggle:active {
    transform: translateY(0);
}

.sort-label {
    color: var(--text-light);
    font-weight: 400;
}

.sort-current {
    color: var(--accent-red);
    font-weight: 600;
    flex-grow: 1;
}

.sort-dropdown-arrow {
    font-size: 0.8em; 
    line-height: 1; 
    color: var(--text-light);
    transition: transform 0.2s ease, color 0.2s ease;
    margin-left: auto;
}

.sort-dropdown-toggle:hover .sort-dropdown-arrow {
    color: var(--accent-red);
}

.sort-dropdown.active .sort-dropdown-arrow {
    transform: rotate(180deg);
    color: var(--accent-red);
}

.sort-dropdown-menu {
    display: none; 
    position: absolute; 
    left: 0;
    right: 0;
    top: calc(100% + 0.5rem);
    background-color: var(--white); 
    border: 1px solid var(--border-light);
    border-radius: 12px; 
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    list-style: none;
    margin: 0;
    padding: 0;
    z-index: 1000;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    overflow: hidden;
}

.sort-dropdown-menu.active { 
    display: block; 
    opacity: 1;
    transform: translateY(0);
}

.sort-dropdown-menu::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 1.5rem;
    width: 12px;
    height: 12px;
    background-color: var(--white);
    border: 1px solid var(--border-light);
    border-bottom: none;
    border-right: none;
    transform: rotate(45deg);
    z-index: -1;
}

.sort-dropdown-menu li {
    margin: 0;
    padding: 0;
    list-style: none;
}

.sort-dropdown-menu li a {
    display: block; 
    padding: 0.75rem 1.25rem; 
    color: var(--text);
    text-decoration: none; 
    white-space: nowrap;
    font-weight: 500;
    font-size: 0.95rem;
    transition: background-color 0.2s ease, color 0.2s ease;
    border-radius: 0;
    position: relative;
}

.sort-dropdown-menu li:first-child a {
    border-radius: 12px 12px 0 0;
}

.sort-dropdown-menu li:last-child a {
    border-radius: 0 0 12px 12px;
}

.sort-dropdown-menu li:only-child a {
    border-radius: 12px;
}

.sort-dropdown-menu li a:hover { 
    background-color: var(--primary);
    color: var(--accent-red);
}

.sort-dropdown-menu li a.active {
    background-color: var(--white);
    color: var(--accent-red);
    font-weight: 600;
}

.sort-dropdown-menu li a.active:hover {
    background-color: rgba(245, 49, 0, 0.12);
    color: var(--accent-red);
}

.sort-dropdown-menu li a.active::after {
    content: '✓';
    position: absolute;
    right: 1rem;
    color: var(--accent-red);
    font-weight: bold;
    font-size: 0.9em;
}

.sort-dropdown-menu li + li {
    border-top: 1px solid rgba(209, 209, 209, 0.3);
}

.view-dropdown {
    position: relative;
    display: inline-block;
}

.view-dropdown-toggle {
    background: var(--white); 
    border: 1px solid var(--border-light); 
    padding: 0.5rem 0.75rem; 
    margin: 0;
    font-family: 'Poppins', sans-serif;
    font-size: 0.95rem;
    color: var(--text); 
    cursor: pointer; 
    display: flex; 
    align-items: center;
    gap: 0.5rem;
    border-radius: 12px;
    transition: all 0.2s ease;
    font-weight: 500;
    min-width: 110px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    /* Remove mobile tap highlight */
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    outline: none;
}

/* Remove all focus styles by default */
.view-dropdown-toggle:focus {
    outline: none !important;
}

/* Completely disable focus styles on touch devices and mobile simulation */
@media (hover: none) and (pointer: coarse) {
    .view-dropdown-toggle:focus {
        border-color: var(--border-light) !important;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05) !important;
    }
}

/* Also disable for DevTools mobile simulation */
@media (max-width: 768px) {
    .view-dropdown-toggle:focus {
        border-color: var(--border-light) !important;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05) !important;
    }
}

/* Only show red outline when dropdown is active (opened) */
.view-dropdown.active .view-dropdown-toggle {
    border-color: var(--accent-red) !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1) !important;
}

/* Override hover when active to maintain red styling */
.view-dropdown.active .view-dropdown-toggle:hover {
    border-color: var(--accent-red) !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1) !important;
}

.view-dropdown-toggle:hover {
    border-color: var(--accent-red);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.view-dropdown-toggle:active {
    transform: translateY(0);
}

.view-label {
    color: var(--text-light);
    font-weight: 400;
}

.view-current {
    color: var(--accent-red);
    font-weight: 600;
    flex-grow: 1;
}

.view-dropdown-arrow {
    font-size: 0.8em; 
    line-height: 1; 
    color: var(--text-light);
    transition: transform 0.2s ease, color 0.2s ease;
    margin-left: auto;
}

.view-dropdown-toggle:hover .view-dropdown-arrow {
    color: var(--accent-red);
}

.view-dropdown.active .view-dropdown-arrow {
    transform: rotate(180deg);
    color: var(--accent-red);
}

.view-dropdown-menu {
    display: none; 
    position: absolute; 
    left: 0;
    right: 0;
    top: calc(100% + 0.5rem);
    background-color: var(--white); 
    border: 1px solid var(--border-light);
    border-radius: 12px; 
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    list-style: none;
    margin: 0;
    padding: 0;
    z-index: 1000;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    overflow: hidden;
}

.view-dropdown-menu.active { 
    display: block; 
    opacity: 1;
    transform: translateY(0);
}

.view-dropdown-menu::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 1.5rem;
    width: 12px;
    height: 12px;
    background-color: var(--white);
    border: 1px solid var(--border-light);
    border-bottom: none;
    border-right: none;
    transform: rotate(45deg);
    z-index: -1;
}

.view-dropdown-menu li {
    margin: 0;
    padding: 0 !important;
    list-style: none;
}

.view-dropdown-menu li a {
    display: block; 
    padding: 0.75rem 1.25rem; 
    color: var(--text);
    text-decoration: none; 
    white-space: nowrap;
    font-weight: 500;
    font-size: 0.95rem;
    transition: background-color 0.2s ease, color 0.2s ease;
    border-radius: 0;
    position: relative;
}

.view-dropdown-menu li:first-child a {
    border-radius: 12px 12px 0 0;
}

.view-dropdown-menu li:last-child a {
    border-radius: 0 0 12px 12px;
}

.view-dropdown-menu li:only-child a {
    border-radius: 12px;
}

.view-dropdown-menu li a:hover { 
    background-color: var(--primary);
    color: var(--accent-red);
}

.view-dropdown-menu li a.active {
    background-color: rgba(245, 49, 0, 0.08);
    color: var(--accent-red);
    font-weight: 600;
}

.view-dropdown-menu li a.active:hover {
    background-color: rgba(245, 49, 0, 0.12);
    color: var(--accent-red);
}

.view-dropdown-menu li a.active::after {
    content: '✓';
    position: absolute;
    right: 1rem;
    color: var(--accent-red);
    font-weight: bold;
    font-size: 0.9em;
}

.view-dropdown-menu li + li {
    border-top: 1px solid rgba(209, 209, 209, 0.3);
}

@media only screen and (min-width: 700px) {
    .menuShelf {
        padding: 0.5rem;
        align-items: center;
        display: flex;
        list-style: none;
        gap: 1rem;
        background-color: var(--primary);
        color: var(--text);
        font-weight: 600;
        flex-direction: row;
        position: static;
        box-shadow: none;
        width: auto;
        justify-content: space-around;
    }

    .menuShelf.mobileMenu {
        display: none;
    }

    .hamburger-button {
        display: none;
        background: none;
        border: none;
        color: var(--text);
        font-size: 1.8rem;
        cursor: pointer;
        padding: 0 0.5rem;
        align-self: center;
    }

    .menuShelf li {
        width: auto;
        border-bottom: none;
        padding: 0;
        text-align: left;
    }

    .menuShelf li a, .menuShelf li.user-greeting {
        display: inline;
        padding: 0;
    }

    .menuShelf li a:hover {
        background-color: transparent;
    }

    .mainMenu, .user-bar {
        flex-direction: row;
    }

    .logoWrapper {
        width: 100%;
        justify-content: space-between;
        gap: 1rem;
    }

    .firstHalfHeader {
        width: auto;
        gap: 2rem;
    }

    .secondHalfHeader {
        gap: 1rem;
    }

    .searchBarMobileWrapper {
        padding: 0rem 1rem 1rem 1rem;
    }

    .searchBarMobileWrapper .searchInput button img {
        height: 2.3rem;
    }
    
    .searchBarMobileWrapper .searchInput input {
        font-size: 1rem;
    }

    .user-dropdown {
        position: relative;
        display: inline-block;
    }
    
    .user-dropdown-toggle {
        background: none; 
        border: none; 
        padding: 0.5rem 0.75rem; 
        margin: 0;
        font: inherit; 
        color: inherit; 
        cursor: pointer; 
        display: flex; 
        align-items: center;
        gap: 0.5rem;
        border-radius: 8px;
        transition: background-color 0.2s ease, transform 0.1s ease;
        font-weight: 500;
    }

    .user-dropdown-toggle:hover {
        background-color: rgba(245, 49, 0, 0.08);
        transform: translateY(-1px);
    }

    .user-dropdown-toggle:active {
        transform: translateY(0);
    }
    
    .dropdown-arrow {
        font-size: 0.8em; 
        line-height: 1; 
        color: var(--text-light);
        transition: transform 0.2s ease, color 0.2s ease;
    }

    .user-dropdown-toggle:hover .dropdown-arrow {
        color: var(--accent-red);
    }

    .user-dropdown.active .dropdown-arrow {
        transform: rotate(180deg);
        color: var(--accent-red);
    }
    
    .user-dropdown-menu {
        display: none; 
        position: absolute; 
        right: 0;
        top: calc(100% + 0.5rem);
        background-color: var(--white); 
        border: 1px solid var(--border-light);
        border-radius: 12px; 
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
        list-style: none;
        margin: 0;
        padding: 0;
        min-width: 140px;
        z-index: 1000;
        opacity: 0;
        transform: translateY(-10px);
        transition: opacity 0.2s ease, transform 0.2s ease;
    }
    
    .user-dropdown-menu.active { 
        display: block; 
        opacity: 1;
        transform: translateY(0);
        padding: 0;
    }

    .user-dropdown-menu::before {
        content: '';
        position: absolute;
        top: -6px;
        right: 1rem;
        width: 12px;
        height: 12px;
        background-color: var(--white);
        border: 1px solid var(--border-light);
        border-bottom: none;
        border-right: none;
        transform: rotate(45deg);
        z-index: -1;
    }
    
    .user-dropdown-menu li {
        margin: 0;
        padding: 0;
    }

    .user-dropdown-menu li a {
        display: block; 
        padding: 0.75rem 1.25rem; 
        color: var(--text);
        text-decoration: none; 
        white-space: nowrap;
        font-weight: 500;
        font-size: 0.95rem;
        transition: background-color 0.2s ease, color 0.2s ease;
        border-radius: 0;
    }

    .user-dropdown-menu li:first-child a {
        border-radius: 12px 12px 0 0;
    }

    .user-dropdown-menu li:last-child a {
        border-radius: 0 0 12px 12px;
    }

    .user-dropdown-menu li:only-child a {
        border-radius: 12px;
    }
    
    .user-dropdown-menu li a:hover { 
        background-color: var(--primary);
        color: var(--accent-red);
    }

    .user-dropdown-menu li + li {
        border-top: 1px solid rgba(209, 209, 209, 0.3);
    }
}

@media only screen and (min-width: 991px) {
    .searchBar {
        display: flex;
    }

    .searchButtonMobile {
        display: none;
    }

    .searchInput {
        display: flex;
        align-items: center;
        border-radius: 20px;
        background-color: white;
        padding: 0.2rem 0.5rem;
        box-shadow: 0 1px 2px rgba(0,0,0,0.05);
        min-width: 280px;
        transition: border-color 0.2s ease, box-shadow 0.2s ease;
        box-shadow: 0px 0px 5px 0px rgb(0 0 0 / 20%);
    }

    .searchBarMobile {
        display: none;
    }

    .searchInput:focus-within {
        box-shadow: 0 0 0 2px var(--accent-red);
    }

    .searchIcon {
        height: 1.3rem;
        margin: 0 0.5rem 0 0.3rem;
        opacity: 0.6;
    }

    .searchInput input[type='text'] {
        flex-grow: 1;
        padding: 0.4rem 0.2rem;
        border: none;
        outline: none;
        margin: 0;
        color: var(--text);
        font-size: 0.95rem;
    }

    .search-image-button {
        background: none;
        border: none;
        padding: 0;
        margin-top: 0.25rem;
        cursor: pointer;
    }
    
    .search-image-button:focus {
        outline: none;
    }
}
