/**
 * FreeFacTu Admin Styles
 *
 * Styles for the FreeFacTu invoice management admin pages.
 *
 * @package FreeFacTu
 * @since 0.5.0
 */

/* ==========================================================================
   NAVIGATION TABS
   Modern, premium tab navigation styling
   ========================================================================== */

/* Tab wrapper - override WordPress defaults */
.freefactu-admin-page .nav-tab-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 0 0 0 0;
    padding: 0 0 0 0;
    border-bottom: none;
    border-radius: 12px 12px 0 0;
}

/* Individual tab styling */
.freefactu-admin-page .nav-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 12px 20px;
    margin: 0;
    border: none;
    border-radius: 10px 10px 0 0;
    background: transparent;
    color: #4a5568;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    cursor: pointer;
    background: #ebebeb;
    z-index: 2;
}

/* Tab hover state */
.freefactu-admin-page .nav-tab:hover {
    background: rgba(255, 255, 255, 0.7);
    color: #2271b1;
}

/* Tab focus state - accessibility */
.freefactu-admin-page .nav-tab:focus {
    outline: 2px solid #2271b1;
    outline-offset: -2px;
    box-shadow: none;
}

/* Active tab styling */
.freefactu-admin-page .nav-tab-active,
.freefactu-admin-page .nav-tab-active:focus,
.freefactu-admin-page .nav-tab-active:hover {
    background: #fff;
    color: #1e3a5f;
    font-weight: 600;
}

/* Active tab bottom connection to content */
.freefactu-admin-page .nav-tab-active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: #fff;
}

/* Active tab top accent */
.freefactu-admin-page .nav-tab-active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 40%;
    height: 3px;
    background: linear-gradient(90deg, #2271b1 0%, #135e96 100%);
    border-radius: 0 0 3px 3px;
}

/* Tab icon styling */
.freefactu-admin-page .nav-tab .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    line-height: 16px;
    opacity: 0.7;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

/* Tab icon hover effect */
.freefactu-admin-page .nav-tab:hover .dashicons {
    opacity: 1;
    transform: scale(1.1);
}

/* Active tab icon */
.freefactu-admin-page .nav-tab-active .dashicons {
    opacity: 1;
    color: #2271b1;
}


/* Tab content area */
.freefactu-admin-page .tab-content {
    background: #fff;
    border-radius: 0 12px 12px 12px;
    padding: 24px;
    margin-top: 0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
    position: relative;
}

/* Page title styling */
.freefactu-admin-page>h1:first-of-type {
    font-size: 24px;
    font-weight: 600;
    color: #1e3a5f;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e2e4e7;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Responsive adjustments */
@media screen and (max-width: 782px) {
    .freefactu-admin-page .nav-tab-wrapper {
        border-radius: 8px 8px 0 0;
        padding: 4px 4px 0 4px;
    }

    .freefactu-admin-page .nav-tab {
        padding: 10px 14px;
        font-size: 12px;
        border-radius: 8px 8px 0 0;
    }

    .freefactu-admin-page .tab-content {
        padding: 16px;
        border-radius: 0 0 8px 8px;
    }
}

/* Dark mode support (if WordPress admin uses dark mode in future) */
@media (prefers-color-scheme: dark) {
    .freefactu-admin-page .nav-tab-wrapper {
        background: linear-gradient(135deg, #1e1e1e 0%, #2d2d2d 100%);
    }

    .freefactu-admin-page .nav-tab {
        color: #a0aec0;
    }

    .freefactu-admin-page .nav-tab:hover {
        background: rgba(255, 255, 255, 0.1);
        color: #63b3ed;
    }

    .freefactu-admin-page .nav-tab-active,
    .freefactu-admin-page .nav-tab-active:focus,
    .freefactu-admin-page .nav-tab-active:hover {
        background: #2d2d2d;
        color: #fff;
    }

    .freefactu-admin-page .tab-content {
        background: #2d2d2d;
        border-color: #404040;
    }
}

/* ==========================================================================
   INVOICE TOOLBAR - INTEGRATED FILTER + EXPORT
   Compact floating toolbar combining filters and export in one unified bar
   ========================================================================== */

/* Toolbar Container */
.freefactu-invoice-toolbar {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 16px;
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 6px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    width: 100%;
    position: relative;
}

/* Filter Form Section */
.freefactu-toolbar__filters {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    margin: 0;
    background: transparent;
}

/* Active filters - subtle highlight */
.freefactu-toolbar__filters.has-active-filters {
    background: linear-gradient(135deg, #f0f6fc 0%, #e8f2fb 100%);
}

/* ==========================================================================
   GOOGLE ANALYTICS STYLE DATE RANGE PICKER
   Premium dropdown date picker with presets and calendar
   ========================================================================== */

/* Container */
.freefactu-daterange {
    position: relative;
    display: inline-flex;
}

/* Trigger Button */
.freefactu-daterange__trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #1d2327;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.freefactu-daterange__trigger:hover {
    border-color: #2271b1;
    background: #f8fafc;
}

.freefactu-daterange__trigger:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.15);
}

.freefactu-daterange__trigger[aria-expanded="true"] {
    border-color: #2271b1;
    background: #f0f6fc;
}

.freefactu-daterange__trigger[aria-expanded="true"] .freefactu-daterange__arrow {
    transform: rotate(180deg);
}

.freefactu-daterange__trigger .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    color: #2271b1;
}

.freefactu-daterange__label {
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.freefactu-daterange__arrow {
    font-size: 14px !important;
    width: 14px !important;
    height: 14px !important;
    color: #646970 !important;
    transition: transform 0.2s ease;
}

/* Panel (Dropdown) */
.freefactu-daterange__panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 100001;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(0, 0, 0, 0.05);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.freefactu-daterange__panel.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.freefactu-daterange__panel-inner {
    display: flex;
    overflow: hidden;
    border-radius: 12px;
}

/* Presets Sidebar */
.freefactu-daterange__presets {
    width: 160px;
    background: linear-gradient(180deg, #f8f9fa 0%, #f0f2f5 100%);
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    border-right: 1px solid #e5e7eb;
}

.freefactu-daterange__preset {
    display: block;
    width: 100%;
    padding: 10px 14px;
    text-align: left;
    background: transparent;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: all 0.15s ease;
}

.freefactu-daterange__preset:hover {
    background: #fff;
    color: #2271b1;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.freefactu-daterange__preset.is-active {
    background: #2271b1;
    color: #fff;
    box-shadow: 0 2px 6px rgba(34, 113, 177, 0.3);
}

.freefactu-daterange__preset--clear {
    color: #dc3545;
}

.freefactu-daterange__preset--clear:hover {
    background: #fef2f2;
    color: #dc3545;
}

.freefactu-daterange__preset-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 8px 4px;
}

/* Calendars Section */
.freefactu-daterange__calendars {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 320px;
}

/* Selected Dates Display */
.freefactu-daterange__selection {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e5e7eb;
}

.freefactu-daterange__date-field {
    flex: 1;
}

.freefactu-daterange__date-field label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6b7280;
    margin-bottom: 4px;
}

.freefactu-daterange__date-field input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #1d2327;
    background: #f9fafb;
    cursor: pointer;
    transition: all 0.15s ease;
}

.freefactu-daterange__date-field input:focus {
    outline: none;
    border-color: #2271b1;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.1);
}

.freefactu-daterange__date-field input::placeholder {
    color: #9ca3af;
    font-weight: 400;
}

.freefactu-daterange__date-separator {
    color: #9ca3af;
    font-size: 18px;
    margin-top: 18px;
}

/* Scrollable Calendar Container */
.freefactu-daterange__calendar-scroll {
    max-height: 350px;
    overflow-y: auto;
    overflow-x: hidden;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 4px;
}

/* Custom scrollbar */
.freefactu-daterange__calendar-scroll::-webkit-scrollbar {
    width: 8px;
}

.freefactu-daterange__calendar-scroll::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.freefactu-daterange__calendar-scroll::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.freefactu-daterange__calendar-scroll::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* Months Container */
.freefactu-daterange__months-container {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Individual Month Block */
.freefactu-daterange__month {
    padding: 12px;
    border-bottom: 1px solid #e5e7eb;
}

.freefactu-daterange__month:last-child {
    border-bottom: none;
}

/* Month Title */
.freefactu-daterange__month-title {
    font-size: 14px;
    font-weight: 600;
    color: #1d2327;
    text-align: center;
    padding: 8px 0 12px;
}

.freefactu-daterange__calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.freefactu-daterange__calendar-title {
    font-size: 15px;
    font-weight: 600;
    color: #1d2327;
}

.freefactu-daterange__nav {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    color: #6b7280;
}

.freefactu-daterange__nav:hover {
    background: #f3f4f6;
    color: #2271b1;
}

.freefactu-daterange__nav .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* Weekdays Header */
.freefactu-daterange__calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-bottom: 8px;
}

.freefactu-daterange__calendar-weekdays span {
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: #9ca3af;
    padding: 8px 0;
}

/* Days Grid - no gaps for continuous range background */
.freefactu-daterange__calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0;
}

.freefactu-daterange__day {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 36px;
    border: none;
    background: transparent;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: background 0.1s ease, color 0.1s ease;
    position: relative;
    z-index: 1;
}

/* Day number circle */
.freefactu-daterange__day::before {
    content: '';
    position: absolute;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    transition: background 0.1s ease;
    z-index: -1;
}

.freefactu-daterange__day:hover:not(.is-disabled):not(.is-empty):not(.is-selected)::before {
    background: #e0ebf5;
}

.freefactu-daterange__day:hover:not(.is-disabled):not(.is-empty):not(.is-selected) {
    color: #1e3a5f;
}

/* Today indicator */
.freefactu-daterange__day.is-today {
    font-weight: 700;
    color: #2271b1;
}

.freefactu-daterange__day.is-today::before {
    box-shadow: inset 0 0 0 2px #2271b1;
}

/* Selected start/end dates */
.freefactu-daterange__day.is-selected::before {
    background: #2271b1;
}

.freefactu-daterange__day.is-selected {
    color: #fff !important;
    font-weight: 600;
}

/* In-range days (between start and end) */
.freefactu-daterange__day.is-in-range {
    background: #e8f2fb;
    color: #1d2327;
}

/* Range start - rounded left side */
.freefactu-daterange__day.is-range-start {
    background: linear-gradient(90deg, transparent 50%, #e8f2fb 50%);
}

.freefactu-daterange__day.is-range-start::before {
    background: #2271b1;
}

.freefactu-daterange__day.is-range-start.is-range-end {
    background: transparent;
}

/* Range end - rounded right side */
.freefactu-daterange__day.is-range-end {
    background: linear-gradient(90deg, #e8f2fb 50%, transparent 50%);
}

.freefactu-daterange__day.is-range-end::before {
    background: #2271b1;
}

/* Preview hover state while selecting end date */
.freefactu-daterange__day.is-in-preview {
    background: #f0f6fc;
    color: #1d2327;
}

.freefactu-daterange__day.is-preview-end {
    background: linear-gradient(90deg, #f0f6fc 50%, transparent 50%);
}

.freefactu-daterange__day.is-preview-end::before {
    background: rgba(34, 113, 177, 0.3);
    border: 2px dashed #2271b1;
    box-sizing: border-box;
}

.freefactu-daterange__day.is-range-start.is-in-preview-mode {
    background: linear-gradient(90deg, transparent 50%, #f0f6fc 50%);
}

.freefactu-daterange__day.is-disabled {
    color: #d1d5db;
    cursor: not-allowed;
}

.freefactu-daterange__day.is-empty {
    visibility: hidden;
}

.freefactu-daterange__day.is-other-month {
    color: #c9cccf;
}

/* Actions Footer */
.freefactu-daterange__actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
}

.freefactu-daterange__btn {
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.freefactu-daterange__btn--cancel {
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    color: #374151;
}

.freefactu-daterange__btn--cancel:hover {
    background: #e5e7eb;
}

.freefactu-daterange__btn--apply {
    background: #2271b1;
    border: 1px solid #2271b1;
    color: #fff;
}

.freefactu-daterange__btn--apply:hover {
    background: #135e96;
    border-color: #135e96;
}

/* Responsive */
@media screen and (max-width: 680px) {
    .freefactu-daterange__panel {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        max-width: calc(100vw - 32px);
        max-height: calc(100vh - 32px);
        overflow-y: auto;
    }

    .freefactu-daterange__panel.is-visible {
        transform: translate(-50%, -50%);
    }

    .freefactu-daterange__panel-inner {
        flex-direction: column;
    }

    .freefactu-daterange__presets {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        border-right: none;
        border-bottom: 1px solid #e5e7eb;
        gap: 6px;
    }

    .freefactu-daterange__preset {
        flex: 0 0 auto;
        padding: 8px 12px;
        font-size: 12px;
    }

    .freefactu-daterange__preset-divider {
        display: none;
    }

    .freefactu-daterange__calendars {
        min-width: auto;
        padding: 16px;
    }

    .freefactu-daterange__calendar {
        width: 100%;
    }

    .freefactu-daterange__day {
        width: 38px;
        height: 38px;
    }
}

/* Panel backdrop for mobile */
.freefactu-daterange__backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 100000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
}

.freefactu-daterange__backdrop.is-visible {
    opacity: 1;
    visibility: visible;
}

/* Status Select */
.freefactu-toolbar__select {
    min-width: 90px;
    padding: 5px 8px;
    border: 1px solid #dcdcde;
    border-radius: 4px;
    font-size: 12px;
    background: #fff;
    color: #1d2327;
    cursor: pointer;
    transition: border-color 0.15s ease;
}

.freefactu-toolbar__select:hover {
    border-color: #8c8f94;
}

.freefactu-toolbar__select:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
}

/* Toolbar Buttons - Base */
.freefactu-toolbar__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    height: 30px;
    padding: 0 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    color: #50575e;
}

.freefactu-toolbar__btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    line-height: 1;
}

/* Filter Button */
.freefactu-toolbar__btn--filter {
    background: #2271b1;
    color: #fff;
    border-radius: 4px;
    padding: 0 12px;
}

.freefactu-toolbar__btn--filter:hover {
    background: #135e96;
    color: #fff;
}

.freefactu-toolbar__btn--filter:focus {
    outline: 2px solid #2271b1;
    outline-offset: 1px;
}

/* Spacer - pushes export to the right */
.freefactu-toolbar__spacer {
    flex: 1;
}

/* Clear Button */
.freefactu-toolbar__btn--clear {
    color: #d63638;
    min-width: 30px;
    border-radius: 4px;
}

.freefactu-toolbar__btn--clear:hover {
    background: #fef0f0;
}

/* Result Count Badge */
.freefactu-toolbar__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 18px;
    padding: 0 5px;
    background: #2271b1;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    border-radius: 9px;
}

/* Divider between filters and export */
.freefactu-toolbar__btn--export {
    border-left: 1px solid #dcdcde;
    padding: 0 12px;
    height: 100%;
    min-height: 38px;
    border-radius: 0;
    color: #1d2327;
    gap: 6px;
}

.freefactu-toolbar__btn--export:hover {
    background: #f6f7f7;
    color: #2271b1;
}

.freefactu-toolbar__btn--export .dashicons {
    color: #2271b1;
}

/* Button text (shown on export button) */
.freefactu-toolbar__btn-text {
    font-weight: 500;
}

/* Responsive Adjustments */
@media screen and (max-width: 960px) {
    .freefactu-invoice-toolbar {
        flex-wrap: wrap;
    }

    .freefactu-toolbar__filters {
        flex-wrap: wrap;
    }
}

@media screen and (max-width: 782px) {
    .freefactu-invoice-toolbar {
        display: flex;
        width: 100%;
    }

    .freefactu-toolbar__filters {
        flex: 1;
        flex-wrap: wrap;
        gap: 8px;
    }

    .freefactu-toolbar__date {
        flex: 1 1 calc(50% - 20px);
        min-width: 100px;
    }

    .freefactu-toolbar__select {
        flex: 1;
    }

    .freefactu-toolbar__btn--export {
        border-left: none;
        border-top: 1px solid #dcdcde;
        width: 100%;
        justify-content: center;
    }
}

/* Hide old filter-section if still included */
.freefactu-filter-bar,
.freefactu-filter-section {
    display: none !important;
}

/* ==========================================================================
   STATUS INDICATORS
   Icons and colors for various status states
   ========================================================================== */

.freefactu-status-icon--success {
    color: #46b450;
    font-size: 20px;
}

.freefactu-status-icon--warning {
    color: #ffb900;
    font-size: 20px;
    cursor: pointer;
}

.freefactu-status-icon--error {
    color: #dc3232;
}

.freefactu-status-check {
    color: #46b450;
}

.freefactu-status-cross {
    color: #dc3232;
}

/* Status text wrapper */
.freefactu-status-list {
    font-size: 12px;
    line-height: 1.6;
}

/* ==========================================================================
   RECTIFICATIVA BADGE
   Badge for rectificativa (corrective) invoices
   ========================================================================== */

.freefactu-badge-rectificativa {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, #f5af19 0%, #f12711 100%);
    color: #fff;
    font-size: 11px;
    font-weight: bold;
    border-radius: 3px;
    margin-left: 6px;
    vertical-align: middle;
}

/* Rectificativa type label */
.freefactu-rectificativa-label {
    background: #f5af19;
    color: #fff;
    padding: 4px 8px;
    border-radius: 3px;
    font-weight: bold;
}

/* ==========================================================================
   TABLE STYLES
   Invoice history table column widths
   ========================================================================== */

.freefactu-invoice-table th.column-order-id {
    width: 90px;
}

.freefactu-invoice-table th.column-invoice-number {
    width: 110px;
}

.freefactu-invoice-table th.column-date {
    width: 160px;
}

.freefactu-invoice-table th.column-total {
    width: 110px;
}

.freefactu-invoice-table th.column-qr {
    width: 160px;
}

/* QR Code image */
.freefactu-qr-image {
    width: 70px;
    height: 70px;
}

/* Debug button */
.freefactu-debug-button {
    margin-left: 5px;
}

.freefactu-debug-button .dashicons {
    font-size: 16px;
    line-height: 1.2;
}

/* Deleted order indicator */
.freefactu-deleted-order {
    color: #dc3232;
}

/* ==========================================================================
   DEBUG PAGE STYLES
   Standalone debug/info page layout
   ========================================================================== */

.freefactu-debug-page {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    padding: 20px;
    background: #f0f0f1;
}

.freefactu-debug-page .dashicons {
    vertical-align: middle;
}

.freefactu-debug-container {
    max-width: 1000px;
    margin: 0 auto;
    background: white;
    padding: 30px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.13);
}

.freefactu-debug-container h1 {
    margin-top: 0;
    border-bottom: 2px solid #2271b1;
    padding-bottom: 10px;
}

.freefactu-debug-container h2 {
    margin-top: 30px;
    color: #2271b1;
    border-bottom: 1px solid #ddd;
    padding-bottom: 5px;
}

/* Status Grid */
.freefactu-status-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
    margin: 20px 0;
}

@media screen and (max-width: 1200px) {
    .freefactu-status-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media screen and (max-width: 782px) {
    .freefactu-status-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Status Card */
.freefactu-status-card {
    border: 1px solid #ddd;
    padding: 15px;
    border-radius: 4px;
    background: #f9f9f9;
}

.freefactu-status-card h3 {
    margin-top: 0;
    font-size: 14px;
    color: #666;
    text-transform: uppercase;
}

.freefactu-status-card__value {
    font-size: 18px;
    font-weight: bold;
    margin: 10px 0;
}

.freefactu-status-card .status-yes,
.status-yes {
    color: #46b450;
}

.freefactu-status-card .status-no,
.status-no {
    color: #dc3232;
}

/* Meta Table */
.freefactu-meta-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.freefactu-meta-table th,
.freefactu-meta-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.freefactu-meta-table th {
    background: #f0f0f1;
    font-weight: 600;
}

.freefactu-meta-table code {
    background: #f0f0f1;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
    word-break: break-all;
}

/* Back Button */
.freefactu-back-button {
    display: inline-block;
    margin-bottom: 20px;
    text-decoration: none;
}

/* Alert Boxes */
.freefactu-info-box {
    background: #e7f3ff;
    border-left: 4px solid #2271b1;
    padding: 15px;
    margin: 20px 0;
}

.freefactu-warning-box {
    background: #fff8e5;
    border-left: 4px solid #ffb900;
    padding: 15px;
    margin: 20px 0;
}

.freefactu-error-box {
    background: #ffe5e5;
    border-left: 4px solid #dc3232;
    padding: 15px;
    margin: 20px 0;
}

/* XML Viewer */
.freefactu-xml-view {
    font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
    font-size: 13px;
    line-height: 1.5;
    background: #282c34;
    color: #abb2bf;
    padding: 15px;
    border-radius: 4px;
    overflow: auto;
    max-height: 600px;
    white-space: pre;
    tab-size: 2;
}

.freefactu-xml-view .xml-tag {
    color: #e06c75;
}

.freefactu-xml-view .xml-attr-name {
    color: #d19a66;
}

.freefactu-xml-view .xml-attr-val {
    color: #98c379;
}

.freefactu-xml-view .xml-comment {
    color: #5c6370;
    font-style: italic;
}

.freefactu-xml-view .xml-content {
    color: #abb2bf;
}

/* Non-prefixed XML view (for format_and_highlight_xml output) */
.xml-view {
    font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
    font-size: 13px;
    line-height: 1.5;
    background: #282c34;
    color: #abb2bf;
    padding: 15px;
    border-radius: 4px;
    overflow: auto;
    max-height: 600px;
    white-space: pre;
    tab-size: 2;
}

.xml-tag {
    color: #e06c75;
}

.xml-attr-name {
    color: #d19a66;
}

.xml-attr-val {
    color: #98c379;
}

.xml-comment {
    color: #5c6370;
    font-style: italic;
}

.xml-comment * {
    color: #5c6370 !important;
}

.xml-content {
    color: #abb2bf;
}

/* Hash Display */
.freefactu-hash-display {
    display: flex;
    align-items: center;
    gap: 8px;
}

.freefactu-hash-display .hash-short {
    cursor: pointer;
}

.freefactu-hash-display .hash-full {
    display: none;
    margin-top: 8px;
}

.freefactu-hash-display .hash-full code {
    word-break: break-all;
    font-size: 11px;
    background: #f0f0f0;
    padding: 8px;
    display: block;
    border-radius: 4px;
}

/* Chain Validation Indicators */
.freefactu-chain-valid {
    color: #46b450;
}

.freefactu-chain-first {
    color: #0073aa;
}

.freefactu-chain-invalid {
    color: #dc3232;
}

/* Copy/Toggle Buttons */
.freefactu-copy-btn,
.freefactu-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.freefactu-copy-btn .dashicons,
.freefactu-toggle-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    line-height: 1;
    vertical-align: middle;
}

/* Individual icon vertical adjustments */
.freefactu-copy-btn .dashicons-clipboard,
.freefactu-toggle-btn .dashicons-clipboard {
    margin-top: -1px;
}

.freefactu-copy-btn .dashicons-visibility,
.freefactu-toggle-btn .dashicons-visibility {
    margin-top: -3px;
}

/* XML Toggle/Copy buttons with proper dashicon alignment */
.freefactu-xml-wrapper .button {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-right: 8px;
}

.freefactu-xml-wrapper .button .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    line-height: 1;
    vertical-align: middle;
}

.freefactu-xml-wrapper .button .dashicons-visibility {
    margin-top: 2px;
}

.freefactu-xml-wrapper .button .dashicons-clipboard {
    margin-top: 4px;
}

/* Debug Link */
.freefactu-debug-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

.freefactu-debug-link code {
    background: #e7f3ff;
    border: 1px solid #2271b1;
    padding: 4px 8px;
}

/* ==========================================================================
   ACCESSIBILITY
   Focus states and screen reader support
   ========================================================================== */

.freefactu-filter-section input:focus,
.freefactu-filter-section select:focus {
    outline: 2px solid #2271b1;
    outline-offset: 1px;
}

/* Screen reader only text */
.screen-reader-text {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
    word-wrap: normal !important;
}

/* ==========================================================================
   DEBUG MODAL
   AJAX-loaded modal for viewing invoice debug information
   ========================================================================== */

/* Modal Overlay */
.freefactu-debug-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.freefactu-debug-modal-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

/* Modal Container */
.freefactu-debug-modal {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    max-width: 1100px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    transform: scale(0.95);
    transition: transform 0.2s ease;
    overflow: hidden;
}

.freefactu-debug-modal-overlay.is-visible .freefactu-debug-modal {
    transform: scale(1);
}

/* Modal Content Wrapper - enables flex layout for header/body */
#freefactu-debug-modal-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    /* Critical for flex scrolling */
    overflow: hidden;
}

/* Modal Header */
.freefactu-debug-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #e0e0e0;
    background: #f9f9f9;
    border-radius: 8px 8px 0 0;
    flex-shrink: 0;
    /* Prevent header from shrinking */
}

.freefactu-debug-modal-header h2 {
    margin: 0;
    font-size: 18px;
    color: #1d2327;
    display: flex;
    align-items: center;
    gap: 8px;
}

.freefactu-debug-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 5px;
    line-height: 1;
    border-radius: 4px;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.freefactu-debug-modal-close:hover {
    background-color: #e0e0e0;
    color: #1d2327;
}

.freefactu-debug-modal-close .dashicons {
    font-size: 24px;
    width: 24px;
    height: 24px;
}

/* Modal Body */
.freefactu-debug-modal-body {
    padding: 25px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    /* Critical for flex-based scrolling */
}

.freefactu-debug-modal-body h3 {
    margin-top: 25px;
    color: #2271b1;
    border-bottom: 1px solid #ddd;
    padding-bottom: 8px;
    font-size: 15px;
}

.freefactu-debug-modal-body h3:first-of-type {
    margin-top: 15px;
}

.freefactu-debug-modal-body h4 {
    margin: 0 0 5px;
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    font-weight: 600;
}

/* Status Grid in Modal */
.freefactu-debug-modal-body .freefactu-status-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
    margin: 15px 0;
}

@media screen and (max-width: 1000px) {
    .freefactu-debug-modal-body .freefactu-status-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media screen and (max-width: 700px) {
    .freefactu-debug-modal-body .freefactu-status-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.freefactu-debug-modal-body .freefactu-status-card {
    padding: 12px;
}

.freefactu-debug-modal-body .freefactu-status-card__value {
    font-size: 16px;
    margin: 8px 0;
}

/* Meta Table in Modal */
.freefactu-debug-modal-body .freefactu-meta-table {
    margin: 15px 0;
}

.freefactu-debug-modal-body .freefactu-meta-table th,
.freefactu-debug-modal-body .freefactu-meta-table td {
    padding: 8px 10px;
    font-size: 13px;
}

/* XML Viewer in Modal - constrain height */
.freefactu-debug-modal-body .xml-view {
    max-height: 300px;
}

/* Modal Footer */
.freefactu-debug-modal-footer {
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px solid #ddd;
    text-align: center;
    color: #666;
}

/* Loading State */
.freefactu-debug-modal-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #666;
}

.freefactu-debug-modal-loading .spinner {
    float: none;
    margin: 0 0 15px;
}

/* Error State */
.freefactu-debug-modal-error {
    padding: 40px 20px;
    text-align: center;
    color: #dc3232;
}

.freefactu-debug-modal-error .dashicons {
    font-size: 48px;
    width: 48px;
    height: 48px;
    margin-bottom: 15px;
}

/* Responsive Modal */
@media screen and (max-width: 782px) {
    .freefactu-debug-modal-overlay {
        padding: 10px;
    }

    .freefactu-debug-modal {
        max-height: 95vh;
    }

    .freefactu-debug-modal-header {
        padding: 15px;
    }

    .freefactu-debug-modal-header h2 {
        font-size: 16px;
    }

    .freefactu-debug-modal-body {
        padding: 15px;
    }
}

/* ==========================================================================
   COMPARISON TABLE (Snapshot vs Actual)
   Displays differences between stored snapshot and current order data
   ========================================================================== */

.comp-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    table-layout: fixed;
}

.comp-table th,
.comp-table td {
    border: 1px solid #ccd0d4;
    padding: 8px;
    text-align: left;
    vertical-align: top;
    word-wrap: break-word;
}

.comp-table th {
    background: #f0f0f1;
    font-weight: 600;
    color: #50575e;
}

.comp-header-label {
    width: 20%;
}

.comp-header-val {
    width: 40%;
}

/* Matching values - green highlight */
.comp-match {
    background-color: #edfaef;
    color: #106a1b;
}

/* Different values - red highlight */
.comp-diff {
    background-color: #fbeaea;
    color: #b32d2e;
}

/* Section header row */
.comp-section {
    background-color: #e2e4e7;
    font-weight: bold;
    text-align: center !important;
    color: #3c434a;
}

/* Empty/null values */
.comp-empty {
    color: #a0a5aa;
    font-style: italic;
}

/* ==========================================================================
   SETTINGS SECTIONS
   Card-based sections for the settings page
   ========================================================================== */

/* Settings container */
.freefactu-settings-container {
    max-width: 1000px;
}

/* Settings section card */
.freefactu-settings-section {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 20px;
}

.freefactu-settings-section h2 {
    margin-top: 0;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    color: #1d2327;
}

.freefactu-settings-section h2 .dashicons,
.freefactu-settings-section h2>span:first-child {
    color: #2271b1;
}

/* Remove WordPress default form-table styles inside sections */
.freefactu-settings-section .form-table {
    margin-top: 0;
}

.freefactu-settings-section .form-table th {
    padding-left: 0;
    width: 220px;
    font-weight: 500;
    color: #1d2327;
}

.freefactu-settings-section .form-table td {
    padding-left: 15px;
}

/* Field groups inside sections */
.freefactu-settings-section .form-table tr {
    border-bottom: 1px solid #f0f0f1;
}

.freefactu-settings-section .form-table tr:last-child {
    border-bottom: none;
}

/* ==========================================================================
   TOOLTIPS
   Help icons with tooltip text
   ========================================================================== */

.freefactu-tooltip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: help;
    margin-left: 5px;
    color: #646970;
    vertical-align: middle;
    position: relative;
}

.freefactu-tooltip .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    line-height: 16px;
    transition: color 0.15s ease;
}

.freefactu-tooltip:hover .dashicons {
    color: #2271b1;
}

/* Enhanced tooltip with CSS (for modern browsers) */
.freefactu-tooltip[data-tooltip] {
    position: relative;
}

.freefactu-tooltip[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 12px;
    background: #1d2327;
    color: #fff;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.4;
    white-space: normal;
    width: max-content;
    max-width: 280px;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 100;
    pointer-events: none;
    margin-bottom: 8px;
}

.freefactu-tooltip[data-tooltip]::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #1d2327;
    margin-bottom: -4px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 101;
}

.freefactu-tooltip[data-tooltip]:hover::after,
.freefactu-tooltip[data-tooltip]:hover::before {
    opacity: 1;
    visibility: visible;
}

/* Tooltip positioning variants */
.freefactu-tooltip--right[data-tooltip]::after {
    left: 100%;
    bottom: 50%;
    transform: translateY(50%);
    margin-left: 8px;
    margin-bottom: 0;
}

.freefactu-tooltip--right[data-tooltip]::before {
    left: 100%;
    bottom: 50%;
    transform: translateY(50%);
    border-top-color: transparent;
    border-right-color: #1d2327;
    margin-bottom: 0;
    margin-left: -4px;
}

/* ==========================================================================
   SETTINGS FIELD LABELS WITH TOOLTIPS
   Proper alignment for labels with inline tooltips
   ========================================================================== */

.freefactu-field-label {
    display: flex;
    align-items: center;
    gap: 2px;
}

.freefactu-field-label .freefactu-tooltip {
    margin-left: 2px;
}

/* Required field indicator */
.freefactu-required {
    color: #d63638;
    font-weight: bold;
    margin-left: 2px;
}

/* Field description styling */
.freefactu-settings-section p.description {
    margin-top: 6px;
    margin-bottom: 0;
    color: #646970;
    font-size: 12px;
    line-height: 1.5;
}

/* Highlighted/important description */
.freefactu-settings-section p.description.description--important {
    color: #d63638;
    font-weight: 500;
}

.freefactu-settings-section p.description.description--success {
    color: #46b450;
}

/* ==========================================================================
   EXPORT MODAL
   Modal for exporting invoices in CSV/XML format
   ========================================================================== */

/* Modal Overlay */
.freefactu-export-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.freefactu-export-modal-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

/* Modal Container */
.freefactu-export-modal {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.35);
    max-width: 680px;
    width: 100%;
    display: flex;
    flex-direction: column;
    transform: scale(0.95);
    transition: transform 0.2s ease;
    overflow: hidden;
}

.freefactu-export-modal-overlay.is-visible .freefactu-export-modal {
    transform: scale(1);
}

/* Modal Header */
.freefactu-export-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #e0e0e0;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px 12px 0 0;
}

.freefactu-export-modal-header h2 {
    margin: 0;
    font-size: 18px;
    color: #1d2327;
    display: flex;
    align-items: center;
    gap: 10px;
}

.freefactu-export-modal-header h2 .dashicons {
    color: #2271b1;
    font-size: 22px;
    width: 22px;
    height: 22px;
}

.freefactu-export-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 5px;
    line-height: 1;
    border-radius: 6px;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.freefactu-export-modal-close:hover {
    background-color: #e0e0e0;
    color: #1d2327;
}

.freefactu-export-modal-close .dashicons {
    font-size: 24px;
    width: 24px;
    height: 24px;
}

/* Modal Body */
.freefactu-export-modal-body {
    padding: 25px;
    box-sizing: border-box;
}

.freefactu-export-description {
    margin: 0 0 20px;
    color: #646970;
    font-size: 14px;
    line-height: 1.5;
}

/* Date Fields */
.freefactu-export-dates {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.freefactu-export-field label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #1d2327;
    margin-bottom: 6px;
}

.freefactu-export-field input[type="date"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #c3c4c7;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.freefactu-export-field input[type="date"]:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.15);
    outline: none;
}

/* Export Formats Section */
.freefactu-export-formats {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-top: 4px;
    box-sizing: border-box;
    overflow: hidden;
}

.freefactu-export-formats-title {
    margin: 0 0 16px;
    font-size: 13px;
    font-weight: 600;
    color: #1d2327;
}

/* Export Buttons */
.freefactu-export-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    box-sizing: border-box;
    overflow: hidden;
}

.freefactu-export-buttons .button.button-hero {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    height: auto;
    font-size: 14px;
    line-height: 1.4;
    border-radius: 8px;
    border: 1px solid #c3c4c7;
    background: #fff;
    color: #1d2327;
    transition: all 0.2s ease;
    text-align: left;
    cursor: pointer;
    box-sizing: border-box;
    min-width: 0;
    width: 100%;
}

.freefactu-export-buttons .button.button-hero:hover {
    background: #f0f0f1;
    border-color: #2271b1;
    color: #2271b1;
}

.freefactu-export-buttons .button.button-hero:active {
    transform: scale(0.98);
}

.freefactu-export-buttons .button.button-hero .dashicons {
    font-size: 28px;
    width: 28px;
    height: 28px;
    color: #2271b1;
    flex-shrink: 0;
}

.freefactu-export-btn-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.freefactu-export-btn-content strong {
    font-size: 14px;
    font-weight: 600;
}

.freefactu-export-btn-content small {
    font-size: 11px;
    color: #646970;
    font-weight: 400;
}

/* Responsive Export Modal */
@media screen and (max-width: 600px) {
    .freefactu-export-modal {
        max-width: calc(100% - 20px);
    }

    .freefactu-export-dates {
        grid-template-columns: 1fr;
    }

    .freefactu-export-buttons {
        grid-template-columns: 1fr;
    }

    .freefactu-export-modal-header {
        padding: 15px;
    }

    .freefactu-export-modal-body {
        padding: 15px;
    }
}

/* ==========================================================================
   DATA RETENTION SECTION (Danger Zone)
   Styling for uninstall data deletion options
   ========================================================================== */

/* Danger variant of settings section */
.freefactu-settings-section--danger {
    border-color: #d63638;
    border-left-width: 4px;
}

.freefactu-settings-section--danger h2 {
    color: #8b1c1c;
    border-bottom-color: #facfc0;
}

.freefactu-settings-section--danger h2>span:first-child {
    color: #d63638;
}

/* Danger checkbox styling */
.freefactu-danger-checkbox {
    display: inline-flex;
    align-items: flex-start;
    gap: 8px;
    cursor: pointer;
}

.freefactu-danger-checkbox input[type="checkbox"] {
    margin-top: 2px;
    accent-color: #d63638;
}

.freefactu-danger-checkbox input[type="checkbox"]:checked+span,
.freefactu-danger-checkbox input[type="checkbox"]:checked~* {
    color: #8b1c1c;
}

/* Danger description text */
.freefactu-settings-section p.description.description--danger {
    color: #d63638;
    font-weight: 500;
}

/* Warning box inside danger section */
.freefactu-settings-section--danger .freefactu-warning-box {
    background: #fff8e5;
    border-left: 4px solid #dba617;
    padding: 12px 16px;
    margin-bottom: 20px;
    border-radius: 0 4px 4px 0;
}

/* Confirmation state when checkbox is checked */
.freefactu-settings-section--danger .form-table tr:has(input:checked) {
    background-color: #fef0f0;
}

/* Visual feedback for dangerous options being selected */
.freefactu-settings-section--danger .form-table input[type="checkbox"]:checked {
    box-shadow: 0 0 0 3px rgba(214, 54, 56, 0.15);
}

/* ==========================================================================
   TAB CONTENT CONTAINERS
   Max-width constraints for different tab content areas
   ========================================================================== */

/* Container for tabs that need max-width (everything except Facturas) */
.freefactu-tab-container {
    max-width: 1000px;
}

/* ==========================================================================
   EXTENSIONS PAGE
   Card-based UI for managing plugin extensions (matches plugin design patterns)
   ========================================================================== */

/* Page Container */
.freefactu-extensions-page {
    max-width: 1000px;
}

/* Header Section */
.freefactu-extensions-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #ddd;
    gap: 20px;
    flex-wrap: wrap;
}

.freefactu-extensions-header__content h2 {
    font-size: 18px;
    font-weight: 600;
    color: #1d2327;
    margin: 0 0 8px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.freefactu-extensions-header__subtitle {
    font-size: 13px;
    color: #646970;
    margin: 0;
    max-width: 600px;
    line-height: 1.5;
}

/* Stats Display */
.freefactu-extensions-header__stats {
    display: flex;
    gap: 15px;
}

.freefactu-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 20px;
    background: #f9f9f9;
    border-radius: 4px;
    border: 1px solid #c3c4c7;
    min-width: 70px;
}

.freefactu-stat__number {
    font-size: 24px;
    font-weight: 700;
    color: #2271b1;
    line-height: 1;
}

.freefactu-stat__label {
    font-size: 11px;
    font-weight: 500;
    color: #646970;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-top: 4px;
}

/* Extensions Grid */
.freefactu-extensions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

/* Extension Card - matches .freefactu-settings-section */
.freefactu-extension-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    padding: 20px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    overflow: hidden;
}

.freefactu-extension-card:hover {
    border-color: #8c8f94;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.13);
}

.freefactu-extension-card.is-active {
    border-color: #46b450;
    border-left-width: 4px;
}

.freefactu-extension-card.is-required {
    border-color: #2271b1;
    border-left-width: 4px;
}

/* Card Badges */
.freefactu-extension-card__badge {
    position: absolute;
    top: 12px;
    right: 12px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.freefactu-extension-card__badge .dashicons {
    font-size: 12px;
    width: 12px;
    height: 12px;
}

.freefactu-extension-card__badge--required {
    background: #e7f3ff;
    color: #2271b1;
    border: 1px solid #2271b1;
}

.freefactu-extension-card__badge--active {
    background: #edfaef;
    color: #46b450;
    border: 1px solid #46b450;
}

/* Card Icon */
.freefactu-extension-card__icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f0f1;
    border-radius: 4px;
    margin-bottom: 15px;
    transition: background-color 0.15s ease;
}

.freefactu-extension-card.is-required .freefactu-extension-card__icon {
    background: #e7f3ff;
}

.freefactu-extension-card.is-active:not(.is-required) .freefactu-extension-card__icon {
    background: #edfaef;
}

.freefactu-extension-card__icon .dashicons {
    font-size: 24px;
    width: 24px;
    height: 24px;
    color: #646970;
    transition: color 0.15s ease;
}

.freefactu-extension-card.is-required .freefactu-extension-card__icon .dashicons {
    color: #2271b1;
}

.freefactu-extension-card.is-active:not(.is-required) .freefactu-extension-card__icon .dashicons {
    color: #46b450;
}

.freefactu-extension-card:hover .freefactu-extension-card__icon .dashicons {
    color: #2271b1;
}

/* Card Content */
.freefactu-extension-card__content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.freefactu-extension-card__title {
    font-size: 15px;
    font-weight: 600;
    color: #1d2327;
    margin: 0 0 8px 0;
    line-height: 1.3;
}

.freefactu-extension-card__description {
    font-size: 13px;
    color: #646970;
    line-height: 1.5;
    margin: 0 0 12px 0;
    flex: 1;
}

/* Card Meta */
.freefactu-extension-card__meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid #f0f0f1;
}

.freefactu-extension-card__version,
.freefactu-extension-card__author {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: #8c8f94;
}

.freefactu-extension-card__meta .dashicons {
    font-size: 12px;
    width: 12px;
    height: 12px;
}

/* Card Footer */
.freefactu-extension-card__footer {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #f0f0f1;
}

/* Extension Buttons - matches plugin button patterns */
.freefactu-extension-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.freefactu-extension-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    line-height: 1.7;
    margin-top: 1px;
}

.freefactu-extension-btn--activate {
    background: #2271b1;
    border: 1px solid #2271b1;
    color: #fff;
}

.freefactu-extension-btn--activate:hover {
    background: #135e96;
    border-color: #135e96;
}

.freefactu-extension-btn--deactivate {
    background: #fff;
    border: 1px solid #c3c4c7;
    color: #50575e;
}

.freefactu-extension-btn--deactivate:hover {
    background: #fef0f0;
    border-color: #d63638;
    color: #d63638;
}

.freefactu-extension-btn--disabled {
    background: #f0f0f1;
    border: 1px solid #dcdcde;
    color: #a7aaad;
    cursor: not-allowed;
}

.freefactu-extension-btn.is-loading {
    opacity: 0.7;
    pointer-events: none;
}

.freefactu-extension-btn.is-loading .dashicons {
    display: none;
}

.freefactu-extension-btn.is-loading::before {
    content: '';
    display: inline-block;
    width: 13px;
    height: 13px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: freefactu-spin 0.8s linear infinite;
    flex-shrink: 0;
    box-sizing: border-box;
    margin-right: 0;
    margin-top: 2px;
}

@keyframes freefactu-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Active indicator bar for active optional extensions */
.freefactu-extension-card__glow {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: #46b450;
}

/* Footer Info - matches .freefactu-info-box */
.freefactu-extensions-footer {
    margin-top: 15px;
}

.freefactu-extensions-footer__info {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 15px;
    background: #e7f3ff;
    border-left: 4px solid #2271b1;
}

.freefactu-extensions-footer__info .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
    color: #2271b1;
    flex-shrink: 0;
    margin-top: 1px;
}

.freefactu-extensions-footer__info p {
    font-size: 13px;
    color: #1d2327;
    line-height: 1.5;
    margin: 0;
}

/* Responsive */
@media screen and (max-width: 782px) {
    .freefactu-extensions-header {
        flex-direction: column;
    }

    .freefactu-extensions-header__stats {
        width: 100%;
        justify-content: flex-start;
    }

    .freefactu-extensions-grid {
        grid-template-columns: 1fr;
    }

    .freefactu-stat {
        flex: 1;
    }
}

/* ==========================================================================
   EXTENSION SETTINGS SECTIONS
   Styling for extension configuration sections in Configuración tab
   ========================================================================== */

/* Extension section in settings - distinct from core sections */
.freefactu-extension-section {
    border-left: 4px solid #8c8f94;
    background: #fcfcfc;
}

.freefactu-extension-section h2 {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Extension badge in section title */
.freefactu-extension-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    background: linear-gradient(135deg, #f0f6fc 0%, #e8f2fb 100%);
    color: #2271b1;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid #c3daf5;
    border-radius: 12px;
    margin-left: 8px;
}

/* Extension section hover effect */
.freefactu-extension-section:hover {
    border-left-color: #2271b1;
}

/* Fieldset within extension settings */
.freefactu-extension-section fieldset {
    margin: 0;
    padding: 0;
    border: none;
}

.freefactu-extension-section fieldset legend {
    position: absolute;
    left: -9999px;
}

/* Ensure form tables in extension sections match main style */
.freefactu-extension-section .form-table th {
    padding-top: 15px;
    padding-bottom: 15px;
    vertical-align: top;
}

.freefactu-extension-section .form-table td {
    padding-top: 15px;
    padding-bottom: 15px;
}

/* ==========================================================================
   AEAT STATUS BADGES & UI HELPERS
   Styles for AEAT invoice status display and action buttons
   ========================================================================== */

.aeat-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.aeat-status-badge .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

.aeat-status-accepted {
    background: #d4edda;
    color: #155724;
}

.aeat-status-subsanated {
    background: #cce5ff;
    color: #004085;
}

.aeat-status-warnings {
    background: #fff3cd;
    color: #856404;
}

.aeat-status-rejected {
    background: #f8d7da;
    color: #721c24;
}

.aeat-status-pending {
    background: #e9ecef;
    color: #495057;
}

.aeat-action-buttons {
    margin-top: 10px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.aeat-action-buttons .button {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.aeat-action-buttons .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.aeat-action-buttons .attempts-count {
    font-size: 11px;
    opacity: 0.8;
}

.aeat-error-explanation {
    background: #f8f9fa;
    border-left: 4px solid #dc3545;
    padding: 12px 16px;
    margin: 10px 0;
}

.aeat-error-explanation .error-category,
.aeat-error-explanation .error-message {
    margin-bottom: 8px;
}

.subsanable-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px;
    border-radius: 4px;
    margin-top: 8px;
}

.subsanable-yes {
    background: #d4edda;
    color: #155724;
}

.subsanable-no {
    background: #fff3cd;
    color: #856404;
}

/* ==========================================================================
   AEAT TEST SCENARIOS
   Styles for AEAT error handling test results display
   ========================================================================== */

.aeat-test-results .test-summary {
    padding: 12px;
    margin-bottom: 15px;
    border-radius: 4px;
}

.aeat-test-results .test-summary.all-passed {
    background: #d4edda;
    color: #155724;
}

.aeat-test-results .test-summary.has-failures {
    background: #f8d7da;
    color: #721c24;
}

.aeat-test-results tr.failed {
    background: #fff5f5 !important;
}

.aeat-test-results .mismatch {
    color: #721c24;
    margin: 4px 0;
}

/* ==========================================================================
   SETTINGS PAGE UTILITIES
   ========================================================================== */

.freefactu-settings-description {
    margin-top: 0;
    margin-bottom: 15px;
}

.freefactu-settings-info-btn-container {
    margin-top: 12px;
}

.freefactu-btn-icon {
    vertical-align: middle;
    margin-right: 3px;
}

.freefactu-text-small {
    font-size: 11px;
}

.freefactu-settings-warning-box {
    background: #fff8e5;
    border-left: 4px solid #dba617;
    padding: 12px 16px;
    margin-bottom: 20px;
    border-radius: 0 4px 4px 0;
}

.freefactu-settings-warning-box p {
    margin: 0;
    color: #856404;
}

.freefactu-warning-icon {
    color: #dba617;
    margin-right: 5px;
    vertical-align: middle;
}

.freefactu-mt-10 {
    margin-top: 10px;
}

/* ==========================================================================
   HISTORY PAGE UTILITIES
   ========================================================================== */

.freefactu-table-nopadding-cell {
    padding: 0 !important;
}

.freefactu-empty-state-card {
    background: #f6f7f7;
    border-radius: 4px;
    padding: 40px 30px;
    text-align: center;
    margin: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.freefactu-empty-state-card-icon {
    font-size: 24px;
    margin-bottom: 16px;
}

.freefactu-empty-state-card-title {
    margin: 0 0 10px;
    color: #1d2327;
    font-size: 18px;
    font-weight: 600;
}

.freefactu-empty-state-card-text {
    margin: 0 0 20px;
    color: #646970;
    max-width: 480px;
    line-height: 1.6;
    font-size: 14px;
}

.freefactu-btn-flex {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.freefactu-icon-16 {
    font-size: 16px;
    width: 16px;
    height: 16px;
    line-height: 1;
    vertical-align: middle;
}

.freefactu-align-text-bottom {
    vertical-align: text-bottom;
}

/* ==========================================================================
   TOOLTIP COMPONENT
   Reusable tooltip with help icon, supports size variants
   ========================================================================== */

.freefactu-tooltip {
    cursor: help;
    margin-left: 4px;
    color: #646970;
    vertical-align: middle;
}

.freefactu-tooltip__icon {
    vertical-align: middle;
}

/* Size modifiers - controlled via CSS custom properties for flexibility */
.freefactu-tooltip--small .freefactu-tooltip__icon {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

.freefactu-tooltip--medium .freefactu-tooltip__icon,
.freefactu-tooltip__icon {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* ==========================================================================
   SETTINGS SECTION COMPONENT
   Styled container for grouping settings fields with variant support
   ========================================================================== */

.freefactu-settings-section {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 20px;
}

.freefactu-settings-section__header {
    margin-top: 0;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.freefactu-settings-section__icon {
    color: #2271b1;
}

.freefactu-settings-section__description {
    margin-top: 0;
    margin-bottom: 15px;
    color: #646970;
}

/* Variant modifiers */
.freefactu-settings-section--warning {
    border-color: #ffb900;
}

.freefactu-settings-section--info {
    border-color: #2271b1;
}

.freefactu-settings-section--success {
    border-color: #46b450;
}

/* ==========================================================================
   ENVIRONMENT INFO MODAL
   Modal explaining test vs production environments
   ========================================================================== */

.freefactu-environment-modal {
    max-width: 700px;
}

.freefactu-environment-modal__body {
    padding: 25px;
}

.freefactu-environment-modal__header-title {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.freefactu-environment-modal__header-icon {
    color: #2271b1;
}

/* Environment section - base styles */
.freefactu-environment-section {
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 20px;
}

.freefactu-environment-section--test {
    background: #f0f6fc;
    border-left: 4px solid #2271b1;
}

.freefactu-environment-section--production {
    background: #f6f7f7;
    border-left: 4px solid #46b450;
}

.freefactu-environment-section--warning {
    background: #fef0f0;
    border: 1px solid #d63638;
    border-left: 4px solid #d63638;
}

.freefactu-environment-section__title {
    margin: 0 0 12px 0;
    color: #1d2327;
    display: flex;
    align-items: center;
    gap: 8px;
}

.freefactu-environment-section--warning .freefactu-environment-section__title {
    color: #8b1c1c;
}

/* Environment badge */
.freefactu-environment-badge {
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 11px;
    text-transform: uppercase;
    color: #fff;
}

.freefactu-environment-badge--test {
    background: #2271b1;
}

.freefactu-environment-badge--production {
    background: #46b450;
}

/* Environment list */
.freefactu-environment-section__list {
    margin: 0 0 15px 20px;
    padding: 0;
    color: #50575e;
    line-height: 1.8;
}

/* Environment info box */
.freefactu-environment-info-box {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    padding: 12px;
}

.freefactu-environment-info-box__title {
    margin: 0 0 10px 0;
    font-weight: 600;
    color: #1d2327;
}

.freefactu-environment-info-box__icon {
    vertical-align: middle;
}

.freefactu-environment-info-box__icon--test {
    color: #2271b1;
}

.freefactu-environment-info-box__icon--production {
    color: #46b450;
}

.freefactu-environment-info-box__note {
    margin: 8px 0 0 0;
    font-size: 12px;
    color: #646970;
}

.freefactu-environment-info-box .dashicons-external {
    font-size: 14px;
    line-height: 1.8;
}

/* Warning section content */
.freefactu-environment-section--warning .freefactu-environment-section__content {
    color: #8b1c1c;
    line-height: 1.8;
}

.freefactu-environment-section--warning .freefactu-environment-section__subtitle {
    margin: 0 0 12px 0;
    font-weight: 600;
}

.freefactu-environment-section--warning .freefactu-environment-section__list {
    margin: 0 0 15px 20px;
    padding: 0;
}

.freefactu-environment-warning-icon {
    color: #d63638;
}

/* Recommendation box */
.freefactu-environment-recommendation {
    margin: 0;
    padding: 12px;
    background: rgba(214, 54, 56, 0.1);
    border-radius: 4px;
}

.freefactu-environment-recommendation__icon {
    color: #46b450;
    vertical-align: middle;
}

/* Modal footer */
.freefactu-environment-modal__footer {
    padding: 15px 25px;
    background: #f6f7f7;
    border-top: 1px solid #dcdcde;
    text-align: right;
    border-radius: 0 0 8px 8px;
}

/* ==========================================================================
   DEBUG VIEW UTILITIES
   Small helper styles for debug modal/page views
   ========================================================================== */

.freefactu-text-muted {
    color: #666;
}

/* ==========================================================================
   EXTENSION SERIES SECTION
   Shared styling for series management in extensions (presupuestos, etc.)
   ========================================================================== */

.freefactu-series-section {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 20px;
}

.freefactu-series-section__header {
    margin-top: 0;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.freefactu-series-section__badge {
    background: #0073aa;
    color: #fff;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: 8px;
    font-weight: normal;
}

.freefactu-series-section__empty {
    background: #f6f7f7;
    border-radius: 4px;
    padding: 30px;
    text-align: center;
}

.freefactu-series-section__empty-text {
    margin: 0;
    color: #646970;
}

/* Series Item */
.freefactu-series-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border: 1px solid #dcdcde;
    border-radius: 4px;
    margin-bottom: 10px;
    background: #fff;
}

.freefactu-series-item.is-active {
    border-color: #0073aa;
    background: #f0f6fc;
}

.freefactu-series-item__label {
    display: flex;
    align-items: center;
    flex: 1;
    cursor: pointer;
}

.freefactu-series-item__radio {
    margin-right: 15px;
    transform: scale(1.3);
}

.freefactu-series-item__name {
    font-size: 14px;
    font-weight: 600;
}

.freefactu-series-item__preview {
    color: #50575e;
    margin-top: 4px;
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
}

.freefactu-series-item__code {
    background: #f0f0f1;
    padding: 2px 6px;
    border-radius: 3px;
}

.freefactu-series-item__usage {
    color: #757575;
    margin-top: 2px;
    display: block;
    font-size: 12px;
}

.freefactu-series-item__delete-btn {
    margin-left: 10px;
}

/* Series badges */
.freefactu-series-badge {
    margin-left: 10px;
    padding: 4px 10px;
    border-radius: 3px;
    font-size: 11px;
}

.freefactu-series-badge--used {
    background: #dcdcde;
    color: #50575e;
}

.freefactu-series-badge--active {
    background: #0073aa;
    color: #fff;
    text-transform: uppercase;
}

/* ==========================================================================
   SERIES DIALOG
   Modal dialog for creating new series
   ========================================================================== */

.freefactu-series-dialog {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 100000;
    justify-content: center;
    align-items: center;
}

.freefactu-series-dialog.is-open {
    display: flex;
}

.freefactu-series-dialog__content {
    background: #fff;
    border-radius: 8px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.freefactu-series-dialog__header {
    margin-top: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.freefactu-series-dialog__close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #757575;
}

.freefactu-series-dialog__close:hover {
    color: #1d2327;
}

/* Series preview box */
.freefactu-series-preview {
    background: linear-gradient(135deg, #0073aa 0%, #005177 100%);
    border-radius: 8px;
    padding: 15px 20px;
    margin-bottom: 20px;
}

.freefactu-series-preview__label {
    color: rgba(255, 255, 255, 0.8);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 5px;
}

.freefactu-series-preview__number {
    color: #fff;
    font-size: 22px;
    font-weight: 600;
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    letter-spacing: 1px;
}

/* Form inputs */
.freefactu-series-dialog__input {
    width: 100%;
    margin-top: 5px;
}

.freefactu-series-dialog__footer {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: flex-end;
}

/* ==========================================================================
   STATUS LABELS
   Inline status indicators with color variants
   ========================================================================== */

.freefactu-status-label {
    display: inline;
}

.freefactu-status-label--expired {
    color: #d63638;
}

.freefactu-status-label--converted {
    color: #0073aa;
}

.freefactu-status-label--created {
    color: #46b450;
}

/* ==========================================================================
   ICON UTILITIES
   Reusable icon sizing and alignment classes
   ========================================================================== */

.freefactu-icon-inline {
    width: 16px;
    height: 16px;
    vertical-align: middle;
    margin-right: 5px;
}

.freefactu-btn-icon {
    vertical-align: middle;
    margin-right: 3px;
}

/* ==========================================================================
   EXTENSION SETTINGS FORM
   Form styling for extension configuration sections
   ========================================================================== */

.freefactu-extension-form-label {
    display: block;
    margin-bottom: 8px;
}

.freefactu-extension-form-description {
    color: #666;
}

.freefactu-extension-form-gap {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

/* ==========================================================================
   CERTIFICATE HELP MODAL
   Modal explaining how to obtain a digital certificate
   ========================================================================== */

.freefactu-certificate-modal {
    max-width: 750px;
}

.freefactu-certificate-modal__body {
    padding: 25px;
}

.freefactu-certificate-modal__intro {
    margin: 0 0 20px 0;
    color: #50575e;
    font-size: 14px;
}

.freefactu-certificate-modal__header-title {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.freefactu-certificate-modal__header-icon {
    color: #2271b1;
}

/* Certificate option cards */
.freefactu-cert-option {
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 12px;
}

.freefactu-cert-option--fnmt-empresa {
    border-left: 4px solid #2271b1;
}

.freefactu-cert-option--fnmt-persona {
    border-left: 4px solid #46b450;
}

.freefactu-cert-option--dnie {
    border-left: 4px solid #9b59b6;
}

.freefactu-cert-option--other {
    border-left: 4px solid #646970;
    margin-bottom: 20px;
}

.freefactu-cert-option--export {
    background: #fff8e5;
    border: 1px solid #ffb900;
    border-left: 4px solid #ffb900;
    padding: 20px;
}

.freefactu-cert-option__title {
    margin: 0 0 8px 0;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #1d2327;
}

.freefactu-cert-option--export .freefactu-cert-option__title {
    margin: 0 0 12px 0;
    color: #996800;
}

/* Step number badges */
.freefactu-cert-step-badge {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    color: #fff;
}

.freefactu-cert-step-badge--1 {
    background: #2271b1;
}

.freefactu-cert-step-badge--2 {
    background: #46b450;
}

.freefactu-cert-step-badge--3 {
    background: #9b59b6;
}

.freefactu-cert-step-badge--4 {
    background: #646970;
}

/* Free badge */
.freefactu-cert-free-badge {
    background: #46b450;
    color: #fff;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 10px;
    text-transform: uppercase;
}

/* Option description */
.freefactu-cert-option__desc {
    margin: 0 0 10px 30px;
    color: #50575e;
    font-size: 13px;
}

.freefactu-cert-option--export .freefactu-cert-option__desc {
    margin-left: 0;
    margin-bottom: 12px;
}

/* Option buttons container */
.freefactu-cert-option__buttons {
    margin-left: 30px;
}

.freefactu-cert-option__buttons--flex {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.freefactu-cert-option--export .freefactu-cert-option__buttons {
    margin-left: 0;
}

/* Export instructions list */
.freefactu-cert-export-list {
    margin: 0 0 15px 20px;
    padding-left: 0;
    color: #50575e;
    font-size: 13px;
    line-height: 1.8;
}

/* Icon in button */
.freefactu-cert-btn-icon {
    font-size: 14px;
    line-height: 1.8;
}

/* Export icon  */
.freefactu-cert-export-icon {
    color: #ffb900;
}

/* ==========================================================================
   DEBUG SNAPSHOT COMPARISON
   Styles for snapshot vs current order comparison
   ========================================================================== */

.freefactu-snapshot-heading {
    margin-top: 30px;
}

.freefactu-snapshot-warning {
    margin-top: 15px;
}

.freefactu-snapshot-warning__list {
    margin: 10px 0 0 20px;
}

.freefactu-snapshot-success {
    margin-top: 15px;
    background: #e7ffe7;
    border-left-color: #46b450;
}

/* Comparison table sub-header rows */
.freefactu-comp-item-header {
    background: #f9f9f9;
    padding: 4px 8px;
    font-weight: 600;
    font-size: 11px;
}

.freefactu-comp-empty-center {
    text-align: center;
}

/* ==========================================================================
   FORM UTILITIES
   Additional utility classes for forms and separators
   ========================================================================== */

.freefactu-form-separator {
    margin: 12px 0;
    border: none;
    border-top: 1px solid #ddd;
}

.freefactu-form-note {
    margin-top: 10px;
}