:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --text-primary: #333333;
    --text-secondary: #666666;
    --header-bg: #ffffff;
    --menu-bg: #dee4ea;
    --accent: #3498db;
    --border: #dee2e6;
    --card-bg: #ffffff;
    --shadow: rgba(0,0,0,0.1);
}

[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --text-primary: #e0e0e0;
    --text-secondary: #f7f1f1;
    --link: #12f0fc;
    --header-bg: #1a1a1a;
    --menu-bg: #2d2d2d;
    --accent: #64b5f6;
    --border: #404040;
    --card-bg: #2d2d2d;
    --shadow: rgba(0,0,0,0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    transition: background-color 0.3s, color 0.3s;
}

/* Sticky Header */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--header-bg);
    color: var(--text-primary);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    box-shadow: 0 2px 5px var(--shadow);
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
}

/* Hamburger Menu Button */
.menu-toggle {
   background: var(--menu-bg);
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    transition: background 0.3s;
}

.menu-toggle:hover,
.menu-toggle:focus {
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
    outline: 2px solid var(--accent);
}

/* Side Menu */
.side-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 300px;
    height: 100vh;
    background: var(--menu-bg);
    transition: left 0.3s ease;
    z-index: 1001;
    overflow-y: auto;
}

.side-menu.closed {
    left: -300px;
}

.menu-header {
    position: sticky;
    top: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--menu-bg);
    color: var(--text-primary);
    z-index: 10;
}

.menu-close {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
}

.menu-close:hover,
.menu-close:focus {
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
    outline: 2px solid var(--accent);
}

nav ul {
    list-style: none;
    padding: 1rem 0;
}

nav ul li {
    margin: 0;
}

nav ul li a {
    display: block;
    padding: 1rem 1.5rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: background 0.3s;
}

nav ul li a:hover,
nav ul li a:focus {
    background: var(--header-bg);
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

nav ul li a.active {
    background: var(--header-bg);
    border-left: 4px solid var(--accent);
    padding-left: calc(1.5rem - 4px);
    font-weight: bold;
}

.menu-divider {
    padding: 1.5rem 1.5rem 0.5rem;
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.menu-text-block {
    padding: 1rem 1.5rem;
    color: rgb(48, 47, 47);
    font-size: 0.875rem;
    line-height: 1.5;
    border-left: 3px solid var(--accent);
    margin: 1rem 1rem;
    background: rgba(255,255,255,0.05);
    border-radius: 4px;
}

.menu-text-block p {
    margin-bottom: 0.5rem;
    color: rgb(48, 47, 47);
}

.menu-text-block p:last-child {
    margin-bottom: 0;
}

/* Theme Toggle */
.theme-toggle {
    padding: 1rem 1.5rem;
    margin: 0 1rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.theme-toggle label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.theme-toggle input[type="checkbox"] {
    width: 50px;
    height: 24px;
    appearance: none;
    background: var(--accent);
    border-radius: 12px;
    position: relative;
    cursor: pointer;
    transition: background 0.3s;
}

.theme-toggle input[type="checkbox"]:checked {
    background: var(--accent);
}

.theme-toggle input[type="checkbox"]::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--bg-primary);
    top: 2px;
    left: 2px;
    transition: left 0.3s;
}

.theme-toggle input[type="checkbox"]:checked::before {
    left: 28px;
}

/* Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 999;
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Main Content */
main {
    margin-top: 60px;
    margin-left: 300px;
    padding: 2rem;
    max-width: calc(100% - 300px);
    width: 100%;
    transition: margin-left 0.3s ease, max-width 0.3s ease;
}

main.menu-closed {
    margin-left: auto;
    margin-right: auto;
    max-width: 1200px;
}

section {
    margin-bottom: 1.5rem;
}

h1, h2, h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

h1 {
    font-size: 2.5rem;
}

h2 {
    font-size: 1.55rem;
}

h3 {
    font-size: 1.5rem;
}

p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

img {
    max-width: 100%;
    height: auto;
}

a {
    color: var(--link);
}

.responsive-img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.img-small {
    max-width: 300px;
    width: 100%;
    height: auto;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.img-medium {
    max-width: 600px;
    width: 100%;
    height: auto;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.img-large {
    max-width: 900px;
    width: 100%;
    height: auto;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.img-centered {
    display: block;
    margin-left: auto;
    margin-right: auto;
}

/* Grid Layout */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

/* Flexbox Layout */
.flex {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    margin-bottom: 2rem;
}

.flex > * {
    flex: 1 1 250px;
}

/* Cards */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px var(--shadow);
    transition: transform 0.3s, box-shadow 0.3s;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 8px var(--shadow);
}

.card h3 {
    margin-bottom: 0.5rem;
}

.card p {
    margin-bottom: 0;
}

/* Lists */
.styled-list {
    list-style: none;
    padding-left: 0;
}

.styled-list li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
    color: var(--text-secondary);
}

.styled-list li::before {
    content: "\f061";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    position: absolute;
    left: 0;
    color: var(--accent);
}

.list-unstyled {
    list-style: none;
    padding-left: 0;
}

.list-unstyled li {
    padding: 0.5rem 0;
}

.list-unstyled-compact {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.list-unstyled-compact li {
    padding: 0;
    margin: 0;
}

/* Share Button */
.share-container {
    position: relative;
    /*display: inline-block;*/
    margin-bottom: 2rem;
    float: right;
}

.share-button {
    background: var(--accent);
    color: var(--bg-primary);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.3s, transform 0.2s;
    box-shadow: 0 2px 4px var(--shadow);
}

.share-button:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px var(--shadow);
}

.share-button:active {
    transform: translateY(0);
}

.share-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 12px var(--shadow);
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.3s, transform 0.3s, visibility 0.3s;
    z-index: 100;
}

.share-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.share-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: background 0.2s;
    border-bottom: 1px solid var(--border);
}

.share-option:last-child {
    border-bottom: none;
    border-radius: 0 0 8px 8px;
}

.share-option:first-child {
    border-radius: 8px 8px 0 0;
}

.share-option:hover {
    background: var(--bg-secondary);
}

.share-option i {
    width: 20px;
    text-align: center;
}

.share-option[data-share="facebook"]:hover i {
    color: #1877f2;
}

.share-option[data-share="twitter"]:hover i {
    color: #1da1f2;
}

.share-option[data-share="linkedin"]:hover i {
    color: #0077b5;
}

.share-option[data-share="email"]:hover i {
    color: #ea4335;
}

.share-option[data-share="copy"]:hover i {
    color: var(--accent);
}

/* Clear float for content below */
.share-container + section {
    clear: both;
}

/* Responsive Iframe Container */
.responsive-iframe {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.responsive-iframe iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Collapsible Sections */
.collapsible {
    margin-bottom: 1rem;
    border:0;
}

.collapsible-header {
    background: var(--card-bg);
    border: 1px solid var(--border);
    padding: 1rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 8px;
    transition: background 0.3s;
    color: var(--text-primary);
}

.collapsible-header:hover {
    background: var(--bg-secondary);
}

.collapsible-header::after {
    content: "+";
    font-size: 1.5rem;
    color: var(--accent);
    transition: transform 0.3s;
}

.collapsible-header.active::after {
    transform: rotate(45deg);
}

.collapsible-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: var(--card-bg);
    /*border: 1px solid var(--border);*/
    border-top: none;
    border-radius: 0 0 8px 8px;
}

.collapsible-content-inner {
    padding: 1rem;
}

/* Tabs */
.tabs {
    margin-bottom: 2rem;
}

.tab-buttons {
    display: flex;
    gap: 0.5rem;
    border-bottom: 2px solid var(--border);
    margin-bottom: 1rem;
}

.tab-button {
    background: none;
    border: none;
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.3s, border-color 0.3s;
}

.tab-button:hover {
    color: var(--accent);
}

.tab-button.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.tab-content {
    display: none;
    padding: 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.tab-content.active {
    display: block;
}

/* Footer */
footer {
    background: var(--header-bg);
    color: var(--bg-primary);
    padding: 3rem 2rem 1rem;
    margin-top: 4rem;
    margin-left: 300px;
    transition: margin-left 0.3s ease;
}

footer.menu-closed {
    margin-left: 0;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3 {
    color: var(--bg-primary);
    margin-bottom: 1rem;
}

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

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: color 0.3s;
}

.footer-section a:hover {
    color: var(--bg-primary);
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.6);
}

.icon {
    width: 1em;
    height: 1em;
    vertical-align: -0.125em;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .side-menu {
        left: -300px;
    }

    .side-menu.active {
        left: 0;
    }

    .side-menu.closed {
        left: -300px;
    }

    .share-container {
        float: none;
        display: block;
        margin-bottom: 1rem;
    }
    
    .share-button {
        width: 100%;
        justify-content: center;
    }
    
    .share-dropdown {
        right: auto;
        left: 0;
        width: 100%;
    }

    main {
        margin-left: auto;
        margin-right: auto;
        max-width: 1200px;
    }

    main.menu-closed {
        margin-left: auto;
        max-width: 1200px;
    }

    footer {
        margin-left: 0;
    }

    footer.menu-closed {
        margin-left: 0;
    }

    header .logo {
        display: block;
    }
}

@media (max-width: 768px) {
    header {
        padding: 1rem;
    }

    .logo {
        font-size: 1.2rem;
    }

    main {
        padding: 1rem;
    }

    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    .grid {
        grid-template-columns: 1fr;
    }

    .tab-buttons {
        flex-wrap: wrap;
    }

    footer {
        padding: 2rem 1rem 1rem;
    }
}

@media (max-width: 480px) {
    .side-menu {
        width: 80%;
        left: -80%;
    }

    .side-menu.active {
        left: 0;
    }

    .side-menu.closed {
        left: -80%;
    }
}

/* Skip to content link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--accent);
    color: var(--bg-primary);
    padding: 0.5rem 1rem;
    text-decoration: none;
    z-index: 100;
}

.skip-link:focus {
    top: 0;
}

/* Print Styles */
@media print {
    /* Hide interactive elements */
    .menu-toggle,
    .menu-close,
    .side-menu,
    .overlay,
    .share-container,
    .share-button,
    .share-dropdown,
    .theme-toggle {
        display: none !important;
    }

    /* Keep header but simplify it */
    header {
        position: static;
        background: white;
        color: black;
        border-bottom: 2px solid black;
        box-shadow: none;
    }

    header .logo {
        color: black;
    }

    /* Reset layout for print */
    body {
        background: white;
        color: black;
    }

    main {
        margin-left: 0 !important;
        margin-top: 0 !important;
        max-width: 100%;
        padding: 0;
    }

    main.menu-closed {
        margin-left: 0;
    }

    footer {
        margin-left: 0 !important;
        background: white;
        color: black;
        border-top: 2px solid black;
    }

    /* Add page breaks */
    h1, h2, h3 {
        page-break-after: avoid;
        page-break-inside: avoid;
    }

    .card {
        page-break-inside: avoid;
    }

    .collapsible {
        page-break-inside: avoid;
    }

    .tabs {
        page-break-inside: avoid;
    }

    /* Simplify cards for print */
    .card {
        border: 1px solid #ddd;
        box-shadow: none;
        margin-bottom: 1rem;
    }

    /* Ensure images fit on page */
    img {
        max-width: 100%;
        page-break-inside: avoid;
    }

    /* Optimize text for print */
    body {
        font-size: 12pt;
        line-height: 1.5;
    }

    h1 {
        font-size: 24pt;
    }

    h2 {
        font-size: 18pt;
    }

    h3 {
        font-size: 14pt;
    }

    /* Allow #plaque to keep its background image */
    .plaque {
        background: inherit !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        /*color-adjust: exact !important;*/
    }    

    @page {
        size: letter portrait;
        margin: 0.5in;
    }

    /* Ensure single page layout */
    main {
        margin-left: 0 !important;
        margin-top: 0 !important;
        max-width: 100%;
        padding: 0;
    }

    /* Header - keep compact */
    header {
        position: static;
        background: white;
        color: black;
        border-bottom: 2px solid black;
        box-shadow: none;
        padding: 0.5rem 1rem;
        margin-bottom: 0.5rem;
    }

    header .logo {
        color: black;
        font-size: 1.2rem;
    }

    /* Title section */
    section#home h1 {
        font-size: 16pt;
        margin-bottom: 0.25rem;
    }

    section#home > p {
        font-size: 10pt;
        margin-bottom: 0.5rem;
    }

    /* First row: Plaque card and QR code side by side */
    section#layouts > .flex:first-of-type {
        display: grid !important;
        grid-template-columns: 2fr 1fr;
        gap: 0.5rem;
        margin-bottom: 0.5rem;
        page-break-inside: avoid;
    }

    .plaque ul {
        font-size: 9pt;
        line-height: 1.3;
    }

    .plaque li {
        margin-bottom: 0.1rem;
    }

    /* QR code card - printOnly */
    .card.printOnly {
        padding: 0.5rem;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }

    .card.printOnly p {
        font-size: 8pt;
        margin: 0.25rem 0;
        text-align: center;
    }

    .photo-qrcode {
        width: 80px;
        height: 80px;
    }

    /* Second row: Pictures (up to 2) */
    section#layouts > .flex:nth-of-type(2) {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
        margin-bottom: 0.5rem;
        page-break-inside: avoid;
    }

    /* Limit image sizes */
    section#layouts > .flex:nth-of-type(2) .card {
        padding: 0.25rem;
        max-height: 200px;
        overflow: hidden;
    }

    section#layouts > .flex:nth-of-type(2) img {
        max-height: 180px;
        width: auto;
        object-fit: contain;
    }

    /* Third row: Map */
    section#layouts > .flex:nth-of-type(3) {
        page-break-inside: avoid;
        margin-bottom: 0;
    }

    section#layouts > .flex:nth-of-type(3) .card {
        padding: 0.25rem;
    }

    /* Map container */
    .responsive-iframe {
        padding-bottom: 55% !important; /* Shorter aspect ratio for print */
        max-height: 300px;
    }

    /* General card adjustments */
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }

    /* Footer - minimize */
    footer {
        margin-left: 0 !important;
        margin-top: 0.5rem;
        padding: 0.5rem;
        background: white;
        color: black;
        border-top: 1px solid black;
    }

    .footer-bottom {
        padding-top: 0.25rem;
        font-size: 8pt;
    }
}