/**
 * DeepRoots — shared mobile / responsive rules (all surfaces)
 */

/* Prevent iOS zoom on form focus */
@media (max-width: 768px) {
    .deeproots-form-group input,
    .deeproots-form-group select,
    .deeproots-form-group textarea,
    .dr-form-stack input,
    .dr-form-stack select,
    .dr-form-stack textarea,
    .dr-member-form--full .dr-input,
    .dr-member-form--full select.dr-input,
    .dr-member-form--full .dr-textarea {
        font-size: 16px;
    }
}

/* Touch-friendly controls */
@media (max-width: 768px) {
    .dr-icon-btn,
    .dr-btn,
    .deeproots-submit-btn,
    .deeproots-modal-close,
    .modal .close,
    .dr-modal__close {
        min-height: 44px;
        min-width: 44px;
    }

    .dr-btn:not(.dr-icon-btn) {
        min-width: auto;
        padding-top: 12px;
        padding-bottom: 12px;
    }

    /* Dashboard hero buttons use fixed dimensions in dashboard.css */
    .dr-hero-actions .dr-btn {
        padding-top: 0;
        padding-bottom: 0;
        min-width: 0;
    }
}

/* Family tree / showcase login modal — stay centered on mobile */
@media (max-width: 768px) {
    .deeproots-modal.is-open,
    body.deeproots-showcase-page .deeproots-modal.is-open,
    body.deeproots-standalone .deeproots-modal.is-open,
    .dr-showcase + .deeproots-modal.is-open {
        display: flex !important;
        flex-direction: row;
        align-items: center !important;
        justify-content: center !important;
        padding: 16px !important;
        box-sizing: border-box;
    }

    .deeproots-modal-content {
        box-sizing: border-box;
        width: 100%;
        max-width: min(420px, calc(100vw - 32px));
        margin-left: auto !important;
        margin-right: auto !important;
        max-height: min(90vh, 100%);
        min-height: 0;
        border-radius: 16px;
        padding: 28px 22px 24px;
    }
}

@media (max-width: 480px) {
    .deeproots-modal.is-open,
    body.deeproots-showcase-page .deeproots-modal.is-open,
    body.deeproots-standalone .deeproots-modal.is-open {
        padding: 12px !important;
    }

    .deeproots-modal-content {
        max-width: calc(100vw - 24px);
        padding: 24px 18px 20px;
    }
}

/* App modals — centered layout on mobile (see modals-ui.css for full rules) */
@media (max-width: 768px) {
    .dr-modal__body,
    .modal-content > .dr-modal__body,
    #notificationsBody,
    #messagesBody,
    #feedBody,
    #calendarBody {
        padding: 16px 18px 20px;
    }
}

/* Standalone / showcase header — collapsible nav */
.deeproots-header-nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 10px;
    margin-left: auto;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    cursor: pointer;
    flex-shrink: 0;
}

.deeproots-header-nav-toggle span {
    display: block;
    height: 2px;
    width: 100%;
    background: #fff;
    border-radius: 1px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.deeproots-header.is-menu-open .deeproots-header-nav-toggle span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.deeproots-header.is-menu-open .deeproots-header-nav-toggle span:nth-child(2) {
    opacity: 0;
}

.deeproots-header.is-menu-open .deeproots-header-nav-toggle span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 640px) {
    .deeproots-header-content {
        flex-wrap: nowrap;
        position: relative;
        padding: 0 16px;
    }

    .deeproots-header-nav-toggle {
        display: flex;
    }

    .deeproots-header nav {
        display: none;
        position: absolute;
        top: calc(100% + 8px);
        left: 16px;
        right: 16px;
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        padding: 12px;
        background: rgba(15, 23, 42, 0.98);
        border: 1px solid rgba(255, 255, 255, 0.12);
        border-radius: 12px;
        box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
        z-index: 10010;
    }

    .deeproots-header.is-menu-open nav {
        display: flex;
    }

    .deeproots-header nav a {
        text-align: center;
        padding: 12px 16px;
    }

    .deeproots-footer {
        padding: 28px 16px;
    }

    .deeproots-footer-content {
        padding: 0 16px;
        font-size: 14px;
    }
}

/* Feed / message lists in modals */
@media (max-width: 640px) {
    .dr-feed-post,
    .dr-message-item,
    .calendar-event-item {
        padding: 12px;
    }

    .dr-rsvp-actions,
    .dr-form-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .dr-rsvp-actions .dr-btn,
    .dr-form-actions .dr-btn {
        width: 100%;
        justify-content: center;
    }
}
