/* Custom styles for the Ukrainian Library */
:root {
    --ukrainian-gold: #FFD700;
    --ukrainian-gold-dark: #eeb83e;
    --ukrainian-blue: #0057B7;
    --text-dark: #0c4a74;
    --bg-light: #f8f5e9;
    --grey: #f5f5f5;
    --dark-grey: #ccc;
    --text-light: var(--primary-contrast);

    --accent-1: var(--ukrainian-blue);
    --accent-2: var(--ukrainian-gold);

    interpolate-size: allow-keywords;
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    color: var(--text-dark);
}

img {
    max-width: 100%;
}

.button.btn-primary,
.btn-primary {
    background: var(--ukrainian-blue) !important;
    color: white !important;
}

.button.btn-secondary,
.btn-secondary {
    background: transparent !important;
    color: var(--ukrainian-blue) !important;
    border: 2px solid var(--ukrainian-blue) !important;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    background-color: var(--bg-light);
    color: var(--text-dark);
    /* Ensure there's enough content to scroll */
    min-height: 100vh;
    display: grid;
    grid-template-rows: auto 1fr auto;
}

/* Navigation */

header {
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
    background-color: var(--bg-light);
    border-radius: 0 0 10px 10px;
    height: fit-content;
    margin-bottom: -10px;
}

main {
    padding-top: 10px;
}

header nav {
    border-radius: 0 0 10px 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 4rem;
    position: relative;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: bold;
    color: var(--ukrainian-blue);
    font-size: 1.1rem;
    padding: 1rem 2rem;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: 0 2rem;
    height: 100%;
}

.nav-menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    margin-right: 1rem;
    padding: 0;
    appearance: none;
    -webkit-appearance: none;
    border: none;
    border-radius: 999px;
    background: transparent !important;
    box-shadow: none !important;
    cursor: pointer;
}

.nav-menu-toggle span {
    color: var(--ukrainian-blue);
}

.profile-chip-copy {
    display: none;
}

.nav-links a {
    font-weight: 500;
    height: 100%;
    display: flex !important;
    justify-content: center;
    flex-direction: column;
}

.nav-links a::after {
    background-color: var(--ukrainian-gold) !important;
}

.nav-links a.selected::after {
    transform: scaleX(1) !important;
}

#language-toggle select,
#language-toggle select option {
    background: none;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    color: var(--ukrainian-blue);
}

#profile_button {
    display: grid;
    place-items: center;
}

#profile-container,
#collection-container {
    position: relative;
    display: inline-block;
    height: 100%;
}

#profile-container:hover #profile-controls,
#profile-controls:hover,
#collection-container:hover #collection-controls,
#collection-controls:hover,
#profile-container:focus-within #profile-controls,
#collection-container:focus-within #collection-controls {
    height: auto;
    border: 1px solid var(--dark-grey);
}

#profile-controls,
#collection-controls {
    position: absolute;
    top: 4rem;
    right: -7px;
    background: var(--bg-light);
    border: none;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    z-index: 1001;
    height: 0;
    min-width: 150px;
    box-sizing: border-box;
    transition: all 0.3s ease;
}

#collection-controls {
    right: 50%;
    transform: translateX(50%);
    width: max-content;
}

#profile-container:hover #profile-controls,
#profile-controls:hover,
#collection-container:hover #collection-controls,
#collection-controls:hover,
#profile-container:focus-within #profile-controls,
#collection-container:focus-within #collection-controls {
    padding: .5rem;
    height: auto;
    border: 1px solid var(--dark-grey);
}

#profile-controls a,
#collection-controls a {
    display: flex;
    align-items: center;
    justify-content: start;
    flex-direction: row;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 500;
}

#log-out-button,
#log-out-button * {
    color: var(--error-color) !important;
    font-weight: 600;
}

#profile_button .profile-pic {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--ukrainian-blue);
}

/* Footer */
.footer {
    background: var(--text-dark);
    color: var(--text-light);
    padding: 3rem 2rem 1rem;
    height: fit-content;
}

.footer-content {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1.5fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h4 {
    color: var(--ukrainian-gold);
    margin-bottom: 1rem;
    font-size: larger;
}

.footer-section ul {
    list-style: none;
    padding: 0;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.footer .footer-section ul li,
.footer .footer-section ul li span,
.footer .footer-section ul li a {
    color: var(--bg-light) !important;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-section ul li a:hover {
    color: var(--ukrainian-gold);
}

#newsletter {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#newsletter p {
    color: var(--bg-light);
}

#newsletter form {
    display: flex;
    align-items: stretch;
}

#newsletter form button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-width: 11rem;
    padding: 1rem;
    border-radius: 0 10px 10px 0;
    border: none;
    background-color: var(--ukrainian-gold) !important;
    color: var(--text-dark) !important;
    cursor: pointer;
    font-weight: 700;
    font-size: larger;
    transition: transform 0.25s ease, background-color 0.25s ease, box-shadow 0.25s ease;
}

#newsletter form input {
    margin: 0;
    font-size: large;
    padding: 1rem;
    border-radius: 10px 0 0 10px;
    border: none;
}

#newsletter form button:disabled {
    cursor: wait;
}

.newsletter-button-icon {
    width: 0;
    opacity: 0;
    transform: scale(0.6);
    overflow: hidden;
    transition: width 0.25s ease, opacity 0.25s ease, transform 0.25s ease;
}

#newsletter-form.is-loading button::after {
    content: '';
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(37, 54, 102, 0.25);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: newsletter-spin 0.8s linear infinite;
}

#newsletter-form.is-success button {
    background-color: #7ad29d !important;
    box-shadow: 0 10px 24px rgba(122, 210, 157, 0.3);
    animation: newsletter-success-pop 0.55s ease;
}

#newsletter-form.is-success .newsletter-button-icon {
    width: 1.25rem;
    opacity: 1;
    transform: scale(1);
}

#newsletter-form.has-error input[type="email"] {
    box-shadow: inset 0 0 0 2px rgba(255, 133, 117, 0.85);
}

.newsletter-feedback {
    min-height: 1.4rem;
    margin: 0.6rem 0 0;
    color: var(--bg-light);
    opacity: 0;
    transform: translateY(-0.25rem);
    transition: opacity 0.25s ease, transform 0.25s ease, color 0.25s ease;
}

.newsletter-feedback:not(:empty) {
    opacity: 1;
    transform: translateY(0);
}

.newsletter-feedback.is-success {
    color: #b6efc8;
}

.newsletter-feedback.is-error {
    color: #ffc0b5;
}

@keyframes newsletter-spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes newsletter-success-pop {
    0% {
        transform: scale(1);
    }

    45% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding-top: 1rem;
    text-align: center;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.social-links {
    display: flex;
    gap: 1rem;
}

.footer .social-links a {
    width: 2.75rem;
    height: 2.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--bg-light);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    text-decoration: none;
    transition: color 0.3s ease, background-color 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
}

.footer .social-links a i,
.footer .social-links a i::before {
    font-size: 1.2rem;
    line-height: 1;
    color: inherit !important;
}

.footer .social-links a:hover {
    color: var(--ukrainian-gold);
    background: rgba(255, 215, 0, 0.08);
    border-color: rgba(255, 215, 0, 0.45);
    transform: translateY(-2px);
}

.footer .social-links a:focus-visible {
    outline: 2px solid var(--ukrainian-gold);
    outline-offset: 3px;
}

@media (max-width: 900px) and (orientation: portrait) {
    header {
        margin-bottom: 0;
    }

    main {
        padding-top: 0;
    }

    header nav {
        height: auto;
        min-height: 4rem;
        flex-wrap: wrap;
        align-items: center;
        padding: 0.75rem 1rem 1rem;
        gap: 0.75rem;
    }

    .nav-brand {
        padding: 0;
        flex: 1;
        min-width: 0;
    }

    .nav-brand span {
        font-size: 1rem;
    }

    .nav-menu-toggle {
        display: inline-flex;
        margin-right: 0;
    }

    .nav-menu-toggle:hover,
    .nav-menu-toggle:focus-visible {
        background: rgba(0, 87, 183, 0.08) !important;
        outline: none;
    }

    .nav-links {
        display: flex;
        width: 100%;
        height: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
        padding: 0;
        overflow: clip;
        opacity: 0;
        pointer-events: none;
        transition: height 320ms ease, opacity 220ms ease, margin-top 320ms ease;
    }

    #site-navigation.menu-open .nav-links {
        height: auto;
        opacity: 1;
        pointer-events: auto;
        margin-top: 0.25rem;
        transition: height 320ms ease, opacity 220ms ease, margin-top 320ms ease;
    }

    .nav-links>a,
    #language-toggle,
    #profile_button,
    #collection-container>a {
        min-height: auto;
        border-radius: 16px;
        background: rgba(255, 255, 255, 0.78);
        padding: 0.9rem 1rem;
        justify-content: flex-start;
        align-items: center;
        flex-direction: row;
        box-shadow: 0 10px 30px rgba(0, 87, 183, 0.08);
    }

    .nav-links>a.selected,
    #collection-container>a.selected,
    #profile_button.selected {
        box-shadow: inset 0 0 0 2px rgba(255, 215, 0, 0.8), 0 10px 30px rgba(0, 87, 183, 0.08);
    }

    .nav-links a::after {
        display: none;
    }

    #collection-container,
    #profile-container {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
        height: auto;
    }

    #profile_button {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: flex-start;
        gap: 0.75rem;
    }

    #profile_button .profile-pic {
        margin-right: 0;
        flex-shrink: 0;
    }

    #profile_button .material-symbols-outlined {
        flex-shrink: 0;
    }

    .profile-chip-copy {
        display: inline;
        font-weight: 600;
    }

    #language-toggle {
        display: block;
    }

    #language-toggle select {
        width: 100%;
        min-height: 1.5rem;
        font-size: 1rem;
    }

    #profile-controls,
    #collection-controls {
        position: static;
        top: auto;
        right: auto;
        transform: none;
        display: flex;
        flex-direction: column;
        gap: 0.35rem;
        width: 100%;
        min-width: 0;
        height: auto;
        padding: 0.5rem;
        overflow: visible;
        border: 1px solid rgba(12, 74, 116, 0.12);
        border-radius: 16px;
        background: rgba(255, 255, 255, 0.64);
        box-shadow: none;
    }

    #profile-controls a,
    #collection-controls a {
        border-radius: 12px;
        background: rgba(248, 245, 233, 0.9);
        padding: 0.75rem 0.9rem;
        white-space: normal;
    }

    .footer {
        padding: 2.5rem 1.25rem 1rem;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    #newsletter form {
        flex-direction: column;
        gap: 0.75rem;
    }

    #newsletter form input,
    #newsletter form button {
        width: 100%;
        border-radius: 12px;
    }

    .footer-bottom {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .social-links {
        flex-wrap: wrap;
    }

    #toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }

    .toast {
        min-width: auto;
        max-width: none;
    }
}

/* Toast Notification Styles */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
}

.toast {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    min-width: 300px;
    max-width: 400px;
    position: relative;
    overflow: hidden;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast.hide {
    opacity: 0;
    transform: translateX(100%);
}

/* Toast Themes */
.toast.success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.toast.error {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.toast.warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.toast.info {
    background: linear-gradient(135deg, var(--ukrainian-blue), #0051a3);
    color: white;
    border: 1px solid rgba(0, 87, 183, 0.3);
}

.toast.default {
    background: linear-gradient(135deg, #6b7280, #4b5563);
    color: white;
    border: 1px solid rgba(107, 114, 128, 0.3);
}

.toast.info *,
.toast.default * {
    color: var(--bg-light);
}

/* Toast Icon */
.toast-icon {
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-icon .material-symbols-outlined {
    font-size: 24px;
    font-variation-settings: 'FILL' 1;
}

/* Toast Content */
.toast-content {
    flex: 1;
    font-size: 14px;
    line-height: 1.4;
    font-weight: 500;
}

/* Toast Close Button */
button.toast-close {
    margin-left: 12px;
    border: none;
    color: inherit;
    cursor: pointer;
    background: none;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

button.toast-close:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
    padding: 4px;
    margin: 0 4px 0 12px;
}

.toast-close .material-symbols-outlined {
    font-size: 18px;
}

/* Progress Bar */
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 0 0 8px 8px;
    transition: width linear;
}

/* Responsive Design */
@media (max-width: 768px) and (orientation: portrait) {
    #toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }

    .toast {
        min-width: auto;
        max-width: none;
    }
}