@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --color-background: #ffffff;
    --color-text: #2c2c2c;
    --color-primary: #4e4033;
    --color-primary-light: #5a4837;
    --color-border: #e0dcd3;
    --color-border-light: #e6e1d8;
    --color-accent: #febf00;
    --color-accent-light: #ffd900;
    --color-accent-dark: #fe9d00;
    --color-accent-secondary: #5a73b6;
    --color-accent-secondary-dark: #4a619e;
    --color-text-secondary: #555;
    --color-text-tertiary: #4a3a30;
    --color-white: #ffffff;
    --color-green: #65a061;
    --color-green-dark: #486e45;
    --color-red: #dc3545;
    --color-red-light: #fd7272;
    --color-text-light: #fafaf9;
    --color-shadow: rgba(0, 0, 0, 0.2);
    --color-overlay: rgba(0, 0, 0, 0.03);
    --color-overlay-dark: rgba(0, 0, 0, 0.1);
    --color-input-border: #e0e0e0;
    --color-grey-background: #f5f5f5;
    --border-radius: 1rem;
    --border-radius-large: 2rem;
    --border-radius-inputs: 25px;
}

html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, input, textarea { margin: 0; padding: 0; border: 0; outline: 0; font-weight: inherit; font-style: inherit; font-size: 100%; font-family: inherit; vertical-align: baseline; } 
:focus { outline: 0; } 
body { line-height: 1; color: black; background: white; } 
ol, ul { list-style: none; } 
/* tables still need 'cellspacing="0"' in the markup */ table { border-collapse: separate; border-spacing: 0; } 
caption, th, td { text-align: left; font-weight: normal; } 
blockquote:before, blockquote:after, q:before, q:after { content: ""; }  
blockquote, q { quotes: "" ""; } 

.hidden {
    display: none !important;
}
.centered {
    text-align: center;
}

.header .nav-item:hover, .header .nav-item:focus, .header .nav-item:active, button:hover, button:focus, button:active {
    outline: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background: none;
    border: none;
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color 0.2s ease;
    cursor: pointer;
}

a:hover, a:focus {
    color: var(--color-primary-light);
    text-decoration: underline;
}

a:active {
    color: var(--color-text-tertiary);
}

 
/* Base styling */
body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--color-background);
    color: var(--color-text);
    line-height: 1.6;
    font-size: 1rem;
    overflow-x: hidden;
}

#navbar, .header {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 2rem);
    z-index: 1000;
}
#navbar {
    bottom: 1rem;
}
.header {
    top: 1rem;
}
#navbar {
    width: calc(70% - 2rem);
}

#navbar-inner, .header-inner, #tab-container {
    position: relative;
    width: calc(100% - 1rem);
    display: flex;
    justify-content: space-between;
    padding: 0.5rem;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.42);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--border-radius-large);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
}

#navbar-inner a {
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: 0.8rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 0.25rem 0;
    transition: all 0.3s ease;
    width: 33.33%;
    min-width: 0;
    text-align: center;
    position: relative;
    overflow: hidden;
    border-radius: var(--border-radius-large);
}


.nav-icon {
    font-size: 20px !important;
    margin-bottom: 1px;
    margin-top: 3px;
    color: var(--color-text-secondary);
    flex-shrink: 0;
    transition: transform 0.3s ease;
}
#navbar-inner a:hover, #navbar-inner a:focus, #navbar-inner a:active, #navbar-inner a.active {
    background: linear-gradient(135deg, var(--color-accent), var(--color-accent-dark));
    color: var(--color-white) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    opacity: 0.9;
}
#navbar-inner a:hover .nav-icon, #navbar-inner a:focus .nav-icon, #navbar-inner a:active .nav-icon, #navbar-inner a.active .nav-icon, #navbar-inner a:hover .nav-text, #navbar-inner a:focus .nav-text, #navbar-inner a:active .nav-text, #navbar-inner a.active .nav-text {
    color: var(--color-white) !important;
}


#navbar-inner a:hover .nav-icon {
    transform: translateY(-2px);
}

.nav-text {
    font-size: 0.6rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    padding: 0 2px;
    transition: transform 0.3s ease;
}

#navbar-inner a:hover .nav-text {
    transform: translateY(-1px);
}
.nav-count { display: none; }

/* Safe area inset for newer iOS devices */
@supports (padding: max(0px)) {
    #navbar {
        bottom: max(1rem, env(safe-area-inset-bottom));
    }
    #navbar-inner a {
        padding-bottom: 0.25rem;
    }
}

/* Update app-view padding to account for floating navbar */
#app-view {
    padding-bottom: calc(env(safe-area-inset-bottom) + 70px);
}

/* Responsive tweaks */
@media (max-width: 600px) {
    header {
        flex-direction: row;
        align-items: flex-start;
    }

    #user-button {
        margin-left: auto;
    }
}

/* Header */
.header-title {
    flex: 1;
}
.header h1 {
    margin-bottom: 0 !important;
    padding: 0.5rem 0.5rem 0.5rem 1rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-text);
    letter-spacing: -0.03em;
}
.public-view .header h1 {
    padding-left: 3rem;
    background-image: url('../img/icons/icon-header.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: left center;
}
.header-button {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--color-primary);
    cursor: pointer;
    text-decoration: none;
    padding: 0.125rem 0 0.125rem 0.5rem; /* Added padding for better touch target */
    display: flex; /* Added to better align the streak count and emoji */
    align-items: center; /* Added to vertically center the streak count and emoji */
} 
.header-button:hover, .header-button:focus, .header-button:active {
    text-decoration: none;
}
.header .back-button {
    background: none;
    border: none;
    padding: 0.5rem 0.5rem 0.5rem 0;
    color: var(--color-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    display: none;
}
.header .back-button.active {
    display: flex;
}
.header .back-button:hover, .header .back-button:focus, .header .back-button:active {
    color: var(--color-primary-light);
    text-decoration: none;
}
.header-button.focus-button {
    display: inline-block;
    background: var(--color-accent, #0a7fb3);
    color: #fff;
    padding: 0.75rem 1rem;
    border-radius: 3rem;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s;
    border: none;
    cursor: pointer;
}
.header-button.focus-button {
    background: var(--color-accent, #f69e65);
}
.header-button.focus-button:hover {
    background: var(--color-accent-dark, #cf773d);
    color: #fff;
}
.header-button.focus-button .material-icons-round {
    font-size: 1.5rem;
    line-height: 1.5rem;
    vertical-align: middle;
}
#tab-container.has-button {
    padding-right: 0;
    width: calc(100% - 1rem);
}
#tab-container .header-button {
    position: sticky;
    right: 0;
    padding: 0.25rem 0.5rem;
    display: block;
    margin-right: -1rem;
    font-size: 1.2rem;
    font-weight: bold;
}

.header .back-button .material-icons-round {
    font-size: 1.5rem;
}
.header.tabbed-view .header-inner {
    display: none;
}
#tab-container {
    display: flex;
    align-items: left;
    justify-content: left;
    gap: 1.5rem;
    position: relative;
    width: calc(100% - 2rem);
    padding: 0 1rem;
    overflow-x: auto;
    margin-top: 0.5rem;
    /* box-shadow: 0 1px 0 rgba(0, 0, 0, 0.1); */
}

#tab-container .tab-button {
    padding: 0.5rem 0;
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text);
}

#tab-container .tab-button:hover, #tab-container .tab-button:focus, #tab-container .tab-button:active, #tab-container .tab-button.active {
    text-decoration: none;
    color: var(--color-accent-dark);
}


/* Close button styling */
.close-button {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: var(--color-text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    z-index: 1000;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-button .material-icons-round {
    font-size: 1.5rem;
}

.close-button:hover {
    opacity: 0.8;
    text-decoration: none;
}

/* Variant for light background */
.close-button-light {
    color: var(--color-text-light);
}



/* Main layout */
#main {
    padding: 6rem 1rem 2rem 1rem;  
    overflow-x: hidden;
}
#main.tabbed-view {
    padding-top: 5rem;
}
.view:not(.active) {
    display: none;
}   

/* Section headings */
h1 {
    font-size: 1.5rem;
    color: var(--color-primary);
}
#main h1 {
    margin-bottom: 0.75rem;
}
h2 {
    font-size: 1.25rem;
    color: var(--color-primary);
}
#main h2 {
    margin-bottom: 1rem;
    padding-bottom: 0.3rem;
}

h3 {
    font-size: 1.15rem;
    color: var(--color-primary-light);
}
#main h3 {
    margin-bottom: 0.5rem;
}

#main p {
    margin-bottom: 0.5rem;
}
#main p.button-container {
    text-align: center; 
}


/* items */

.item-cta {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: var(--color-grey-background);
    border-radius: var(--border-radius);
}
.button-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, var(--color-accent-secondary), var(--color-accent-secondary-dark));
    color: white;
    border-radius: var(--border-radius-large);
    text-decoration: none;
}
.button-cta:hover, .button-cta:focus, .button-cta:active {
    background: linear-gradient(135deg, var(--color-accent-dark), var(--color-accent-dark));
    color: white;
    text-decoration: none;
}
.button-cta.important {
    background: linear-gradient(135deg, var(--color-accent), var(--color-accent-dark));
}
.button-cta.important:hover, .button-cta.important:focus, .button-cta.important:active {
    background: linear-gradient(135deg, var(--color-accent), var(--color-accent-dark));
}
.button-cta.disabled {
    background: var(--color-grey-background);
    color: var(--color-text-secondary);
    cursor: not-allowed;
    font-style: italic;
}
.item-regular {
    background: white;
    padding: 1rem;
    border-radius: var(--border-radius);
    text-decoration: none;
    color: inherit;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s;
}
.item-regular.small {
    width: calc(100% - 2rem);
}
.item-regular.margined {
    margin-bottom: 1rem;
}
.item-regular:hover, .item-regular:focus, .item-regular:active {
    transform: translateY(-3px);
    text-decoration: none;
}

.item-regular-image {
    width: 4rem;
    height: 4rem;
    border-radius: 50%;
    object-fit: cover;
    margin: -3rem auto 0.5rem;
    display: block;
    border: 4px solid white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.item-regular:has(.item-regular-image) {
    margin-top: 2rem;
}

.item-regular h3 {
    margin: 10px 0;
    color: var(--color-accent-secondary);
    font-weight: bold;
}

.item-regular p {
    color: var(--color-text-secondary);
    margin-bottom: 15px;
    text-align: center;
}
.item-regular p.subtitle {
    font-variant: italic;
    text-align: center;
    display: block;
}
.item-regular p.description, .item-cta p.description {
    font-size: 0.9rem;
}
.item-regular p.description {
    text-align: left;
}

p.cancel-link {
    text-align: center;
}
p.cancel-link a {
    color: var(--color-red);
}

/* List items */
.list-container {
    display: flex;
    flex-direction: column;
    gap: 0;
    border-radius: 0.5rem;
    overflow: hidden;
}

.list-container a {
    display: block;
    width: 100%;
    padding: 1rem 0;
    text-align: left;
    background: none;
    border: none;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-primary);
    font-size: 1rem;
    cursor: pointer;
    position: relative;
}

.list-container a::after {
    content: "→";
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-secondary);
    transition: transform 0.2s ease;
}

.list-container a:hover::after {
    transform: translateY(-50%) translateX(-0.5rem);
}
.list-container a:active, .list-container a:focus, .list-container a:hover {
    text-decoration: none;
}

.res-message {
    text-align: center;
    margin-bottom: 1rem;
    padding: 1rem;
    background: var(--color-grey-background);
    border-radius: var(--border-radius);
}
.res-message.success {
    background: var(--color-green);
    color: white;
}
.res-message.error {
    background: var(--color-red);
}

#return-button a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
#return-button a:hover, #return-button a:focus, #return-button a:active {
    text-decoration: none;
}
#return-button.padded {
    margin: 1rem 0;
}

@media screen and (min-width: 1024px) {
    #main, .header, #navbar {
        width: 900px;
        margin: 0 auto;
    }
    
    .task-item {
        width: calc(900px - 2rem) !important;
        margin: 0 auto;
    }
}

#loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999999999999999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#loader.active {
    opacity: 1;
    visibility: visible;
}

#loader::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--color-accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#help-button {
    position: fixed;
    right: 20px;
    bottom: 20px;
    background-color: var(--color-accent-secondary);
    color: white;
    padding: 12px 20px;
    border-radius: 30px;
    text-decoration: none;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    z-index: 1000;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

#help-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

#help-button .help-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

#help-button .help-text > span:first-child {
    font-size: 1.1rem;
    font-weight: 600;
}

#help-button .help-legend {
    font-size: 0.7rem;
    font-style: italic;
}

#help-button .help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    font-size: 16px;
    font-weight: bold;
    flex-shrink: 0;
}

/* Cookie Banner */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 1rem;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 9999;
    display: none;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.cookie-banner.active {
    display: block;
    transform: translateY(0);
}

.cookie-banner-content {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.cookie-banner-text {
    flex: 1;
    font-size: 0.9rem;
    color: var(--color-text);
}

.cookie-banner-text a {
    color: var(--color-accent);
    text-decoration: underline;
}

.cookie-banner-buttons {
    display: flex;
    gap: 0.5rem;
}

.cookie-banner-button {
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cookie-banner-button.accept {
    background: var(--color-accent);
    color: white;
    border: none;
}

.cookie-banner-button.accept:hover {
    background: var(--color-accent-dark);
}

.cookie-banner-button.reject {
    background: none;
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

.cookie-banner-button.reject:hover {
    background: var(--color-grey-background);
}

@media screen and (max-width: 600px) {
    .cookie-banner-content {
        flex-direction: column;
        text-align: center;
    }
    
    .cookie-banner-buttons {
        width: 100%;
        justify-content: center;
    }
}