/* Admin Styles */

/* --- Dashicon vertical alignment in plugin admin buttons ---
 *
 * Problem: WordPress dashicons render their glyph inside a 20x20
 * font box, but the visible glyph sits in the lower portion of
 * that box. Both `vertical-align: middle` (inline-block layout)
 * and `align-items: center` (flex layout) center the BOX, so the
 * visible glyph still ends up a couple pixels below the text
 * center. The most obvious symptom is the email icon hanging low
 * inside the "Notify Incomplete Caregivers" button on the training
 * completion dashboard, and the plus icons inside "Add Question"
 * and "Add Module" inside the training editor.
 *
 * Fix has three parts:
 *
 *   1. inline-flex + align-items:center on the button. This gives
 *      us reliable cross-axis centering and cleans up the spacing
 *      between icon and text. (The inline `vertical-align:middle`
 *      style on the dashicon span itself is ignored once the
 *      parent is flex, which is fine.)
 *
 *   2. line-height:1 on the dashicon so it can never inherit a
 *      taller line-box from the button and shift its glyph down.
 *
 *   3. transform: translateY(-0.5px) on the dashicon. This
 *      compensates for the glyph-vs-box offset baked into the
 *      dashicon font itself. We empirically iterated this value
 *      (-1px too low, -2px and -1.5px overshot above center).
 *      -0.5px lands cleanly on the primary buttons we use today.
 *      Small buttons get their own scope below since the same
 *      offset reads differently against an 11px label.
 *
 * Both are scoped to the plugin's wrap classes (.pillar-admin and
 * .pillar-admin-training) so we never touch buttons in WordPress
 * core admin screens or in unrelated third-party plugins.
 */
.wrap.pillar-admin button.button,
.wrap.pillar-admin a.button,
.wrap.pillar-admin-training button.button,
.wrap.pillar-admin-training a.button {
    display: inline-flex;
    align-items: center;
}

.wrap.pillar-admin .button .dashicons,
.wrap.pillar-admin a.button .dashicons,
.wrap.pillar-admin-training .button .dashicons,
.wrap.pillar-admin-training a.button .dashicons {
    line-height: 1;
    transform: translateY(-0.5px);
}

/* Small action buttons (Remind, Answers, PDF in the training completion
 * dashboard, action columns of records tables) have a shorter line-height
 * than primary buttons, and a default 20px dashicon looks oversized
 * against their 11px text. Scale the icon to 16px to match the label
 * and reduce the upward nudge — at smaller sizes the dashicon's
 * built-in glyph offset shrinks proportionally so we need less of a
 * compensating shift. -1px lands centered on the small buttons we
 * use today; adjust here if a future small button looks off. */
.wrap.pillar-admin .button-small .dashicons,
.wrap.pillar-admin a.button-small .dashicons,
.wrap.pillar-admin-training .button-small .dashicons,
.wrap.pillar-admin-training a.button-small .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    transform: translateY(0.5px);
}

/* General Admin Layout */
.pillar-admin {
    margin: 20px;
}

.pillar-admin h1 {
    color: #1d2327;
    margin-bottom: 20px;
}

/* Summary Cards */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.summary-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 15px;
}

.card-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-icon .dashicons {
    font-size: 24px;
    width: 24px;
    height: 24px;
    color: white;
}

.timesheet-icon {
    background-color: #2271b1;
}

.evv-icon {
    background-color: #00a32a;
}

.pending-icon {
    background-color: #f0b849;
}

.total-icon {
    background-color: #2271b1;
}

.approved-icon {
    background-color: #00a32a;
}

.card-content h3 {
    margin: 0;
    font-size: 14px;
    color: #1d2327;
}

.card-value {
    font-size: 24px;
    font-weight: 600;
    color: #1d2327;
    margin: 5px 0 0;
}

/* Stats Container */
.stats-container {
    margin-bottom: 30px;
}

.stats-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 15px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: #f0f0f1;
    border-radius: 4px;
}

/* Filters Section */
.timesheet-filters,
.evv-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding: 20px;
    background: white;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1 1 200px;
    min-width: 150px;
}

.filter-group:first-of-type {
    flex: 2 1 280px;
    min-width: 240px;
}

.filter-group label {
    font-weight: 600;
    font-size: 11px;
    color: #50575e;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1;
}

.filter-group input[type="date"],
.filter-group input[type="text"],
.filter-group input.regular-text,
.filter-group select,
.filter-group select.regular-text {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    padding: 7px 10px;
    border: 1px solid #dcdcde;
    border-radius: 4px;
    font-size: 13px;
    box-sizing: border-box;
    height: 36px;
}

.filter-group input:focus,
.filter-group select:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
    outline: none;
}

.date-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
}

.date-inputs input[type="date"] {
    flex: 1;
    width: 0 !important;
    min-width: 0 !important;
}

.date-separator,
.date-inputs > span {
    flex-shrink: 0;
    color: #757575;
    font-size: 13px;
}

.filter-actions {
    flex-basis: 100%;
    display: flex;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid #f0f0f1;
    justify-content: flex-end;
}

.filter-actions .button {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 32px;
}

.filter-actions .button .dashicons {
    width: 16px;
    height: 16px;
    font-size: 16px;
}

@media screen and (max-width: 600px) {
    .filter-group,
    .filter-group:first-of-type {
        flex-basis: 100%;
        min-width: 0;
    }
}

/* Table Styles */
.wp-list-table {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.wp-list-table th {
    font-weight: 600;
}

.wp-list-table thead th {
    padding: 12px;
}

.wp-list-table td {
    padding: 12px;
    vertical-align: middle;
}

.wp-list-table .check-column {
    width: 32px;
    padding: 12px 0 12px 12px;
}

/* Column-width hints for the `widefat fixed` layout. Without these,
   `table-layout: fixed` divides the available width equally across
   columns, which under-sizes the Actions column (it needs ~280px to
   fit Preview + Approve + Export with labels) and over-sizes short
   numeric/badge columns like Hours and Status. Listing widths here
   means we don't have to inline `style="width:..."` on every <th>.
   Templates already use these `column-*` classes (see evv.php as the
   convention reference). */
.wp-list-table .column-hours { width: 80px; }
.wp-list-table .column-status { width: 110px; }
.wp-list-table .column-medicaid { width: 130px; }
.wp-list-table .column-date { width: 110px; }
.wp-list-table .column-gps { width: 110px; }
.wp-list-table .column-actions { width: 290px; }

/* GPS-status badge — shown in the EVV records list when the
   "Enable GPS Tracking" setting is on. The "missing" colour is
   amplified to "warning" when "Require GPS" is also on, signalling
   a real compliance gap rather than just an informational note. */
.gps-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.5;
    white-space: nowrap;
}

.gps-badge .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

.gps-badge-verified {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

/* Neutral missing-GPS badge — informational only, used when
   `require_gps` is OFF. */
.gps-badge-missing {
    background: #f3f4f6;
    color: #4b5563;
    border: 1px solid #e5e7eb;
}

/* Loud missing-GPS badge — used when `require_gps` is ON, since at
   that point a missing-GPS record represents a compliance / billing
   risk and admins need to spot it quickly while scanning the list. */
.gps-badge-warning {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* Record Type Badges */
.record-type {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.record-type.timesheet {
    background-color: #e0f2fe;
    color: #0369a1;
}

.record-type.evv {
    background-color: #f0fdf4;
    color: #166534;
}

/* Actions Column */
.actions {
    display: flex;
    gap: 6px;
    /* Wrap to a second row instead of overflowing the cell. The third
       button (Approve, on pending rows) was getting pushed past the
       table's right edge because `widefat fixed` allocates equal width
       to all columns and the Actions column wasn't getting enough
       room. The .column-actions width hint below addresses the layout
       allocation; this wrap is a safety net for narrow admin
       viewports / future button additions. */
    flex-wrap: wrap;
    row-gap: 4px;
    align-items: center;
}

.actions .button {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    height: 32px;
    margin: 0;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.actions .button .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    margin-right: 3px;
}

.actions .button .button-text {
    display: inline-block;
}

/* Button variants */
.actions .preview-record {
    background-color: #f0f0f1;
    border-color: #c3c4c7;
}

.actions .preview-record:hover {
    background-color: #e5e5e5;
    border-color: #999;
}

.actions .export-record {
    background-color: #2271b1;
    border-color: #2271b1;
    color: white;
}

.actions .export-record:hover {
    background-color: #135e96;
    border-color: #135e96;
}

.actions .approve-record {
    background-color: #00a32a;
    border-color: #00a32a;
    color: white;
}

.actions .approve-record:hover {
    background-color: #008a20;
    border-color: #008a20;
}

/* Loading States */
.loading {
    position: relative;
}

.button.loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.button.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: button-spin 0.8s linear infinite;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Bulk actions form styling */
#bulk-action-form {
    display: flex;
    gap: 8px;
    align-items: center;
}

#bulk-action-selector {
    min-width: 200px;
}

/* Settings Page */
.settings-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.settings-card h2 {
    margin-top: 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #e5e7eb;
}

/* Checkbox styling */
input[type=checkbox] {
    border: 2px solid #c3c4c7;
    border-radius: 4px;
    transition: all 0.2s ease;
}

input[type=checkbox]:checked {
    background-color: #2271b1;
    border-color: #2271b1;
}

/* Animations */
@keyframes button-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Responsive Design */
@media screen and (max-width: 782px) {
    .summary-cards {
        grid-template-columns: 1fr;
    }

    .timesheet-filters,
    .evv-filters {
        flex-direction: column;
        gap: 10px;
    }

    .filter-group {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
    }

    .filter-group input[type="date"],
    .filter-group select {
        width: 100%;
    }

    .actions {
        flex-direction: row;
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 8px;
    }

    .actions .button {
        padding: 4px 8px;
    }

    .actions .button .button-text {
        display: none;
    }

    .actions .button .dashicons {
        margin-right: 0;
    }

    #bulk-action-form {
        flex-direction: column;
        width: 100%;
    }

    #bulk-action-selector {
        width: 100%;
    }
}

/* Print Styles */
@media print {
    .pillar-admin {
        margin: 0;
    }

    .actions,
    .tablenav,
    .button {
        display: none !important;
    }

    .wp-list-table {
        box-shadow: none;
        border: 1px solid #000 !important;
    }

    .wp-list-table th,
    .wp-list-table td {
        border-bottom: 1px solid #000 !important;
    }

    .record-type {
        border: 1px solid #000 !important;
    }
}

/* Helper Classes */
.text-center { text-align: center; }
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }
.hidden { display: none; }

.task-item {
    display: flex;
    align-items: center;
    margin: 5px 0;
    padding: 5px;
    border-radius: 4px;
}

.task-item.completed {
    background-color: #f0f7f0;
}

.task-item.not-completed {
    color: #666;
    background-color: #f5f5f5;
}

.task-item .dashicons {
    margin-right: 8px;
}

.task-item.completed .dashicons {
    color: #46b450;
}

.task-item.not-completed .dashicons {
    color: #999;
}

.task-details {
    margin-left: 24px;
    color: #666;
    font-size: 0.9em;
}

.details-grid {
    display: grid;
    gap: 12px;
    padding: 20px;
    background: #fff;
}

.detail-row {
    display: grid;
    grid-template-columns: 180px 1fr;
    align-items: center;
    min-height: 32px;
}

.detail-row label {
    font-weight: 600;
    color: #23282d;
}

.detail-row span {
    color: #444;
}

.evv-only,
.timesheet-only {
    border-top: 1px solid #eee;
    padding-top: 15px;
    margin-top: 15px;
}

/* Tabs */
.tab-nav {
    padding: 10px 20px 0;
    margin: 0;
    border-bottom: 1px solid #ddd;
    background: #f8f8f8;
}

.tab-nav button {
    padding: 8px 12px;
    margin-right: 4px;
    border: 1px solid #ddd;
    border-bottom: none;
    background: #f1f1f1;
    cursor: pointer;
}

.tab-nav button.active {
    background: #fff;
    border-bottom: 1px solid #fff;
    margin-bottom: -1px;
}

/* Responsive adjustments */
@media screen and (max-width: 782px) {
    .detail-row {
        grid-template-columns: 1fr;
        gap: 4px;
    }
    
    .detail-row label {
        margin-bottom: 4px;
    }
}

/* Add !important to critical styles */
.pillar-modal {
    display: none !important;
}

/*
 * flex, not block. Only the record preview modal takes the .show class, and its
 * markup relies on flex to centre the panel in the viewport — showModal() writes an
 * inline display:flex for exactly that reason. Declaring block here with !important
 * overrode the inline value, so in wp-admin the panel laid out as a plain block and
 * sat against the top-left of the overlay instead of centred.
 */
.pillar-modal.show {
    display: flex !important;
}

/* Force immediate style application */
.pillar-modal * {
    box-sizing: border-box !important;
}

/* Prevent FOUC */
.js .pillar-modal {
    visibility: hidden;
}

.js .pillar-modal.initialized {
    visibility: visible;
}

@media screen and (max-width: 782px) {
    /* Fix action buttons on mobile */
    .actions {
        position: relative;
        padding-bottom: 0;
        -webkit-overflow-scrolling: touch; /* For iOS */
    }

    /* Improve filter groups */
    .filter-group {
        gap: 4px;
    }

    .filter-group label {
        font-size: 13px;
    }

    /* Adjust table for mobile */
    .wp-list-table td:not(.column-primary) {
        padding: 8px;
    }
}

/* Use hardware acceleration for animations */
.actions .button,
.summary-card,
.stats-card {
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Reduce repaints */
.loading::after {
    will-change: opacity;
}

/* Focus states */
.actions .button:focus {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (forced-colors: active) {
    .record-type,
    .actions .button {
        forced-color-adjust: none;
    }
}

/* Task-related styles */
.pillar-admin .task-item {
    display: flex !important;
    align-items: center !important;
    margin: 5px 0 !important;
    padding: 12px 16px !important;
    border-radius: 6px !important;
    background: #f8f9fa !important;
    border: 1px solid #e5e7eb !important;
}

.pillar-admin .task-item.completed {
    background-color: #f0fdf4 !important;
    border-color: #34d399 !important;
}

.pillar-admin .task-value {
    font-weight: 500 !important;
    color: #1d2327 !important;
}

.pillar-admin .task-value[data-completed="true"] {
    color: #00a32a !important;
}

.pillar-admin .task-value[data-completed="true"]::after {
    content: "✓" !important;
}

.pillar-admin .task-value[data-completed="false"]::after {
    content: "✗" !important;
    color: #dc2626 !important;
}

/* Modal Integration */
.pillar-admin .modal-trigger {
    background: #f8f9fa;
    border: 1px solid #e5e7eb;
    color: #1d2327;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pillar-admin .modal-trigger:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

/* Ensure proper z-index stacking */
.pillar-admin {
    position: relative;
    z-index: 1;
}

.button-small {
    display: inline-flex;
    align-items: center;
    margin-left: 5px;
}

.button-small .dashicons {
    margin-right: 3px;
}

.button-text {
    line-height: 1.4;
}

td .preview-record,
td .button-small {
    margin: 2px;
}

/* Preview Button Styles */
.preview-record {
    background: #f0f0f1;
    border: 1px solid #c3c4c7;
    color: #2c3338;
    padding: 4px 8px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 13px;
    line-height: 1.4;
    margin-right: 5px;
    display: inline-flex;
    align-items: center;
}

.preview-record:hover {
    background: #f6f7f7;
    border-color: #8c8f94;
}

/* Action buttons container */
td .action-buttons {
    display: flex;
    gap: 5px;
    align-items: center;
}

/* When buttons are side by side */
.preview-record + .button-small {
    margin-left: 5px;
}

/* Password Input Styling */
.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input {
    padding-right: 40px !important;
    width: 100%;
}

.wp-hide-pw {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 28px;
    padding: 0;
    background: none;
    border: none;
    color: #50575e;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wp-hide-pw:hover,
.wp-hide-pw:focus {
    color: #135e96;
    outline: none;
    box-shadow: none;
}

.wp-hide-pw .dashicons {
    width: 20px;
    height: 20px;
    font-size: 20px;
}

/* =========================================================================
   Export Records Modal
   -------------------------------------------------------------------------
   Unified export UI used by the Timesheets and EVV admin pages. Markup
   lives in admin/templates/parts/export-modal.php, behavior in
   admin/js/admin.js (PillarAdmin.ExportModal).
   ========================================================================= */

.pillar-export-modal {
    position: fixed;
    inset: 0;
    z-index: 100000; /* above WP admin bar (99999) */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    overflow-y: auto;
}

.pillar-export-modal[hidden] {
    display: none;
}

.pillar-export-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    animation: pillarExportFade 0.18s ease-out;
}

.pillar-export-modal__panel {
    position: relative;
    background: #ffffff;
    border-radius: 14px;
    box-shadow:
        0 20px 50px -12px rgba(15, 23, 42, 0.35),
        0 4px 12px -4px rgba(15, 23, 42, 0.12);
    width: 100%;
    max-width: 560px;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    padding: 28px;
    animation: pillarExportRise 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes pillarExportFade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes pillarExportRise {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.pillar-export-modal__close {
    position: absolute;
    top: 14px;
    right: 14px;
    background: transparent;
    border: 0;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    color: #64748b;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, color 0.15s ease;
}

.pillar-export-modal__close:hover,
.pillar-export-modal__close:focus-visible {
    background: #f1f5f9;
    color: #0f172a;
    outline: none;
}

.pillar-export-modal__close .dashicons {
    width: 18px;
    height: 18px;
    font-size: 18px;
}

/* Header */
.pillar-export-modal__header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
    padding-right: 36px;
}

.pillar-export-modal__header-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, #ecfeff 0%, #e0f2fe 100%);
    color: #0e7490;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pillar-export-modal__header-icon .dashicons {
    width: 20px;
    height: 20px;
    font-size: 20px;
}

.pillar-export-modal__header-text h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.3;
}

.pillar-export-modal__subtitle {
    margin: 2px 0 0;
    font-size: 13px;
    color: #64748b;
    line-height: 1.4;
}

/* Stats strip */
.pillar-export-modal__stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 22px;
}

.pillar-export-stat {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.pillar-export-stat__icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pillar-export-stat__icon--total {
    background: #dbeafe;
    color: #1d4ed8;
}

.pillar-export-stat__icon--selected {
    background: #fef3c7;
    color: #b45309;
}

.pillar-export-stat__icon--ready {
    background: #dcfce7;
    color: #15803d;
}

.pillar-export-stat__icon .dashicons {
    width: 16px;
    height: 16px;
    font-size: 16px;
}

.pillar-export-stat__body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.pillar-export-stat__label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    line-height: 1.2;
}

.pillar-export-stat__value {
    font-size: 18px;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.2;
    margin-top: 2px;
}

/* Form sections */
.pillar-export-modal__section {
    margin-bottom: 18px;
}

.pillar-export-modal__section-title {
    margin: 0 0 10px;
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
}

.pillar-export-modal__row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 10px;
}

.pillar-export-modal__row:last-child {
    margin-bottom: 0;
}

.pillar-export-modal__field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.pillar-export-modal__field--full {
    grid-column: 1 / -1;
}

.pillar-export-modal__field-label {
    font-size: 12px;
    font-weight: 500;
    color: #475569;
}

.pillar-export-modal__field input,
.pillar-export-modal__field select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 13px;
    background: #ffffff;
    color: #0f172a;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    box-shadow: none;
}

.pillar-export-modal__field input:focus,
.pillar-export-modal__field select:focus {
    border-color: #06b6d4;
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.18);
    outline: none;
}

.pillar-export-modal__hint {
    margin: 6px 0 0;
    padding: 8px 10px;
    background: #f1f5f9;
    border-radius: 8px;
    color: #475569;
    font-size: 12px;
    line-height: 1.5;
    display: flex;
    align-items: flex-start;
    gap: 6px;
}

.pillar-export-modal__hint .dashicons {
    width: 14px;
    height: 14px;
    font-size: 14px;
    color: #64748b;
    flex-shrink: 0;
    margin-top: 1px;
}

/* Format toggle */
.pillar-export-modal__formats {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pillar-export-format {
    display: block;
    cursor: pointer;
    position: relative;
}

.pillar-export-format input[type="radio"] {
    position: absolute;
    opacity: 0;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
}

.pillar-export-format__inner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #ffffff;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.pillar-export-format input[type="radio"]:focus-visible + .pillar-export-format__inner {
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.25);
}

.pillar-export-format:hover .pillar-export-format__inner {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.pillar-export-format input[type="radio"]:checked + .pillar-export-format__inner {
    border-color: #06b6d4;
    background: #ecfeff;
    box-shadow: 0 0 0 1px #06b6d4 inset;
}

.pillar-export-format__icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pillar-export-format__icon--pdf {
    background: #fee2e2;
    color: #b91c1c;
}

.pillar-export-format__icon--csv {
    background: #d1fae5;
    color: #047857;
}

.pillar-export-format__icon .dashicons {
    width: 20px;
    height: 20px;
    font-size: 20px;
}

.pillar-export-format__body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.pillar-export-format__title {
    font-size: 13px;
    font-weight: 600;
    color: #0f172a;
}

.pillar-export-format__desc {
    font-size: 12px;
    color: #64748b;
    line-height: 1.4;
}

.pillar-export-format__check {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: transparent;
    border: 1.5px solid #cbd5e1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: transparent;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.pillar-export-format input[type="radio"]:checked ~ .pillar-export-format__inner .pillar-export-format__check {
    background: #06b6d4;
    border-color: #06b6d4;
    color: #ffffff;
}

.pillar-export-format__check .dashicons {
    width: 14px;
    height: 14px;
    font-size: 14px;
}

/* CTA */
.pillar-export-modal__submit {
    width: 100%;
    padding: 12px 16px;
    background: linear-gradient(135deg, #0284c7 0%, #0e7490 100%);
    color: #ffffff;
    border: 0;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 4px;
    transition: transform 0.1s ease, box-shadow 0.15s ease, opacity 0.15s ease;
    box-shadow: 0 4px 12px -2px rgba(6, 182, 212, 0.35);
}

.pillar-export-modal__submit:hover:not([disabled]) {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px -3px rgba(6, 182, 212, 0.45);
}

.pillar-export-modal__submit:active:not([disabled]) {
    transform: translateY(0);
}

.pillar-export-modal__submit[disabled] {
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none;
}

.pillar-export-modal__submit .dashicons {
    width: 18px;
    height: 18px;
    font-size: 18px;
}

.pillar-export-modal__submit.is-loading {
    pointer-events: none;
    opacity: 0.75;
}

.pillar-export-modal__footnote {
    margin: 12px 0 0;
    text-align: center;
    font-size: 12px;
    color: #64748b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
}

.pillar-export-modal__footnote .dashicons {
    width: 14px;
    height: 14px;
    font-size: 14px;
    color: #0e7490;
}

/* Trigger button — sits in the existing .filter-actions row alongside
   "Apply Filters" / "Reset". Styled to feel like the primary CTA on
   the page without overpowering the WP-admin chrome. */
.pillar-export-trigger.button {
    background: linear-gradient(135deg, #0284c7 0%, #0e7490 100%);
    border-color: #0e7490;
    color: #ffffff;
    text-shadow: none;
    box-shadow: 0 1px 2px rgba(6, 182, 212, 0.25);
}

.pillar-export-trigger.button:hover,
.pillar-export-trigger.button:focus {
    background: linear-gradient(135deg, #0369a1 0%, #155e75 100%);
    border-color: #155e75;
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(6, 182, 212, 0.35);
}

.pillar-export-trigger.button .dashicons {
    color: #ffffff;
}

/* Lock background scroll while modal is open */
body.pillar-export-modal-open {
    overflow: hidden;
}

/* Compact layout on small admin panes */
@media (max-width: 600px) {
    .pillar-export-modal {
        padding: 12px;
    }

    .pillar-export-modal__panel {
        padding: 20px 18px;
        border-radius: 12px;
    }

    .pillar-export-modal__stats {
        grid-template-columns: 1fr;
    }

    .pillar-export-modal__row {
        grid-template-columns: 1fr;
    }
}

/* Hide the modal entirely when printing */
@media print {
    .pillar-export-modal {
        display: none !important;
    }
}