/* Mobile Improvements for Haus Peinsipp */

/* ===== Desktop Footer Sticky to Bottom (Desktop Only) ===== */
@media screen and (min-width: 1024px) {
    html {
        height: 100%;
    }

    body {
        min-height: 100%;
        display: flex;
        flex-direction: column;
    }

    #container {
        flex: 1 0 auto;
    }

    #footer,
    #copyright {
        flex-shrink: 0;
    }

    /* Right column minimum height on desktop */
    aside#right_column {
        min-height: 60em;
    }
}

/* ===== Mobile Burger Menu ===== */

/* Hide burger menu on desktop */
.mobile-menu-button {
    display: none;
}

/* Show burger menu on mobile */
@media screen and (max-width: 1023px) {
    /* Make header fixed positioning context */
    .wrapper.row1 {
        position: relative;
    }

    #header {
        position: relative;
        min-height: 60px;
    }

    .mobile-menu-button {
        display: block;
        position: fixed;
        top: 15px;
        right: 15px;
        z-index: 1000;
        background-color: #FF9900;
        border: none;
        border-radius: 5px;
        padding: 12px 15px;
        cursor: pointer;
        box-shadow: 0 2px 5px rgba(0,0,0,0.3);
        transition: background-color 0.3s ease;
    }

    .mobile-menu-button:hover {
        background-color: #e68a00;
    }

    .mobile-menu-button:active {
        background-color: #cc7a00;
    }

    /* Burger icon lines */
    .burger-line {
        display: block;
        width: 25px;
        height: 3px;
        background-color: white;
        margin: 5px 0;
        transition: all 0.3s ease;
        border-radius: 2px;
    }

    /* Animate burger to X when menu is open */
    .mobile-menu-button.active .burger-line:nth-child(1) {
        transform: rotate(-45deg) translate(-5px, 6px);
    }

    .mobile-menu-button.active .burger-line:nth-child(2) {
        opacity: 0;
    }

    .mobile-menu-button.active .burger-line:nth-child(3) {
        transform: rotate(45deg) translate(-5px, -6px);
    }

    /* Hide navigation by default on mobile */
    aside#right_column {
        position: fixed !important;
        top: 0 !important;
        right: -350px !important;
        width: 280px !important;
        height: 100vh !important;
        background-color: #FFFFFF !important;
        box-shadow: -2px 0 10px rgba(0,0,0,0.3) !important;
        overflow-y: auto !important;
        transition: right 0.3s ease !important;
        z-index: 999 !important;
        padding: 70px 20px 20px 20px !important;
        margin: 0 !important;
        float: none !important;
        display: block !important;
        visibility: visible !important;
    }

    /* Show navigation when menu is open */
    aside#right_column.menu-open {
        right: 0 !important;
    }

    /* Better navigation styling */
    aside#right_column h2 {
        text-align: left !important;
        padding-bottom: 10px !important;
        margin-bottom: 15px !important;
        border-bottom: 2px solid #FF9900 !important;
        font-size: 1.2em !important;
    }

    aside#right_column nav ul {
        list-style: none !important;
        list-style-type: none !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    aside#right_column nav li {
        margin: 0 !important;
        padding: 0 !important;
        border-bottom: 1px solid #f0f0f0 !important;
        list-style: none !important;
        list-style-type: none !important;
    }

    aside#right_column nav li:before {
        content: none !important;
        display: none !important;
    }

    aside#right_column nav li:last-child {
        border-bottom: none !important;
    }

    aside#right_column nav a {
        display: block !important;
        color: #515151 !important;
        text-decoration: none !important;
        transition: all 0.2s ease !important;
        position: relative !important;
        background: none !important;
        background-image: none !important;
        padding-left: 15px !important;
    }

    aside#right_column nav a:before,
    aside#right_column nav a:after {
        content: none !important;
        display: none !important;
    }

    aside#right_column nav a:hover,
    aside#right_column nav a:active {
        background-color: #f8f8f8 !important;
        background-image: none !important;
        color: #FF9900 !important;
    }

    /* Contact section styling */
    aside#right_column section {
        margin-top: 30px !important;
    }

    aside#right_column address {
        line-height: 1.8 !important;
        font-style: normal !important;
    }

    /* Overlay when menu is open */
    body.menu-open::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 998;
    }

    /* Prevent body scroll when menu is open */
    body.menu-open {
        overflow: hidden;
    }
}

/* Make all tables responsive */
@media screen and (max-width: 800px) {
    /* Make images fully responsive and centered */
    img {
        max-width: 100% !important;
        width: auto !important;
        height: auto !important;
        display: block !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    /* Center images in table cells */
    td img {
        margin: 0 auto !important;
    }

    /* Table responsiveness - keep table structure but make scrollable */
    table {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: auto !important;
        display: block !important;
        -webkit-overflow-scrolling: touch !important;
    }

    table tbody,
    table thead,
    table tfoot {
        display: table !important;
        width: 100% !important;
    }

    table tr {
        display: table-row !important;
    }

    table td,
    table th {
        display: table-cell !important;
        padding: 8px !important;
        font-size: 0.9em !important;
    }

    /* For gallery tables - different behavior */
    table tr td img {
        width: 100% !important;
        max-width: 300px !important;
        height: auto !important;
    }

    /* Navigation improvements - REMOVED, handled by burger menu above */

    /* Form improvements */
    input[type="text"],
    input[type="email"],
    textarea,
    select {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box;
        font-size: 16px !important; /* Prevents zoom on iOS */
    }

    /* Button improvements */
    input[type="button"],
    input[type="submit"],
    input[type="reset"] {
        padding: 12px 20px;
        font-size: 16px;
        min-height: 44px; /* Apple's recommended touch target size */
    }

    /* Header improvements */
    #header {
        text-align: center;
    }

    /* Content divs - full width on mobile */
    .Div {
        width: 100% !important;
        padding: 10px;
        box-sizing: border-box;
    }

    /* Typography improvements */
    h1 {
        font-size: 1.5em !important;
        line-height: 1.3;
    }

    h2 {
        font-size: 1.3em !important;
        line-height: 1.3;
    }

    p {
        font-size: 1em;
        line-height: 1.6;
    }

    /* Address block */
    address {
        font-size: 0.95em;
        line-height: 1.6;
    }

    /* Content alignment fixes */
    #container {
        width: 100% !important;
        padding: 0 !important;
    }

    #container .pad {
        padding: 15px !important;
    }

    /* Center all content */
    table {
        margin: 0 auto !important;
    }

    /* Fix left-aligned text and images */
    td[align="center"],
    p[align="center"],
    h1[align="center"],
    h2[align="center"] {
        text-align: center !important;
    }

    /* Footer improvements */
    #footer {
        text-align: center !important;
    }

    #footer .one_third,
    #footer .one_quarter {
        width: 100% !important;
        float: none !important;
        margin-bottom: 30px !important;
        padding: 0 15px !important;
        box-sizing: border-box !important;
    }

    #footer h2 {
        border-bottom: 2px solid #FF9900 !important;
        padding-bottom: 10px !important;
        margin-bottom: 15px !important;
    }

    #footer nav ul {
        list-style: none !important;
        list-style-type: none !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    #footer nav li {
        border-bottom: 1px solid #f0f0f0 !important;
        list-style: none !important;
        list-style-type: none !important;
        background: none !important;
    }

    #footer nav li:before,
    #footer nav li:after {
        content: none !important;
        display: none !important;
    }

    #footer nav li:last-child {
        border-bottom: none !important;
    }

    #footer nav a {
        color: #FF9900 !important;
        text-decoration: none !important;
        display: inline-block !important;
        transition: color 0.2s ease !important;
        background: none !important;
    }

    #footer nav a:before,
    #footer nav a:after {
        content: none !important;
        display: none !important;
    }

    #footer nav a:hover {
        color: #e68a00 !important;
        text-decoration: underline !important;
    }

    /* Additional overrides for footer links */
    #footer section nav ul li {
        list-style-image: none !important;
    }

    #footer section nav ul li a {
        padding-left: 0 !important;
        background-image: none !important;
    }

    /* Copyright */
    #copyright {
        padding: 20px 15px !important;
    }

    #copyright p {
        text-align: center !important;
        font-size: 0.85em !important;
        margin: 0 !important;
    }

    /* Facebook like box */
    .fb-like-box {
        width: 100% !important;
    }

    /* List improvements */
    ul {
        padding-left: 20px;
    }

    ul li {
        margin-bottom: 10px;
        line-height: 1.5;
    }
}

/* Extra small screens */
@media screen and (max-width: 480px) {
    /* Even smaller text adjustments */
    table td, table th {
        font-size: 0.8em;
        padding: 5px !important;
    }

    h1 {
        font-size: 1.3em !important;
    }

    h2 {
        font-size: 1.1em !important;
    }

    /* Stack gallery images on very small screens */
    table tr {
        display: block;
        margin-bottom: 20px;
    }
}

/* Landscape orientation improvements */
@media screen and (max-width: 900px) and (orientation: landscape) {
    body {
        font-size: 95%;
    }
}

/* Improve touch targets */
@media (pointer: coarse) {
    a, button, input[type="button"], input[type="submit"] {
        min-height: 24px;
        min-width: 44px;
        display: inline-block;
    }

    nav li {
        padding: 5px 0;
    }

    nav a {
        display: block;
        padding: 10px 15px;
    }
}
