/**
 * Toad Patrol Theme - Mobile Optimizations
 * iOS and Android specific enhancements for the theme
 * Version: 1.0.0
 */

/* ========================================
   MOBILE BUTTON & TOUCH OPTIMIZATIONS
   ======================================== */

/* Global touch optimization - prevent delays on ALL clickable elements */
a,
button,
input,
select,
textarea,
[role="button"],
[onclick] {
    /* Eliminate 300ms tap delay */
    -ms-touch-action: manipulation;
    touch-action: manipulation;
}

/* Ensure buttons and links are touch-friendly */
.btn,
.button,
a.wp-block-button__link,
button[type="submit"],
input[type="submit"],
.toad-cta-button {
    /* Prevent 300ms tap delay on mobile */
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(0, 123, 255, 0.2);

    /* Ensure buttons are clickable */
    pointer-events: auto !important;
    cursor: pointer;

    /* Minimum touch target size (44x44px for iOS, 48x48px for Android) */
    min-height: 44px;
    min-width: 44px;

    /* Better touch feedback */
    transition:
        transform 0.1s ease,
        background-color 0.2s ease;
    -webkit-user-select: none;
    user-select: none;

    /* Ensure single tap/click works */
    -webkit-touch-callout: none;
}

/* Ensure links inside buttons work properly */
a.btn,
a.button,
a.wp-block-button__link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Active/touching state for visual feedback */
.btn:active,
.btn.touching,
.button:active,
.button.touching,
button[type="submit"]:active,
button[type="submit"].touching,
input[type="submit"]:active,
input[type="submit"].touching {
    transform: scale(0.98);
    opacity: 0.9;
}

/* Ensure forms and form elements work on mobile */
form {
    touch-action: auto;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

form button,
form input[type="submit"] {
    position: relative;
    z-index: 1;
}

/* WPForms mobile base styles - detailed overrides in mobile-fixes.css */
.wpforms-container,
.wpforms-form {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.wpforms-field-container {
    width: 100%;
    box-sizing: border-box;
}

.wpforms-field {
    width: 100%;
    margin-bottom: 1.25rem;
}

/* Form inputs - base mobile styling */
.wpforms-field input[type="text"],
.wpforms-field input[type="email"],
.wpforms-field input[type="tel"],
.wpforms-field input[type="number"],
.wpforms-field textarea,
.wpforms-field select {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    font-size: 16px;
    min-height: 48px;
    padding: 12px 16px;
}

.wpforms-submit-container {
    width: 100%;
    text-align: center;
    margin-top: 1.25rem;
}

.wpforms-submit {
    width: 100%;
    max-width: 100%;
    min-height: 48px;
    font-size: 16px;
    padding: 14px 24px;
    box-sizing: border-box;
}

/* ========================================
   LOGO ANIMATION
   ======================================== */

/* Keyframe animation for floating logo effect */
@-webkit-keyframes logoFloat {

    0%,
    100% {
        -webkit-transform: translateY(0px);
        transform: translateY(0px);
    }

    50% {
        -webkit-transform: translateY(-5px);
        transform: translateY(-5px);
    }
}

@-moz-keyframes logoFloat {

    0%,
    100% {
        -moz-transform: translateY(0px);
        transform: translateY(0px);
    }

    50% {
        -moz-transform: translateY(-5px);
        transform: translateY(-5px);
    }
}

@-o-keyframes logoFloat {

    0%,
    100% {
        -o-transform: translateY(0px);
        transform: translateY(0px);
    }

    50% {
        -o-transform: translateY(-5px);
        transform: translateY(-5px);
    }
}

@keyframes logoFloat {

    0%,
    100% {
        -webkit-transform: translateY(0px);
        -moz-transform: translateY(0px);
        -ms-transform: translateY(0px);
        -o-transform: translateY(0px);
        transform: translateY(0px);
    }

    50% {
        -webkit-transform: translateY(-5px);
        -moz-transform: translateY(-5px);
        -ms-transform: translateY(-5px);
        -o-transform: translateY(-5px);
        transform: translateY(-5px);
    }
}

/* ========================================
   MOBILE VIEWPORT & SAFE AREAS
   ======================================== */

/* iOS Safe Area Support for Theme */
/* Prevent zoom on input focus (iOS) */
input,
select,
textarea,
button {
    font-size: 16px !important;
}

/* Prevent body scroll when menu is open */
body.menu-open {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
    height: 100%;
}

/* Ensure header stays full width */
.header-main,
.header-top {
    width: 100%;
    max-width: 100%;
}

/* ========================================
   MOBILE HEADER & NAVIGATION
   ======================================== */

@media (max-width: 1024px) {

    /* Site Header - Always Full Width */
    .site-header {
        position: sticky;
        top: 0;
        left: 0;
        right: 0;
        width: 100vw !important;
        max-width: 100vw !important;
        margin: 0 !important;
        z-index: 1000;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
        overflow: visible !important;
    }

    .header-top {
        display: none !important;
        /* Hide top bar on mobile */
    }

    /* Ensure container doesn't restrict header width on mobile */
    .header-main .tp-container {
        max-width: 100% !important;
        width: 100% !important;
        padding: 0 !important;
    }

    .header-main {
        padding: 14px 0;
        background: linear-gradient(135deg, #2e7d32 0%, #1b5e20 100%);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    }

    .header-content {
        display: flex !important;
        justify-content: space-between;
        align-items: center;
        gap: 15px;
        padding: 0 15px;
        max-width: 100%;
        background: transparent;
    }

    .site-branding {
        flex: 1 1 auto;
        display: flex !important;
        align-items: center;
        gap: 12px;
        min-width: 0;
        overflow: visible;
        visibility: visible !important;
        opacity: 1 !important;
    }

    /* Improved logo sizing - properly visible on mobile */
    .site-logo {
        display: flex !important;
        align-items: center;
        flex-shrink: 0;
        visibility: visible !important;
    }

    .site-logo img,
    .custom-logo {
        display: block !important;
        height: 55px !important;
        max-height: 55px !important;
        width: auto !important;
        max-width: 55px !important;
        object-fit: contain;
        visibility: visible !important;
        opacity: 1 !important;
        border-radius: 4px;
    }

    .site-logo img:hover,
    .custom-logo:hover {
        -webkit-transform: scale(1.02);
        -moz-transform: scale(1.02);
        -ms-transform: scale(1.02);
        -o-transform: scale(1.02);
        transform: scale(1.02);
    }

    .site-logo-text {
        display: flex !important;
        flex-direction: column;
        min-width: 0;
        flex: 1 1 auto;
        visibility: visible !important;
        opacity: 1 !important;
    }

    /* Improved title visibility and sizing on mobile */
    .site-title {
        display: block !important;
        font-size: clamp(0.9rem, 4.2vw, 1.2rem) !important;
        margin: 0 !important;
        line-height: 1.15;
        white-space: normal;
        word-wrap: break-word;
        color: #ffffff !important;
        font-weight: 700 !important;
        visibility: visible !important;
        opacity: 1 !important;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    }

    .site-title a {
        color: #ffffff !important;
        text-decoration: none !important;
        display: block;
    }

    .site-tagline {
        display: block !important;
        font-size: 0.68rem !important;
        margin: 3px 0 0 0 !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        color: rgba(255, 255, 255, 0.92) !important;
        visibility: visible !important;
        opacity: 1 !important;
        font-weight: 400;
    }

    /* Hide header CTA on mobile */
    .header-cta {
        display: none !important;
    }

    /* Mobile Navigation Toggle - Fixed Hamburger Design */
    .menu-toggle {
        display: flex !important;
        visibility: visible !important;
        align-items: center;
        justify-content: center;
        width: 50px !important;
        min-width: 50px !important;
        max-width: 50px !important;
        height: 50px !important;
        padding: 10px !important;
        border: 2px solid rgba(255, 255, 255, 0.5);
        background: rgba(255, 255, 255, 0.18);
        border-radius: 8px;
        color: white;
        cursor: pointer !important;
        flex-direction: column;
        gap: 5px;
        flex-shrink: 0;
        z-index: 10005 !important;
        -webkit-tap-highlight-color: rgba(46, 125, 50, 0.2);
        -ms-touch-action: manipulation;
        touch-action: manipulation !important;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
        transition: all 0.2s ease;
        position: relative !important;
        margin-left: auto;
        pointer-events: auto !important;
    }

    .menu-toggle:hover,
    .menu-toggle:focus {
        background: rgba(255, 255, 255, 0.28);
        border-color: rgba(255, 255, 255, 0.7);
        transform: scale(1.03);
        box-shadow: 0 3px 12px rgba(0, 0, 0, 0.3);
    }

    .menu-toggle span:not(.menu-label) {
        display: block;
        width: 24px;
        height: 2.5px;
        background: #ffffff;
        border-radius: 2px;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        pointer-events: none;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    }

    .menu-toggle .menu-label {
        display: block !important;
        position: absolute;
        top: -24px;
        left: 50%;
        transform: translateX(-50%);
        font-size: 11px;
        font-weight: bold;
        color: white !important;
        text-transform: uppercase;
        letter-spacing: 1px;
        white-space: nowrap;
        pointer-events: none;
        z-index: 10006;
        text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    }

    .menu-toggle[aria-expanded="true"] span:nth-child(1),
    .menu-toggle.is-active span:nth-child(1) {
        transform: rotate(45deg) translateY(8px);
    }

    .menu-toggle[aria-expanded="true"] span:nth-child(2),
    .menu-toggle.is-active span:nth-child(2) {
        opacity: 0;
        transform: translateX(20px);
    }

    .menu-toggle[aria-expanded="true"] span:nth-child(3),
    .menu-toggle.is-active span:nth-child(3) {
        transform: rotate(-45deg) translateY(-8px);
    }

    .menu-toggle:active {
        transform: scale(0.92);
        background: rgba(255, 255, 255, 0.3);
    }

    /* Mobile Menu Overlay - White Semi-transparent Design - Force display on mobile */
    .main-navigation,
    #site-navigation,
    nav#site-navigation.main-navigation {
        position: fixed !important;
        top: 0 !important;
        right: -100% !important;
        width: 85% !important;
        max-width: 380px !important;
        height: 100vh !important;
        height: 100dvh !important;
        background: rgba(27, 94, 32, 0.95) !important;
        box-shadow: -8px 0 32px rgba(0, 0, 0, 0.3) !important;
        transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1) !important;
        z-index: 10001 !important;
        overflow-y: auto !important;
        overscroll-behavior: contain !important;
        display: block !important;
        visibility: visible !important;
        -webkit-backdrop-filter: blur(12px) !important;
        backdrop-filter: blur(12px) !important;
    }

    .main-navigation.active,
    #site-navigation.active,
    nav#site-navigation.main-navigation.active {
        right: 0 !important;
        box-shadow: -8px 0 40px rgba(0, 0, 0, 0.25) !important;
    }

    /* Mobile Menu Header */
    .mobile-menu-header {
        position: sticky;
        top: 0;
        z-index: 10003;
        -webkit-backdrop-filter: blur(10px);
        backdrop-filter: blur(10px);
    }

    .main-navigation .nav-menu,
    .main-navigation .menu {
        display: block !important;
        flex-direction: column;
        padding: 0 0 60px;
        margin: 0;
        list-style: none;
        gap: 0;
    }

    .main-navigation .nav-menu>li,
    .main-navigation .menu>li {
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        margin: 0;
        position: relative;
    }

    .main-navigation .nav-menu>li::before,
    .main-navigation .menu>li::before {
        content: "";
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        width: 4px;
        background: #fdd835;
        transform: scaleY(0);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .main-navigation .nav-menu>li:active::before,
    .main-navigation .menu>li:active::before {
        transform: scaleY(1);
    }

    .main-navigation .nav-menu>li>a,
    .main-navigation .menu>li>a {
        display: flex !important;
        padding: 20px 28px;
        color: #fdd835 !important;
        font-size: 17px;
        font-weight: bold;
        text-decoration: none;
        transition: all 0.2s ease;
        min-height: 64px;
        align-items: center;
        background: transparent !important;
        border-radius: 0;
        letter-spacing: 0.3px;
    }

    .main-navigation .nav-menu>li>a:active,
    .main-navigation .menu>li>a:active {
        background: linear-gradient(90deg,
                rgba(253, 216, 53, 0.2) 0%,
                transparent 100%) !important;
        padding-left: 32px;
        color: #fdd835 !important;
    }

    /* Close button - Inside White Header */
    .mobile-menu-close {
        width: 44px;
        height: 44px;
        border: 2px solid rgba(253, 216, 53, 0.3);
        background: rgba(253, 216, 53, 0.15);
        border-radius: 12px;
        font-size: 22px;
        font-weight: 300;
        cursor: pointer;
        display: flex !important;
        align-items: center;
        justify-content: center;
        z-index: 10004;
        color: #fdd835;
        -webkit-tap-highlight-color: transparent;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        transition: all 0.2s ease;
    }

    .mobile-menu-close:active {
        transform: scale(0.92) rotate(90deg);
        background: rgba(253, 216, 53, 0.25);
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
    }

    /* Menu overlay backdrop - Improved */
    .menu-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.65);
        z-index: 10000;
        -webkit-tap-highlight-color: transparent;
        opacity: 0;
        visibility: hidden;
        transition:
            opacity 0.3s ease,
            visibility 0.3s ease;
        -webkit-backdrop-filter: blur(2px);
        backdrop-filter: blur(2px);
    }

    .menu-overlay.active {
        opacity: 1 !important;
        visibility: visible !important;
    }

    /* Sub-menus - Enhanced */
    .main-navigation .sub-menu {
        display: none;
        list-style: none;
        padding-left: 0;
        margin: 0;
        background: rgba(76, 175, 80, 0.04);
        border-left: 3px solid var(--tp-green);
    }

    .main-navigation .sub-menu li a {
        padding: 14px 28px 14px 52px;
        font-size: 15px;
        font-weight: 500;
        color: #546e7a !important;
    }

    .main-navigation .sub-menu li a:active {
        background: rgba(76, 175, 80, 0.08) !important;
    }

    .main-navigation .menu-item-has-children>a::after {
        content: "\f107";
        font-family: "Font Awesome 6 Free";
        font-weight: 900;
        margin-left: auto;
        padding-left: 12px;
        font-size: 14px;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        opacity: 0.6;
    }

    .main-navigation .menu-item-has-children.active>a::after {
        transform: rotate(180deg);
        opacity: 1;
    }

    /* Menu Footer Visual */
    .main-navigation::after {
        content: "";
        position: sticky;
        bottom: 0;
        display: block;
        width: 100%;
        height: 60px;
        background: linear-gradient(to top,
                rgba(27, 94, 32, 1) 0%,
                rgba(27, 94, 32, 0) 100%);
        pointer-events: none;
        z-index: 1;
    }

    /* Smooth scroll indicator */
    .main-navigation::-webkit-scrollbar {
        width: 6px;
    }

    .main-navigation::-webkit-scrollbar-track {
        background: rgba(0, 0, 0, 0.05);
    }

    .main-navigation::-webkit-scrollbar-thumb {
        background: rgba(46, 125, 50, 0.4);
        border-radius: 3px;
    }

    .main-navigation::-webkit-scrollbar-thumb:active {
        background: rgba(46, 125, 50, 0.6);
    }
}

/* ========================================
   MOBILE HERO SECTION
   ======================================== */

@media (max-width: 768px) {
    .hero-section {
        padding: 40px 20px;
        min-height: 400px;
        background-size: cover;
        background-position: center;
    }

    .hero-content {
        text-align: center;
    }

    .hero-title {
        font-size: 32px;
        line-height: 1.2;
        margin-bottom: 20px;
    }

    .hero-subtitle {
        font-size: 18px;
        margin-bottom: 30px;
    }

    .hero-buttons {
        display: flex;
        flex-direction: column;
        gap: 12px;
        margin-top: 24px;
    }

    .hero-btn {
        width: 100%;
        min-height: 52px;
        padding: 16px 24px;
        font-size: 16px;
        border-radius: 8px;
        font-weight: 600;
        text-align: center;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
    }

    /* Prevent body scroll when menu is open */
    body.menu-open {
        overflow: hidden !important;
        position: fixed;
        width: 100%;
        height: 100vh;
    }
}

/* ========================================
   MOBILE CONTENT SECTIONS
   ======================================== */

@media (max-width: 768px) {
    .content-area {
        padding: 30px 20px;
    }

    .entry-header {
        margin-bottom: 24px;
    }

    .entry-title {
        font-size: 28px;
        line-height: 1.3;
        margin-bottom: 16px;
    }

    .entry-content {
        font-size: 16px;
        line-height: 1.7;
    }

    .entry-content h2 {
        font-size: 24px;
        margin-top: 32px;
        margin-bottom: 16px;
    }

    .entry-content h3 {
        font-size: 20px;
        margin-top: 24px;
        margin-bottom: 12px;
    }

    .entry-content img {
        max-width: 100%;
        height: auto;
        border-radius: 8px;
    }

    .entry-content iframe,
    .entry-content video {
        max-width: 100%;
        height: auto;
        aspect-ratio: 16/9;
    }

    /* WordPress blocks */
    .wp-block-image {
        margin: 24px 0;
    }

    .wp-block-gallery {
        gap: 12px !important;
    }

    .wp-block-columns {
        flex-direction: column !important;
    }

    .wp-block-column {
        flex-basis: 100% !important;
        margin-bottom: 24px;
    }
}

/* ========================================
   MOBILE SIDEBAR
   ======================================== */

@media (max-width: 1024px) {
    .sidebar {
        width: 100%;
        margin-top: 40px;
        padding: 0 20px;
    }

    .widget {
        padding: 20px;
        margin-bottom: 24px;
        background: var(--tp-gray-light);
        border-radius: 12px;
    }

    .widget-title {
        font-size: 20px;
        margin-bottom: 16px;
    }

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

    .widget ul li {
        padding: 10px 0;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    }

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

    .widget ul li a {
        display: block;
        padding: 8px 0;
        min-height: 44px;
        display: flex;
        align-items: center;
    }
}

/* ========================================
   MOBILE FOOTER
   ======================================== */

@media (max-width: 768px) {
    .site-footer {
        padding: 40px 20px 20px;
        text-align: center;
    }

    .footer-widgets {
        display: flex;
        flex-direction: column;
        gap: 32px;
        margin-bottom: 32px;
    }

    .footer-widget {
        width: 100%;
    }

    .footer-widget-title {
        font-size: 18px;
        margin-bottom: 16px;
    }

    .footer-menu {
        list-style: none;
        padding: 0;
        margin: 0;
    }

    .footer-menu li {
        margin-bottom: 12px;
    }

    .footer-menu a {
        display: inline-block;
        padding: 8px 0;
        min-height: 44px;
        font-size: 15px;
    }

    .footer-social {
        display: flex;
        justify-content: center;
        gap: 16px;
        margin-top: 24px;
    }

    .footer-social a {
        width: 48px;
        height: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: var(--tp-green-primary);
        color: white;
        border-radius: 50%;
        font-size: 20px;
    }

    .site-info {
        padding-top: 24px;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        font-size: 14px;
    }
}

/* ========================================
   MOBILE BUTTONS & FORMS
   ======================================== */

@media (max-width: 768px) {

    /* Buttons */
    .btn,
    .button,
    button[type="submit"],
    input[type="submit"] {
        min-height: 48px;
        padding: 12px 24px;
        font-size: 16px;
        border-radius: 8px;
        cursor: pointer;
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    }

    .btn-primary {
        background: var(--tp-green-primary);
        color: white;
        border: none;
    }

    .btn-primary:active {
        background: var(--tp-green-dark);
        transform: scale(0.98);
    }

    .btn-full-width {
        width: 100%;
        display: block;
    }

    /* Forms */
    .form-group {
        margin-bottom: 20px;
    }

    .form-control,
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="url"],
    input[type="password"],
    input[type="date"],
    input[type="number"],
    select,
    textarea {
        width: 100%;
        min-height: 48px;
        padding: 12px 16px;
        font-size: 16px;
        border: 2px solid var(--tp-gray-medium);
        border-radius: 8px;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
    }

    textarea {
        min-height: 120px;
        resize: vertical;
    }

    select {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 16px center;
        padding-right: 40px;
    }

    /* Checkboxes and radios */
    input[type="checkbox"],
    input[type="radio"] {
        width: 24px;
        height: 24px;
        min-height: 24px;
    }

    label {
        display: block;
        margin-bottom: 8px;
        font-weight: 600;
        font-size: 15px;
    }

    .form-hint {
        font-size: 14px;
        color: var(--tp-gray-medium);
        margin-top: 6px;
    }
}

/* ========================================
   MOBILE TABLES
   ======================================== */

@media (max-width: 768px) {
    table {
        display: block;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        border: none;
    }

    table thead {
        display: none;
    }

    table tbody {
        display: block;
    }

    table tr {
        display: block;
        margin-bottom: 20px;
        border: 1px solid var(--tp-gray-light);
        border-radius: 8px;
        padding: 16px;
        background: white;
    }

    table td {
        display: flex;
        justify-content: space-between;
        padding: 10px 0;
        border: none;
        border-bottom: 1px solid var(--tp-gray-light);
    }

    table td:last-child {
        border-bottom: none;
    }

    table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--tp-gray-dark);
        margin-right: 10px;
    }
}

/* ========================================
   MOBILE COMMENTS
   ======================================== */

@media (max-width: 768px) {
    .comment-list {
        padding: 0;
        margin: 0;
        list-style: none;
    }

    .comment {
        padding: 20px;
        margin-bottom: 20px;
        background: var(--tp-gray-light);
        border-radius: 12px;
    }

    .comment-author {
        display: flex;
        align-items: center;
        gap: 12px;
        margin-bottom: 12px;
    }

    .comment-author img {
        border-radius: 50%;
        width: 48px;
        height: 48px;
    }

    .comment-content {
        font-size: 15px;
        line-height: 1.6;
    }

    .comment-reply-link {
        display: inline-block;
        margin-top: 12px;
        padding: 8px 16px;
        background: var(--tp-green-primary);
        color: white;
        border-radius: 6px;
        text-decoration: none;
        font-size: 14px;
        min-height: 40px;
        display: inline-flex;
        align-items: center;
    }

    .comment-form {
        margin-top: 32px;
    }

    .comment-form label {
        display: block;
        margin-bottom: 8px;
    }

    .comment-form input,
    .comment-form textarea {
        width: 100%;
    }
}

/* ========================================
   MOBILE STATISTICS PAGE
   ======================================== */

@media (max-width: 768px) {
    .statistics-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 16px;
        padding: 20px;
    }

    .stat-card {
        padding: 24px;
        background: white;
        border-radius: 12px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        text-align: center;
    }

    .stat-value {
        font-size: 36px;
        font-weight: 700;
        color: var(--tp-green-primary);
        display: block;
        margin-bottom: 8px;
    }

    .stat-label {
        font-size: 14px;
        color: var(--tp-gray-dark);
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    .chart-container {
        margin: 24px 0;
        padding: 20px;
        background: white;
        border-radius: 12px;
        overflow-x: auto;
        overscroll-behavior-x: contain;
    }
}

/* ========================================
   MOBILE SPECIES IDENTIFICATION
   ======================================== */

@media (max-width: 768px) {
    .species-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 20px;
    }

    .species-card {
        background: white;
        border-radius: 12px;
        overflow: hidden;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    }

    .species-image {
        width: 100%;
        height: 200px;
        object-fit: cover;
    }

    .species-content {
        padding: 20px;
    }

    .species-title {
        font-size: 22px;
        margin-bottom: 12px;
        color: var(--tp-green-primary);
    }

    .species-description {
        font-size: 15px;
        line-height: 1.6;
        margin-bottom: 16px;
    }

    .species-features {
        list-style: none;
        padding: 0;
        margin: 0;
    }

    .species-features li {
        padding: 8px 0;
        padding-left: 28px;
        position: relative;
        font-size: 14px;
    }

    .species-features li::before {
        content: "✓";
        position: absolute;
        left: 0;
        color: var(--tp-success);
        font-weight: 700;
    }
}

/* ========================================
   MOBILE PATROL GUIDE
   ======================================== */

@media (max-width: 768px) {
    .patrol-steps {
        padding: 20px;
    }

    .patrol-step {
        padding: 24px;
        margin-bottom: 20px;
        background: white;
        border-left: 4px solid var(--tp-green-primary);
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    }

    .step-number {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        background: var(--tp-green-primary);
        color: white;
        border-radius: 50%;
        font-weight: 700;
        font-size: 20px;
        margin-bottom: 12px;
    }

    .step-title {
        font-size: 20px;
        margin-bottom: 12px;
        color: var(--tp-green-primary);
    }

    .step-description {
        font-size: 15px;
        line-height: 1.6;
    }

    .safety-tips {
        padding: 20px;
        background: var(--tp-warning);
        color: var(--tp-black);
        border-radius: 12px;
        margin: 24px 20px;
    }

    .safety-tips h3 {
        display: flex;
        align-items: center;
        gap: 10px;
        font-size: 20px;
        margin-bottom: 16px;
    }

    .safety-tips ul {
        padding-left: 20px;
        margin: 0;
    }

    .safety-tips li {
        margin-bottom: 10px;
        font-size: 15px;
        line-height: 1.5;
    }
}

/* ========================================
   MOBILE TOUCH IMPROVEMENTS
   ======================================== */

/* Remove hover effects on touch devices */
@media (hover: none) {

    .btn:hover,
    .button:hover,
    a:hover {
        transform: none;
        background: inherit;
    }
}

/* Active states for touch */
.btn:active,
.button:active {
    transform: scale(0.97);
    opacity: 0.9;
}

a:active {
    opacity: 0.7;
}

/* Better tap highlighting */
* {
    -webkit-tap-highlight-color: rgba(46, 125, 50, 0.1);
}

/* Prevent text selection on buttons */
.btn,
.button,
button {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* ========================================
   MOBILE LANDSCAPE MODE
   ======================================== */

@media (max-width: 896px) and (orientation: landscape) {
    .hero-section {
        min-height: 300px;
        padding: 30px 20px;
    }

    .hero-title {
        font-size: 28px;
    }

    /* Removed - using .menu-toggle instead */
    .menu-toggle-legacy {
        width: 44px;
        height: 44px;
    }

    .site-header {
        padding: 8px 20px;
    }
}

/* ========================================
   ACCESSIBILITY - REDUCED MOTION
   ======================================== */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        -webkit-animation-duration: 0.01ms !important;
        -moz-animation-duration: 0.01ms !important;
        -o-animation-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        -webkit-animation-iteration-count: 1 !important;
        -moz-animation-iteration-count: 1 !important;
        -o-animation-iteration-count: 1 !important;
        animation-iteration-count: 1 !important;
        -webkit-transition-duration: 0.01ms !important;
        -moz-transition-duration: 0.01ms !important;
        -o-transition-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ========================================
   MOBILE BROWSER COMPATIBILITY
   ======================================== */

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {

    /* iOS-specific sticky header fix */
    .site-header {
        position: -webkit-sticky;
        position: sticky;
    }

    /* iOS input zoom disable */
    input,
    select,
    textarea {
        font-size: 16px !important;
    }
}

/* Android Chrome fixes */
@media screen and (max-width: 767px) {

    /* Fix for Android Chrome address bar */
    .hero-section {
        min-height: calc(100vh - 56px);
        min-height: calc(100dvh - 56px);
        /* Dynamic viewport height */
    }
}

/* Samsung Internet Browser fixes */
@supports (-webkit-appearance: none) {
    select {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 16px center;
    }
}

/* Old Android Browser (4.x) fallbacks */
@media screen and (-webkit-min-device-pixel-ratio: 0) {

    input[type="date"],
    input[type="time"],
    input[type="datetime-local"] {
        -webkit-appearance: listbox;
    }
}

/* Microsoft Edge Mobile */
@supports (-ms-ime-align: auto) {
    .site-header {
        position: sticky;
    }
}

/* ========================================
   DARK MODE SUPPORT
   ======================================== */

@media (prefers-color-scheme: dark) {
    @media (max-width: 768px) {
        body {
            background: #1a1a18;
            color: #f0f0ed;
        }

        .site-header,
        .site-footer {
            background: #2d2d2a;
            color: #f0f0ed;
        }

        .widget,
        .comment,
        .stat-card,
        .species-card,
        .patrol-step {
            background: #2d2d2a;
            color: #f0f0ed;
        }

        input,
        select,
        textarea {
            background: #3d3d38;
            color: #f0f0ed;
            border-color: #4a4a45;
        }
    }
}

/* ========================================
   PRINT STYLES (MOBILE)
   ======================================== */

@media print {

    .site-header,
    .site-footer,
    .sidebar,
    .menu-toggle,
    .btn,
    .button,
    .comment-form {
        display: none !important;
    }

    body {
        font-size: 12pt;
        line-height: 1.5;
    }

    .content-area {
        width: 100%;
        padding: 0;
    }
}

/* ========================================
   EXTRA SMALL MOBILE DEVICES (< 480px)
   ======================================== */
@media (max-width: 480px) {

    /* Adjust logo size for very small screens but keep it visible */
    .site-logo img,
    .custom-logo {
        height: 50px !important;
        max-height: 50px !important;
        width: auto !important;
        max-width: 50px !important;
    }

    /* Adjust title sizing for small screens */
    .site-title {
        font-size: clamp(0.85rem, 5vw, 1rem) !important;
        line-height: 1.15;
    }

    .site-tagline {
        font-size: 0.6rem !important;
    }

    .header-main {
        padding: 10px 0;
    }

    .header-content {
        padding: 0 12px;
        gap: 10px;
    }

    /* Slightly smaller hamburger on very small screens */
    .menu-toggle {
        width: 48px;
        height: 48px;
    }

    .menu-toggle span:not(.menu-label) {
        width: 22px;
    }
}

/* ========================================
   LANDSCAPE PHONE OPTIMIZATION
   ======================================== */
@media (max-width: 900px) and (max-height: 500px) and (orientation: landscape) {

    .site-logo img,
    .custom-logo {
        max-height: 60px !important;
    }

    .site-title {
        font-size: 0.9rem !important;
    }

    .site-tagline {
        display: none;
    }

    .header-main {
        padding: 8px 0;
    }
}
