/* =============================================================
   Catholic Organizer — Mobile-Responsive Stylesheet
   Drop this file into: assets/css/organizer-mobile.css
   Then enqueue it in catholic-organizer.php (see instructions
   at the bottom of this file).
   ============================================================= */

/* ── 1. CONTAINER ─────────────────────────────────────────── */
.catholic-organizer-container {
    width: 100% !important;
    max-width: 1000px !important;
    margin: 0 auto !important;
    padding: 40px !important;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* ── 2. META BAR (Parish / Role row) ─────────────────────── */
.organizer-meta {
    margin-bottom: 25px;
    font-size: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

/* ── 3. TAB NAV ───────────────────────────────────────────── */
.organizer-tabs-nav {
    border-bottom: 2px solid #006699;
    margin-bottom: 0;
}

.organizer-tabs-nav ul {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
    display: flex;
    gap: 4px;
    flex-wrap: wrap;          /* allows wrapping on small screens */
}

.organizer-tabs-nav li {
    margin: 0 !important;
    padding: 0 !important;
}

.organizer-tabs-nav a {
    display: block;
    padding: 10px 16px;       /* slightly tighter than 12px 20px */
    border-radius: 4px 4px 0 0;
    font-weight: bold;
    font-size: 14px;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
}

.organizer-tabs-nav a.tab-active {
    background: #006699 !important;
    color: #fff !important;
}

.organizer-tabs-nav a.tab-inactive {
    background: #f1f1f1 !important;
    color: #333 !important;
}

.organizer-tabs-nav a.tab-inactive:hover {
    background: #dde8f0 !important;
    color: #006699 !important;
}

/* ── 4. TAB CONTENT PANEL ────────────────────────────────── */
.organizer-tab-content {
    padding: 25px;
    background: #fff;
    border: 1px solid #ccc;
    border-top: none;
    border-radius: 0 0 4px 4px;
}

/* ── 5. HOME — sub-tab nav (Announcements / Discussions) ─── */
.organizer-subtab-nav {
    display: flex;
    gap: 5px;
    margin-bottom: 25px;
    border-bottom: 1px solid #ccc;
    padding-bottom: 0;
    flex-wrap: wrap;
}

.organizer-subtab-nav a {
    padding: 10px 18px;
    border-radius: 4px 4px 0 0;
    text-decoration: none;
    font-weight: bold;
    border: 1px solid #ccc;
    border-bottom: none;
    white-space: nowrap;
}

/* ── 6. HOME — discussion filter tag row ─────────────────── */
.organizer-tag-filters {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    align-items: center;
    font-size: 14px;
}

.organizer-tag-filters a {
    padding: 4px 10px;
    border-radius: 4px;
    text-decoration: none;
    border: 1px solid #ccc;
    white-space: nowrap;
}

/* Discussion action bar (button + filters) */
.organizer-discussion-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    border-bottom: 2px solid #eee;
    padding-bottom: 15px;
    margin-bottom: 25px;
}

/* ── 7. HOME — new discussion form ───────────────────────── */
/* Title + Tag row */
.organizer-discussion-form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.organizer-discussion-form-row .field-title {
    flex: 3;
}

.organizer-discussion-form-row .field-tag {
    flex: 1;
    min-width: 130px;
}

/* ── 8. FILES — upload form row ──────────────────────────── */
.organizer-file-upload-row {
    display: flex;
    gap: 15px;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.organizer-file-upload-row .field-file {
    flex: 2;
    min-width: 200px;
}

.organizer-file-upload-row .field-desc {
    flex: 3;
    min-width: 200px;
}

/* Files grid */
.organizer-files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
}

/* ── 9. BOOKMARKS grid ────────────────────────────────────── */
.organizer-bookmarks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
}

/* ── 10. MEDIA PICKER MODAL ──────────────────────────────── */
.organizer-media-modal-content {
    width: 80%;
    max-width: 900px;
    max-height: 80vh;
}

/* ── 11. DISCUSSION THREAD — header meta row ─────────────── */
.organizer-thread-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

/* ── 12. GENERAL FORM INPUTS ─────────────────────────────── */
.organizer-input,
.organizer-select,
.organizer-textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 15px;
    font-family: inherit;
}

/* ── 13. ACTION BUTTON ROW ───────────────────────────────── */
.organizer-action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #eee;
    padding-bottom: 15px;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 10px;
}

/* ── 14. CALENDAR — toolbar (Add Event + view toggles) ───── */
.organizer-calendar-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    border-bottom: 2px solid #eee;
    padding-bottom: 15px;
    margin-bottom: 25px;
}

.organizer-btn-add {
    background: #28a745;
    color: #fff;
    padding: 8px 15px;
    text-decoration: none;
    border-radius: 4px;
    font-weight: bold;
    white-space: nowrap;
}

.organizer-view-toggles {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.organizer-toggle-btn {
    border: 1px solid #006699;
    padding: 6px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    white-space: nowrap;
    transition: background 0.2s, color 0.2s;
}

.organizer-toggle-active {
    background: #006699;
    color: #fff;
}

.organizer-toggle-inactive {
    background: #fff;
    color: #006699;
}

/* ── 15. CALENDAR — event form 2-column rows ──────────────── */
.organizer-form-row-2col {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.organizer-form-col {
    flex: 1;
    min-width: 0;
}

/* ── 16. CALENDAR — event list item meta row ──────────────── */
.organizer-event-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    color: #666;
    font-size: 14px;
    margin-bottom: 10px;
}

/* ── 17. CONTACTS — pill sub-tab nav ─────────────────────── */
.organizer-contacts-subnav {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #eee;
    align-items: center;
}

.organizer-pill-btn {
    display: inline-block;
    padding: 8px 18px;
    border-radius: 20px;
    text-decoration: none;
    font-weight: bold;
    font-size: 14px;
    white-space: nowrap;
    line-height: 1.4;
    transition: background 0.2s, color 0.2s;
}

.pill-active {
    background: #006699;
    color: #fff !important;
}

.pill-inactive {
    background: #eef0f2;
    color: #333 !important;
}

.pill-inactive:hover {
    background: #dde8f0;
    color: #006699 !important;
}

/* Privacy box wrapper — dashed border around both privacy selects */
.organizer-privacy-box {
    padding: 15px;
    background: #fff;
    border: 1px dashed #ccc;
    border-radius: 6px;
    margin-bottom: 15px;
}
.organizer-name-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.organizer-name-prefix { flex: 1; min-width: 0; }
.organizer-name-first  { flex: 2; min-width: 0; }
.organizer-name-last   { flex: 2; min-width: 0; }

/* ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ─
   MOBILE BREAKPOINTS
   ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── */

/* ── Tablet: ≤ 768px ─────────────────────────────────────── */
@media (max-width: 768px) {

    .catholic-organizer-container {
        padding: 20px !important;
    }

    .organizer-tab-content {
        padding: 18px;
    }

    .organizer-tabs-nav a {
        padding: 9px 13px;
        font-size: 13px;
    }

    .organizer-bookmarks-grid {
        grid-template-columns: 1fr;
    }

    .organizer-discussion-form-row {
        flex-direction: column;
        gap: 10px;
    }

    .organizer-discussion-form-row .field-tag {
        min-width: unset;
    }

    .organizer-thread-header {
        flex-direction: column;
    }

    /* Calendar: hide grid view on tablet too — list is better at this width */
    .organizer-grid-toggle,
    .organizer-calendar-grid-view {
        display: none !important;
    }

    /* Calendar toolbar: stack button above toggles */
    .organizer-calendar-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }

    /* Calendar form: date/time 2-col rows stack */
    .organizer-form-row-2col {
        flex-direction: column;
        gap: 10px;
    }

    /* Contacts: pill nav wraps naturally (already flex-wrap) */
    .organizer-contacts-subnav {
        gap: 6px;
    }

    /* Contacts name row: stack prefix above first+last */
    .organizer-name-row {
        flex-wrap: wrap;
    }

    .organizer-name-prefix {
        flex: 0 0 100%;  /* full width on its own line */
    }
}

/* ── Mobile: ≤ 480px ─────────────────────────────────────── */
@media (max-width: 480px) {

    .catholic-organizer-container {
        padding: 12px !important;
    }

    /* Page title */
    .catholic-organizer-container .entry-title {
        font-size: 1.6em !important;
    }

    /* Tab nav — each tab expands to fill a row of two */
    .organizer-tabs-nav ul {
        gap: 3px;
    }

    .organizer-tabs-nav li {
        flex: 1 1 calc(33% - 3px); /* 3 tabs per row */
        min-width: 0;
    }

    .organizer-tabs-nav a {
        padding: 9px 6px;
        font-size: 12px;
        text-align: center;
        border-radius: 4px 4px 0 0;
    }

    .organizer-tab-content {
        padding: 14px;
    }

    /* Sub-tab nav */
    .organizer-subtab-nav {
        flex-direction: column;
        gap: 0;
        border-bottom: none;
    }

    .organizer-subtab-nav a {
        border-radius: 4px;
        margin-bottom: 4px;
        border: 1px solid #ccc;
    }

    /* Discussion toolbar: stack button above filters */
    .organizer-discussion-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }

    /* Tag filters: allow to wrap freely */
    .organizer-tag-filters {
        gap: 4px;
    }

    .organizer-tag-filters a {
        font-size: 12px;
        padding: 3px 8px;
    }

    /* Files upload row: fully stacked */
    .organizer-file-upload-row {
        flex-direction: column;
        gap: 8px;
    }

    .organizer-files-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 12px;
    }

    /* Bookmarks */
    .organizer-bookmarks-grid {
        grid-template-columns: 1fr;
    }

    /* Action bars */
    .organizer-action-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    /* Media picker modal — full-screen on mobile */
    .organizer-media-modal-content {
        width: 95% !important;
        max-height: 90vh !important;
    }

    /* Calendar: hide grid toggle button and grid view entirely on mobile */
    .organizer-grid-toggle,
    .organizer-calendar-grid-view {
        display: none !important;
    }

    /* Discussion thread header */
    .organizer-thread-header {
        flex-direction: column;
    }

    /* Calendar toolbar: fully stacked, add-button full width */
    .organizer-calendar-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .organizer-btn-add {
        text-align: center;
    }

    .organizer-view-toggles {
        justify-content: center;
    }

    /* Calendar form: date/time rows stack */
    .organizer-form-row-2col {
        flex-direction: column;
        gap: 8px;
    }

    /* Calendar event list meta: each item on its own line */
    .organizer-event-meta-row {
        flex-direction: column;
        gap: 4px;
    }

    /* Home tag filters: ~3 per row so they wrap onto 2 lines nicely */
    .organizer-tag-filters a {
        flex: 1 1 calc(33% - 5px);
        text-align: center;
        min-width: 80px;
    }

    /* Contacts pill nav: 2 per row (3rd wraps underneath) */
    .organizer-pill-btn {
        display: inline-block;
        flex: 1 1 calc(50% - 6px);
        text-align: center;
        min-width: 100px;
        box-sizing: border-box;
    }

    /* Contacts name row: fully stacked */
    .organizer-name-row {
        flex-direction: column;
        gap: 8px;
    }

    .organizer-name-prefix,
    .organizer-name-first,
    .organizer-name-last {
        flex: 0 0 100%;
    }

    /* Reply form textarea */
    .organizer-reply-textarea {
        font-size: 16px; /* prevents iOS zoom-on-focus */
    }

    /* General inputs — prevent iOS auto-zoom (font must be ≥16px) */
    input[type="text"],
    input[type="url"],
    input[type="email"],
    input[type="file"],
    select,
    textarea {
        font-size: 16px !important;
    }
}

/* =============================================================
   HOW TO ENQUEUE THIS FILE
   Add this to catholic-organizer.php inside
   catholic_organizer_enqueue_scripts():

   wp_enqueue_style(
       'catholic-organizer-mobile',
       plugin_dir_url( __FILE__ ) . 'assets/css/organizer-mobile.css',
       array(),
       '1.0'
   );
   ============================================================= */