/**
 * General Filters — Component Library
 *
 * All reusable UI components live here.
 * All values consume tokens from styles-base.css — no raw hex values for
 * anything already defined as a token.
 *
 * Naming convention:
 *   .gf-*       New Figma-based design system (use for all new/redesigned views)
 *   .fiveood-*  Legacy components (pre-Figma views — replace per view as redesigns land)
 *
 * Sections:
 *   0.  Page Container
 *   1.  Icon System
 *   2.  Buttons
 *   3.  Status Badges
 *   4.  Alerts & Notices
 *   5.  Stat Items
 *   6.  Cards
 *   7.  Forms
 *   8.  Tables
 *   9.  Empty State
 *  10.  Pagination
 *  11.  Animations
 *  12.  Responsive
 *  13.  Utilities
 *
 * Page-scoped styles live in assets/css/pages/:
 *   invoice-form.css   — [contractor_invoice_upload]
 *   invoices-list.css  — [contractor_invoices_list]
 *   rewards.css        — [contractor_points]
 *   tier.css           — [contractor_tier_info]
 *   woo-cart.css       — WooCommerce cart/checkout rewards widget
 *
 * @package FiveOOD_General_Filters
 */

/* =============================================
   0. PAGE CONTAINER
   ============================================= */

.gf-page {
    max-width: 1140px;
    margin: 0 auto;
    padding: 20px;
    box-sizing: border-box;
}

.gf-page .gf-page__title {
    font-family: var(--font-header);
    font-size: var(--font-size-page-title);
    font-weight: var(--font-weight-bold);
    color: var(--text-primary);
    text-transform: uppercase;
    margin: 0 0 var(--spacing-lg);
    letter-spacing: 0.02em;
}

/* =============================================
   1. ICON SYSTEM
   ============================================= */

.gf-icon {
    display: inline-block;
    flex-shrink: 0;
    vertical-align: middle;
}

.gf-icon--sm  { width: 16px; height: 16px; }
.gf-icon--md  { width: 20px; height: 20px; }
.gf-icon--lg  { width: 24px; height: 24px; }
.gf-icon--xl  { width: 32px; height: 32px; }
.gf-icon--2xl { width: 48px; height: 48px; }

/* Icon color inherits from card accent context */
.gf-card--rewards .gf-icon  { color: var(--icon-brand-green); }
.gf-card--invoices .gf-icon { color: var(--icon-brand-rust);  }
.gf-card--account .gf-icon  { color: var(--color-blue-40, #336699); }


/* =============================================
   2. BUTTONS
   ============================================= */

/* -- GF (Figma design system) -- */
.gf-page .gf-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 12px;
    border-radius: 4px;
    font-family: var(--font-header);
    font-size: var(--font-size-body-sm);
    font-weight: var(--font-weight-semibold);
    letter-spacing: 2px;
    text-transform: uppercase;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: opacity 0.2s;
    border: 2px solid transparent;
    box-sizing: border-box;
}

.gf-page .gf-btn:hover {
    text-decoration: none;
    opacity: 0.85;
}

.gf-page .gf-btn--primary {
    background: var(--cta-bg-primary);
    color: var(--cta-fg-primary);
    border-color: var(--cta-bg-primary);
}

.gf-page .gf-btn--primary:hover { color: var(--cta-fg-primary); }

.gf-page .gf-btn--secondary {
    background: transparent;
    color: var(--text-primary);
    border-color: var(--text-primary);
}

.gf-page .gf-btn--secondary:hover { color: var(--text-primary); }

.gf-page .gf-btn--full { width: 100%; justify-content: center; }


#fiveood-submit-button {
    padding: 12px 28px;
    font-size: var(--font-size-body-sm);
    min-height: 48px;
}



/* =============================================
   3. STATUS BADGES
   ============================================= */

/* Base badge — used by both the modern .gf-badge class and the legacy
   .fiveood-status-badge class. One source of truth. */
.gf-badge,
.fiveood-status-badge {
    display: inline-block;
    padding: var(--spacing-xs) 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: var(--font-weight-medium);
    text-transform: capitalize;
}

/* Color variants. Semantic tokens map to light-mode *-light bg + main color. */
.gf-badge--approved,
.gf-badge--available,
.fiveood-status-approved {
    background: var(--color-success-light);
    color: var(--color-success);
}

.gf-badge--pending,
.gf-badge--locked,
.fiveood-status-pending {
    background: var(--color-warning-light);
    color: var(--color-warning);
}

.gf-badge--rejected,
.fiveood-status-rejected {
    background: var(--color-error-light);
    color: var(--color-error);
}

.gf-badge--expired,
.gf-badge--revoked {
    background: var(--color-neutral-10);
    color: var(--color-neutral-60);
}

/* -- Batch status pill (rewards-display) -- */
.fiveood-batch-status-large {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-full);
    font-size: var(--font-size-body-xs);
    line-height: var(--line-height-body-xs);
    font-weight: var(--font-weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.fiveood-batch-status-large.status-available { background: var(--bg-success);          color: var(--text-success); }
.fiveood-batch-status-large.status-locked    { background: var(--color-warning-light);  color: var(--color-warning); }

.fiveood-batch-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    animation: pulse 2s ease-in-out infinite;
}

/* -- Tier badge (tier-display) -- */
.fiveood-tier-badge-large {
    display: inline-block;
    padding: var(--spacing-md) var(--spacing-3xl);
    border-radius: var(--radius-full);
    font-family: var(--font-header);
    font-size: var(--font-size-h3);
    line-height: var(--line-height-h3);
    font-weight: var(--font-weight-bold);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: var(--spacing-lg) 0;
}

.fiveood-tier-badge-large.fiveood-tier-certified {
    background: var(--bg-brand-green);
    color: var(--text-brand-green);
    border: 3px solid var(--border-brand);
}

.fiveood-tier-badge-large.fiveood-tier-certified_pro {
    background: var(--color-orange-10);
    color: var(--color-orange-30);
    border: 3px solid var(--color-orange-30);
}

/* -- Tier hero badge (shared by tier-display + rewards-display heroes) -- */
.gf-tier-certified-badge {
    width: 182px;
    height: auto;
}

.gf-tier-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: 4px;
    min-height: 80px;
    width: fit-content;
}

.gf-tier-badge--certified      { background: var(--color-blue-40); }
.gf-tier-badge--certified_pro  { background: var(--color-green-50); }

.gf-tier-badge__label {
    font-family: var(--font-header);
    font-size: var(--font-size-body-lg);
    font-weight: var(--font-weight-bold);
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--color-neutral-0);
}

/* -- Expiring badge (rewards-display) -- */
.fiveood-expiring-badge {
    background: var(--bg-error);
    color: var(--text-error);
    padding: var(--spacing-xs) var(--spacing-md);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-body-xs);
    font-weight: var(--font-weight-bold);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    animation: blink 1.5s ease-in-out infinite;
}


/* =============================================
   4. ALERTS & NOTICES
   ============================================= */

/* -- GF alert (new) -- */
.gf-alert {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-md);
    padding: var(--spacing-lg) var(--spacing-xl);
    border-radius: var(--radius-lg);
    border-left: 4px solid;
    margin-bottom: var(--spacing-xl);
}

.gf-alert--success { background: var(--bg-success);          border-color: var(--border-success); color: var(--text-success); }
.gf-alert--error   { background: var(--bg-error);            border-color: var(--border-error);   color: var(--text-error);   }
.gf-alert--warning { background: var(--color-warning-light); border-color: var(--color-warning);  color: var(--color-warning); }
.gf-alert--info    { background: var(--color-blue-10);       border-color: var(--color-blue-30);  color: var(--color-blue-40); }

/* -- Legacy .fiveood-message (public.css / invoice-form) -- */
.fiveood-message {
    padding: var(--spacing-lg);
    border-radius: 12px;
    margin-bottom: var(--spacing-lg);
}

.fiveood-message-success {
    background: var(--color-green-10);
    border: 2px solid var(--color-green-50);
}

.fiveood-message-error {
    background: var(--color-error-light);
    border: 2px solid var(--color-error);
    border-left: 4px solid var(--color-error);
}

.fiveood-message-info {
    background: var(--color-blue-10);
    border-left: 4px solid var(--color-blue-30);
    color: var(--color-blue-40);
}

.fiveood-message h4 {
    font-family: var(--font-header);
    font-size: var(--font-size-h5);
    font-weight: var(--font-weight-bold);
    color: var(--color-error);
    margin: 0 0 var(--spacing-sm);
}

.fiveood-message ul {
    margin: 0;
    padding-left: var(--spacing-lg);
    color: var(--color-error);
}

.fiveood-message li {
    margin-bottom: var(--spacing-xs);
    font-size: var(--font-size-body-sm);
}

/* -- Alert box (rewards-display) -- */
.fiveood-alert {
    background: var(--bg-error);
    border-left: 4px solid var(--border-error);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg) var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-md);
}

.fiveood-alert-icon {
    font-size: var(--font-size-h4);
    color: var(--text-error);
    flex-shrink: 0;
}

.fiveood-alert-content h3 {
    margin: 0 0 var(--spacing-sm) 0;
    font-size: var(--font-size-body-md);
    font-weight: var(--font-weight-semibold);
    color: var(--text-error);
}

.fiveood-alert-content p {
    margin: 0;
    color: var(--text-error);
    line-height: 1.6;
    font-size: var(--font-size-body-sm);
}

/* -- Notices (tier-display) -- */
.fiveood-notice {
    grid-column: 1 / -1;
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-sm);
    margin-bottom: var(--spacing-lg);
}

.fiveood-notice-success {
    background: var(--bg-success);
    border: 1px solid var(--border-success);
    color: var(--text-success);
}

.fiveood-notice-error {
    background: var(--bg-error);
    border: 1px solid var(--border-error);
    color: var(--text-error);
}

/* -- Admin notes (invoices-list / public.css) -- */
.fiveood-admin-notes {
    background: var(--color-error-light);
    border-left: 3px solid var(--color-error);
    padding: var(--spacing-sm) 12px;
    border-radius: var(--radius-sm);
    margin-top: var(--spacing-sm);
    font-size: 13px;
}

.fiveood-admin-notes-title {
    color: var(--color-error);
    font-weight: var(--font-weight-semibold);
    margin-bottom: var(--spacing-xs);
    display: flex;
    align-items: center;
    gap: 6px;
}

.fiveood-admin-notes-content {
    color: var(--color-error);
    font-size: 13px;
    margin: 0;
    line-height: 1.5;
}

.fiveood-invoice-notes-row { background-color: var(--color-warning-light) !important; }


/* =============================================
   5. STAT ITEMS
   ============================================= */

/* -- GF stats (dashboard) -- */
.gf-stat__label {
    font-family: var(--font-header);
    font-size: var(--font-size-body-md);
    font-weight: var(--font-weight-medium);
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--color-green-50);
    margin: 0 0 var(--spacing-sm);
}

.gf-stat__value {
    font-family: var(--font-header);
    font-size: var(--font-size-h1);
    font-weight: var(--font-weight-bold);
    color: var(--text-primary);
    margin: 0;
    line-height: 1.143;
}

.gf-stat__value--muted { opacity: 0.3; }


/* =============================================
   6. CARDS
   ============================================= */

/* -- GF card (dashboard, Figma design system) -- */
.gf-card {
    background: var(--bg-primary);
    border: 1px solid var(--color-green-20);
    border-top: 8px solid;
    border-radius: var(--radius-sm);
    padding: var(--spacing-xl);
    margin-bottom: var(--spacing-lg);
}

.gf-card--rewards  { border-top-color: var(--color-green-50); }
.gf-card--invoices { border-top-color: var(--color-orange-30); }
.gf-card--account  { border-top-color: var(--color-blue-40, #336699); }

.gf-card__description {
    margin: 0;
    flex: 1;
    font-family: var(--font-body);
    font-size: var(--font-size-body-md);
    color: var(--text-secondary);
    line-height: var(--line-height-body-md);
    padding-left: 62px;
}

.gf-card__header {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-xl);
}

.gf-card__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.gf-page .gf-card__heading {
    font-family: var(--font-header);
    font-size: var(--font-size-h4);
    font-weight: var(--font-weight-bold);
    color: var(--text-primary);
    margin: 0;
}

.gf-card__body {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--spacing-lg);
}

.gf-card__stats {
    display: flex;
    gap: var(--spacing-xl);
    padding-left: 62px;
}

.gf-card__actions {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    flex-shrink: 0;
}


/* =============================================
   7. FORMS
   ============================================= */

/* Generic form fields — used across invoice form, any future forms */
.fiveood-form-field          { margin-bottom: 20px; }
.fiveood-product-line-fields .fiveood-form-field { margin-bottom: 0; }

.fiveood-form-field label {
    display: block;
    font-family: var(--font-body);
    font-size: var(--font-size-body-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    margin-bottom: 6px;
}

.fiveood-form-field label .required {
    color: var(--color-error);
    margin-left: 2px;
}

.fiveood-form-field input[type="text"],
.fiveood-form-field input[type="date"],
.fiveood-form-field input[type="number"],
.fiveood-form-field input[type="file"] {
    width: 100%;
    padding: 0 var(--spacing-lg);
    font-size: var(--font-size-body-sm);
    color: var(--text-primary);
    background: var(--input-bg-default);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    height: 48px;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.fiveood-form-field input[type="file"] { height: auto; padding: var(--spacing-sm) 14px; }

.fiveood-form-field input:focus {
    outline: none;
    border-color: var(--color-green-50);
    box-shadow: 0 0 0 3px rgba(76, 81, 57, 0.12);
    background: var(--bg-primary);
}

.fiveood-form-field input[readonly] {
    background: var(--input-bg-default);
    border: 1px solid var(--border-primary);
    color: var(--text-tertiary);
    cursor: not-allowed;
}

.fiveood-product-line-fields .fiveood-form-field label {
    white-space: nowrap;
}

.fiveood-product-line-fields .fiveood-form-field:has(input[readonly]) label {
    color: var(--color-neutral-40);
}

.fiveood-field-description {
    font-size: var(--font-size-body-sm);
    font-family: var(--font-description);
    color: var(--text-tertiary);
    margin: 5px 0 0;
}

.gf-page .fiveood-field-error input  { border-color: var(--color-error); }
.fiveood-field-error-highlight { border-color: var(--color-error) !important; background-color: var(--color-error-light) !important; }
.fiveood-error-message      { display: block; font-size: var(--font-size-body-xs); color: var(--color-error); margin-top: var(--spacing-xs); }


/* =============================================
   8. TABLES
   ============================================= */

.fiveood-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-primary);
    border: 1px solid var(--border-secondary);
    border-radius: 5px;
    overflow: hidden;
}

.fiveood-table thead            { background-color: var(--color-neutral-10); }
.fiveood-table th,
.fiveood-table td               { padding: var(--spacing-sm) var(--spacing-md); text-align: left; border-bottom: 1px solid var(--border-secondary); }
.fiveood-table th               { font-weight: var(--font-weight-semibold); color: var(--color-neutral-80); }
.fiveood-table tbody tr:hover   { background-color: var(--color-neutral-10); }
.fiveood-table tbody tr:last-child td { border-bottom: none; }


/* =============================================
   9. EMPTY STATE
   ============================================= */

/* -- GF empty (new) -- */
.gf-empty {
    text-align: center;
    padding: var(--spacing-3xl) var(--spacing-lg);
}

.gf-empty__icon {
    width: 80px;
    height: 80px;
    margin: 0 auto var(--spacing-lg);
    border-radius: 50%;
    background: var(--bg-brand-green);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-brand-green);
}

.gf-empty__message { font-size: var(--font-size-body-md); color: var(--text-secondary); margin: 0; }

/* -- Legacy: invoices-list variant -- */
.fiveood-empty-state {
    background: var(--color-neutral-10);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    padding: var(--spacing-2xl) var(--spacing-lg);
    text-align: center;
}

.fiveood-empty-state-icon {
    margin-bottom: var(--spacing-md);
    color: var(--color-neutral-40);
}

.fiveood-empty-state p { font-size: 15px; color: var(--color-neutral-60); margin: 0 0 var(--spacing-md); }

/* -- Legacy: rewards-display variant -- */
.fiveood-empty-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto var(--spacing-lg);
    border-radius: 50%;
    background: var(--bg-brand-green);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-display);
    color: var(--text-brand-green);
}


/* =============================================
   10. PAGINATION
   ============================================= */

.fiveood-pagination { margin-top: var(--spacing-lg); text-align: center; }

.fiveood-pagination .page-numbers {
    display: inline-block;
    padding: 6px var(--spacing-sm);
    margin: 0 var(--spacing-xs);
    background: var(--bg-primary);
    color: var(--color-neutral-70);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: var(--font-size-body-sm);
    font-weight: var(--font-weight-medium);
    transition: all 0.2s ease;
}

.fiveood-pagination .page-numbers:hover  { background: var(--color-neutral-10); border-color: var(--color-neutral-40); }
.fiveood-pagination .page-numbers.current { background: var(--cta-bg-primary); color: var(--color-neutral-0); border-color: var(--cta-bg-primary); }


/* =============================================
   11. ANIMATIONS
   ============================================= */

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.5; }
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.7; }
}


/* =============================================
   12. RESPONSIVE
   ============================================= */

/* Dashboard card body */
@media (max-width: 640px) {
    .gf-page .gf-page__title {
        font-size: 36px;
        line-height: 44px;
    }

    .gf-card {
        padding: var(--spacing-lg) 12px;
    }

    .gf-card__body {
        flex-direction: column;
        align-items: stretch;
        gap: var(--spacing-2xl);
    }

    .gf-card__stats {
        padding-left: 0;
        flex-direction: column;
        gap: var(--spacing-xl);
    }

    .gf-stat__value { font-size: var(--font-size-h3); line-height: 1.2; }

    .gf-card__actions {
        flex-direction: column;
        width: 100%;
        gap: 12px;
    }

    .gf-page .gf-btn { width: 100%; justify-content: center; }
}

/* Table min-width on small screens */
@media (max-width: 767px) {
    .fiveood-table                 { min-width: 600px; font-size: var(--font-size-body-xs); }
    .fiveood-table th,
    .fiveood-table td              { padding: 8px 6px; font-size: var(--font-size-body-xs); }
}


/* =============================================
   13. UTILITIES
   ============================================= */

/* Hides an element. jQuery .show() sets an inline style which overrides this,
   so elements with this class can still be revealed by show/hide. */
.gf-hidden { display: none; }
