/**
 * All of the CSS for your admin-specific functionality should be
 * included in this file.
 */

/* Hide WordPress admin notices in FFL Checkout admin pages */
.toplevel_page_ffl-api-settings .notice,
.toplevel_page_ffl-api-settings .update-nag,
.toplevel_page_ffl-api-settings .error,
.toplevel_page_ffl-api-settings .updated,
.toplevel_page_ffl-api-settings .notice-error,
.toplevel_page_ffl-api-settings .notice-warning,
.toplevel_page_ffl-api-settings .notice-success,
.toplevel_page_ffl-api-settings .notice-info {
    display: none !important;
}

/* Reset button styling */
.reset-form {
    display: inline-block;
    margin-left: 10px;
    position: relative;
    vertical-align: top;
}

@media screen and (max-width: 782px) {
    .reset-form {
        margin-top: 10px;
        margin-left: 0;
        display: block;
    }
}

/* State selection interface styling */
.ammo-states-container {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 15px;
    background: #f9f9f9;
    max-width: 600px;
}

.ammo-states-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
    min-height: 40px;
    padding: 10px;
    background: white;
    border: 1px solid #ccc;
    border-radius: 3px;
}

.ammo-state-tag {
    background: #0073aa;
    color: white;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.ammo-state-tag .remove-state {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0;
    margin: 0;
}

.ammo-state-tag .remove-state:hover {
    color: #ff6b6b;
}

.add-state-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.add-state-select {
    padding: 5px;
    border: 1px solid #ccc;
    border-radius: 3px;
    min-width: 200px;
}

.add-state-btn {
    background: #0073aa;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 3px;
    cursor: pointer;
}

.add-state-btn:hover {
    background: #005a87;
}

.add-state-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* FFL Blacklist Management Styles */
.ffl-blacklist-search-container {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 20px;
    margin-bottom: 20px;
}

.ffl-blacklist-search-container table {
    width: 100%;
    border-collapse: collapse;
}

.ffl-blacklist-search-container td {
    padding: 8px;
    vertical-align: bottom;
}

.ffl-blacklist-search-container input,
.ffl-blacklist-search-container select {
    width: 100%;
    padding: 5px;
    border: 1px solid #ccc;
    border-radius: 3px;
}

.ffl-blacklist-search-container label {
    font-weight: bold;
    display: block;
    margin-bottom: 5px;
}

.ffl-search-results {
    margin-top: 20px;
}

.ffl-search-results table {
    background: white;
    border: 1px solid #ddd;
    border-radius: 3px;
}

.ffl-search-results th {
    background: #f1f1f1;
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.ffl-search-results td {
    padding: 10px;
    border-bottom: 1px solid #eee;
}

.ffl-search-loading {
    text-align: center;
    padding: 20px;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 3px;
    margin-top: 10px;
}

.ffl-blacklist-table th {
    background: #f7f7f7;
    font-weight: bold;
}

.ffl-blacklist-table .button-small {
    padding: 2px 8px;
    font-size: 11px;
    height: auto;
    line-height: 1.4;
}

.ffl-blacklist-controls {
    margin-bottom: 15px;
    padding: 10px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 3px;
}

.ffl-blacklist-controls .button {
    margin-right: 10px;
}

/* FFL Blacklist Panel Styles */
#ffl-blacklist-panel {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 20px;
    margin-top: 20px;
}

#ffl-blacklist-panel h3,
#ffl-blacklist-panel h4 {
    color: #23282d;
    margin-top: 0;
}

.ffl-panel-search-section {
    background: #fff;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.ffl-panel-blacklist-section {
    background: #fff;
    padding: 20px;
    border-radius: 4px;
    border: 1px solid #ddd;
}

/* Panel specific search results */
.panel-ffl-search-container table {
    width: 100%;
    border-collapse: collapse;
}

.panel-ffl-search-container td {
    padding: 8px;
    vertical-align: top;
}

.panel-ffl-search-container input,
.panel-ffl-search-container select {
    width: 100%;
    padding: 6px;
    border: 1px solid #ddd;
    border-radius: 3px;
}

.panel-ffl-search-container label {
    font-weight: bold;
    display: block;
    margin-bottom: 3px;
}

/* FFL Blacklist Panel Search Form Improvements */
#panel-ffl-search-container input,
#panel-ffl-search-container select {
    height: 34px;
    padding: 6px 8px;
    line-height: 1.4;
    box-sizing: border-box;
}

/* Force search button to next line, left-aligned */
#panel-ffl-search-container > div {
    flex-wrap: wrap !important;
    display: flex !important;
}

#panel-ffl-search-container > div > div:last-child {
    flex: 0 0 100% !important;
    margin-top: 15px !important;
    order: 999 !important;
    width: 100% !important;
}

#panel-ffl-search-container > div > div:last-child label {
    display: none !important;
}

#panel_search_ffl_btn {
    height: 34px;
    padding: 0 12px;
    line-height: 32px;
    box-sizing: border-box;
    margin-top: 0 !important;
    display: inline-block !important;
    width: auto !important;
    float: none !important;
    clear: both !important;
}

/* Blacklist summary in main settings */
.ffl-blacklist-summary {
    display: flex;
    align-items: center;
    gap: 15px;
}

.ffl-blacklist-count {
    padding: 10px;
    background: #f0f0f1;
    border-radius: 4px;
    border-left: 4px solid #0073aa;
}

.ffl-blacklist-count strong {
    font-size: 16px;
    color: #0073aa;
}

/* Compact table styling for FFL management */
.ffl-compact-table {
    font-size: 12px;
}

.ffl-compact-table th {
    font-size: 11px;
    font-weight: bold;
    padding: 6px 4px;
}

.ffl-compact-table td {
    padding: 6px 4px;
    vertical-align: top;
    line-height: 1.1;
    font-size: 12px;
}

/* Ultra-compact styling for FFL details */
.ffl-compact-table td * {
    margin: 0;
    padding: 0;
}

.ffl-compact-table td br {
    line-height: 0.3;
    font-size: 1px;
}

.ffl-compact-table .button-small {
    font-size: 10px;
    padding: 2px 6px;
    height: auto;
    line-height: 1.2;
}

.ffl-compact-table strong {
    font-weight: 600;
    color: #23282d;
    line-height: 1.2;
    margin: 0;
    display: block;
}

.ffl-compact-table small {
    font-size: 10px;
    color: #666;
    display: block;
    margin: 0;
    padding: 0;
    line-height: 1.1;
}

/* Reduce spacing around br tags in FFL details */
.ffl-compact-table td br {
    line-height: 0;
    margin: 0;
    padding: 0;
    font-size: 0;
    height: 2px;
}

.ffl-compact-table td strong + br {
    height: 1px;
}

.ffl-compact-table td small + br {
    height: 1px;
}

/* Make FFL details ultra-compact */
.panel-ffl-search-results .ffl-compact-table td,
.ffl-panel-blacklist-section .ffl-compact-table td {
    line-height: 1.0;
    font-size: 11px;
    padding: 4px 6px;
}

.panel-ffl-search-results .ffl-compact-table td strong,
.ffl-panel-blacklist-section .ffl-compact-table td strong {
    font-size: 12px;
    line-height: 1.0;
    margin-bottom: 1px;
}

.panel-ffl-search-results .ffl-compact-table td small,
.ffl-panel-blacklist-section .ffl-compact-table td small {
    font-size: 10px;
    line-height: 1.0;
    margin: 0;
}

/* Ensure tables fit within panel width */
#ffl-blacklist-panel .wp-list-table {
    table-layout: fixed;
    width: 100%;
    word-wrap: break-word;
}

#ffl-blacklist-panel .wp-list-table td {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Side by side layout for search and blacklist */
.ffl-side-by-side {
    display: flex;
    gap: 20px;
    align-items: start;
}

.ffl-side-by-side > div {
    flex: 1;
}

.ffl-scrollable-section {
    max-height: 500px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 0 0 4px 4px;
}

.ffl-section-header {
    padding: 15px;
    border-bottom: 1px solid #ddd;
    background: #f8f9fa;
    border-radius: 4px 4px 0 0;
    margin: 0;
}

.ffl-scrollable-section::-webkit-scrollbar {
    width: 8px;
}

.ffl-scrollable-section::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.ffl-scrollable-section::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.ffl-scrollable-section::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Enhanced compact table styling */
.ffl-compact-table {
    font-size: 13px;
}

.ffl-compact-table th {
    font-size: 12px;
    font-weight: bold;
    padding: 8px 6px;
}

.ffl-compact-table td {
    padding: 8px 6px;
    vertical-align: top;
    line-height: 1.1;
    font-size: 12px;
}

/* Ultra-compact styling for FFL details */
.ffl-compact-table td * {
    margin: 0;
    padding: 0;
}

.ffl-compact-table td br {
    line-height: 0.3;
    font-size: 1px;
}

.ffl-compact-table .button-small {
    font-size: 11px;
    padding: 3px 8px;
    height: auto;
    line-height: 1.3;
}

.ffl-compact-table strong {
    font-weight: 600;
    color: #23282d;
    line-height: 1.2;
    margin: 0;
    display: block;
}

.ffl-compact-table small {
    font-size: 11px;
    color: #666;
    display: block;
    margin: 0;
    padding: 0;
    line-height: 1.1;
}

/* Reduce spacing around br tags in FFL details */
.ffl-compact-table td br {
    line-height: 0;
    margin: 0;
    padding: 0;
    font-size: 0;
    height: 2px;
}

.ffl-compact-table td strong + br {
    height: 1px;
}

.ffl-compact-table td small + br {
    height: 1px;
}

/* Make FFL details ultra-compact */
.panel-ffl-search-results .ffl-compact-table td,
.ffl-panel-blacklist-section .ffl-compact-table td {
    line-height: 1.0;
    font-size: 11px;
    padding: 4px 6px;
}

.panel-ffl-search-results .ffl-compact-table td strong,
.ffl-panel-blacklist-section .ffl-compact-table td strong {
    font-size: 12px;
    line-height: 1.0;
    margin-bottom: 1px;
}

.panel-ffl-search-results .ffl-compact-table td small,
.ffl-panel-blacklist-section .ffl-compact-table td small {
    font-size: 10px;
    line-height: 1.0;
    margin: 0;
}

/* Responsive adjustments */
@media screen and (max-width: 782px) {
    .ffl-blacklist-search-container table,
    .ffl-blacklist-search-container tbody,
    .ffl-blacklist-search-container th,
    .ffl-blacklist-search-container td,
    .ffl-blacklist-search-container tr {
        display: block;
    }
    
    .ffl-blacklist-search-container td {
        padding: 10px 0;
    }
    
    .ffl-search-results table {
        font-size: 14px;
    }
    
    .ffl-search-results th,
    .ffl-search-results td {
        padding: 8px 5px;
    }
    
    /* Panel responsive adjustments */
    #ffl-blacklist-panel {
        padding: 15px;
        margin-top: 15px;
    }
    
    .ffl-panel-search-section,
    .ffl-panel-blacklist-section {
        padding: 15px;
        margin-bottom: 15px;
    }
    
    /* Side by side becomes stacked on mobile */
    .ffl-side-by-side {
        flex-direction: column;
        gap: 15px;
    }
    
    .ffl-scrollable-section {
        max-height: 350px;
    }
    
    /* Compact table responsive */
    .ffl-compact-table {
        font-size: 11px;
    }
    
    .ffl-compact-table th,
    .ffl-compact-table td {
        padding: 4px 3px;
    }
    
    .ffl-compact-table td:first-child {
        width: 30px;
    }
    
    /* Search form responsive */
    #panel-ffl-search-container > div {
        flex-direction: column;
        gap: 15px;
    }
    
    #panel-ffl-search-container > div > div {
        min-width: 100%;
        flex: none;
    }
    
    .ffl-blacklist-summary {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

/* Compact FFL detail div structure */
.ffl-detail-name {
    line-height: 1.2;
    margin-bottom: 1px;
}

.ffl-detail-license,
.ffl-detail-location,
.ffl-detail-phone {
    line-height: 1.1;
    margin: 0;
}

.ffl-detail-license small,
.ffl-detail-location small,
.ffl-detail-phone small {
    line-height: 1.1;
    margin: 0;
    padding: 0;
}

/* FFL Already Blacklisted Button Styling */
.ffl-already-blacklisted {
    background: #f0f0f1 !important;
    color: #666 !important;
    border-color: #ddd !important;
    cursor: not-allowed !important;
    opacity: 0.7;
    position: relative;
}

.ffl-already-blacklisted:hover {
    background: #f0f0f1 !important;
    color: #666 !important;
    border-color: #ddd !important;
}

.ffl-already-blacklisted:before {
    content: "✓ ";
    font-weight: bold;
}

/* Fix search button alignment */
#panel-ffl-search-container .button {
    margin-top: 0;
    height: 30px;
    line-height: 28px;
    padding: 0 12px;
    box-sizing: border-box;
}

/* Override FFL selection styling - background only, no border */
.ffl-compact-table tr.selected,
.ffl-compact-table tr[style*="background"],
#panel-ffl-search-results tr.selected,
#panel-ffl-search-results tr[style*="background"],
#panel-blacklist-content tr.selected,
#panel-blacklist-content tr[style*="background"],
.ffl-search-results tr.selected,
.ffl-search-results tr[style*="background"] {
    border-left: 4px solid #28a745 !important;
}

/* Ensure cells within selected rows don't override the styling */
.ffl-compact-table tr.selected td,
.ffl-compact-table tr[style*="background"] td,
#panel-ffl-search-results tr.selected td,
#panel-ffl-search-results tr[style*="background"] td,
#panel-blacklist-content tr.selected td,
#panel-blacklist-content tr[style*="background"] td,
.ffl-search-results tr.selected td,
.ffl-search-results tr[style*="background"] td {
    border-color: #ddd !important;
}

/* WooCommerce Order Details Layout Improvements */
/* Move Item Shipment Requirements to full width below other sections */
.woocommerce-order-details .order-info {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.woocommerce-order-details .order-info > div {
    flex: 1;
    min-width: 300px;
}

/* Make Item Shipment Requirements section full width */
.woocommerce-order-details .order-info > div:has(h3:contains("Item Shipment Requirements")),
.woocommerce-order-details .order-info > div[class*="shipment"],
.woocommerce-order-details .order-info > div:last-child {
    flex: 1 1 100%;
    order: 999;
    margin-top: 20px;
}

/* Alternative selector if :has() doesn't work */
.woocommerce-order-details .wp-block-columns > .wp-block-column:last-child,
.woocommerce-order-details #order-details .column:last-child {
    width: 100% !important;
    flex: 1 1 100% !important;
    order: 999;
    margin-top: 20px;
    clear: both;
}

/* Ensure proper spacing for the shipment details content */
.woocommerce-order-details .shipment-requirements,
.woocommerce-order-details [class*="shipment"] .inside {
    padding: 20px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Item Shipment Requirements - Integrated into FFL Checkout Meta Box */
/* Now displayed within the FFL meta box for better organization */
.shipment-breakdown-box {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 15px !important;
    background: #f9f9f9 !important;
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
    box-sizing: border-box !important;
    clear: both !important;
}

/* Three-column layout optimized for meta box width */
.shipment-breakdown-box .three-column-layout {
    display: flex !important;
    gap: 15px !important;
    flex-wrap: nowrap !important;
    align-items: flex-start !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
}

.shipment-breakdown-box .three-column-layout > div {
    flex: 1 !important;
    min-width: 0 !important;
    max-width: calc(33.333% - 20px) !important;
    box-sizing: border-box !important;
    background: white !important;
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
    padding: 15px !important;
}

.shipment-breakdown-box .three-column-layout h4 {
    margin-top: 0 !important;
    margin-bottom: 15px !important;
    color: #23282d !important;
    font-size: 14px !important;
    font-weight: 600 !important;
}

/* Responsive behavior for smaller screens */
@media screen and (max-width: 1200px) {
    .shipment-breakdown-box .three-column-layout {
        gap: 15px !important;
    }
    
    .shipment-breakdown-box .three-column-layout > div {
        max-width: calc(33.333% - 10px) !important;
    }
}

@media screen and (max-width: 900px) {
    .shipment-breakdown-box .three-column-layout {
        flex-direction: column !important;
        gap: 15px !important;
    }
    
    .shipment-breakdown-box .three-column-layout > div {
        max-width: 100% !important;
        min-width: 100% !important;
    }
}

/* Ensure proper spacing for the shipment details content */