/* plugin/assets/css/orders.css */

/* Orders Admin CSS with Enhanced Responsiveness */

/* Main Container */
#ffc-orders-app {
    margin: 20px;
    position: relative;
    max-width: 100%;
    box-sizing: border-box;
}

/* Loading State */
.ffc-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 30px 0;
}

.ffc-loading p {
    margin-top: 10px;
    color: #666;
}

/* Filters Section */
.ffc-filters-container {
    background: #fff;
    border: 1px solid #e2e4e7;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 3px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 10px;
}

.ffc-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    flex: 1;
    margin-bottom: 5px;
    width: 100%;
}

.ffc-filter-item {
    display: flex;
    flex-direction: column;
    min-width: 150px;
    flex: 1;
}

.ffc-filter-item label {
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
}

.ffc-filter-item input,
.ffc-filter-item select {
    height: 30px;
    border-radius: 3px;
    width: 100%;
    border: 1px solid #ccc;
    color: #333;
}

/* Bulk Actions */
.ffc-bulk-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    background: #f9f9f9;
    padding: 8px 10px;
    border-radius: 3px;
    flex-wrap: wrap;
    width: 100%;
}

.ffc-bulk-actions span {
    color: #333;
}

/* Table Styling */
.ffc-table-container {
    margin-top: 20px;
    overflow-x: auto;
    width: 100%;
    max-width: calc(100vw - 40px); /* Account for app margins */
}

/* Make sure parent containers don't hide overflow */
#ffc-orders-app,
main,
.content {
    overflow-x: visible !important;
}

.ffc-orders-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 650px;
}

.ffc-orders-table th {
    text-align: left;
    padding: 12px 10px;
    position: relative;
    cursor: pointer;
    white-space: nowrap;
    background-color: #f8f9fa;
    color: #333;
}

.ffc-orders-table th.sorted-asc::after {
    content: "▲";
    display: inline-block;
    margin-left: 5px;
    font-size: 12px;
    color: #555;
}

.ffc-orders-table th.sorted-desc::after {
    content: "▼";
    display: inline-block;
    margin-left: 5px;
    font-size: 12px;
    color: #555;
}

.ffc-orders-table td {
    padding: 12px 10px;
    vertical-align: middle;
    border-bottom: 1px solid #e5e5e5;
    color: #333;
}

.ffc-order-row {
    background-color: #fff;
}

.ffc-order-row:hover {
    background-color: #f5f5f5;
}

.ffc-order-row.expanded {
    background-color: #f5f5f5;
    border-bottom: none;
}

.ffc-actions-cell {
    width: 150px;
    white-space: nowrap;
}

.ffc-row-actions {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.ffc-expand-btn {
    background: none;
    border: none;
    color: #0073aa;
    cursor: pointer;
    margin-left: 5px;
}

/* Refunds */
.ffc-actions-cell button[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.ffc-original-price {
    color: #999;
    font-size: 0.9em;
    text-decoration: line-through;
    margin-left: 5px;
}

/* Visual indicator for partially refunded orders */
.ffc-order-row.has-partial-refund {
    background-color: #fffbf0;
}

/* Add a mixed status badge for partially refunded orders */
.ffc-status-badge.ffc-status-partial {
    background-color: #ff9800;
    color: white;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 11px;
    text-transform: uppercase;
}

td:has(> button.item-refund-btn) {
  position: relative;
}

.item-refund-btn {
    position: absolute;
    right: 3px;
    top: 50%;
    transform: translateY(-50%);
}

/* Order Details Row */
.ffc-order-details-row {
    background-color: #f9f9f9;
    border-left: 3px solid #0073aa;
}

.ffc-order-items {
    padding: 10px 15px 15px;
    overflow-x: auto;
}

.ffc-items-table {
    width: 100%;
    margin-bottom: 15px;
    border-collapse: collapse;
    min-width: 500px;
}

.ffc-items-table th,
.ffc-items-table td {
    padding: 8px 10px;
    border: 1px solid #e5e5e5;
    text-align: left;
    color: #333;
}

.ffc-items-table th {
    background-color: #f3f3f3;
    white-space: nowrap;
}

.ffc-items-table tfoot {
    font-weight: bold;
}

.ffc-total-label {
    text-align: right;
}

td.ffc-total-price {
    position: relative;
}

td.ffc-total-price > button {
    position: absolute;
    right: .5rem;
    bottom: .3rem;
}

.ffc-total-price > span {
    display: inline-block;
    margin-right: 1rem ;
}

.ffc-user-data {
    background-color: #fff;
    padding: 10px 15px;
    border-radius: 3px;
    border: 1px solid #eee;
    margin-top: 10px;
}

.ffc-user-data h4 {
    margin: 0 0 10px;
    color: #333;
}

.ffc-user-data-item {
    margin-bottom: 5px;
    word-break: break-word;
    color: #333;
}

/* Status Badge */
.ffc-status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    color: #fff;
}

.ffc-status-pending {
    background-color: #ffc107;
    color: #333;
}

.ffc-status-completed,
.ffc-status-paid {
    background-color: #28a745;
    color: #fff;
}

.ffc-status-cancelled {
    background-color: #dc3545;
    color: #fff;
}

.ffc-status-refunded {
    background-color: #6c757d;
    color: #fff;
}

.ffc-status-partial {
    background-color: #fd7e14;
    color: white;
}

/* Pagination */
.ffc-pagination {
    margin-top: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    flex-wrap: wrap;
    gap: 10px;
}

.ffc-pagination-info {
    color: white;
}

.ffc-pagination-controls {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

.ffc-pagination-pages {
    margin: 0 10px;
    white-space: nowrap;
}

/* No Orders Message */
.ffc-no-orders {
    background-color: #fff;
    padding: 30px;
    text-align: center;
    border-radius: 3px;
    border: 1px solid #e2e4e7;
}

.ffc-no-orders p {
    color: #666;
    font-size: 16px;
}

/* Modal Styling */
.ffc-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100000;
    padding: 15px;
}

.ffc-modal-content {
    background-color: #fff;
    border-radius: 4px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.ffc-small-modal {
    max-width: 500px;
}

.ffc-modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid #e5e5e5;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ffc-modal-header h2 {
    margin: 0;
    font-size: 18px;
    color: #333;
}

.ffc-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
}

.ffc-modal-body {
    padding: 20px;
    color: #333;
}

.ffc-modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #e5e5e5;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.ffc-order-summary {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
    background-color: #f9f9f9;
    padding: 15px;
    border-radius: 3px;
}

.ffc-summary-item {
    line-height: 1.5;
    word-break: break-word;
    color: #333;
}

.ffc-status-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.ffc-status-form label {
    font-weight: 500;
    color: #333;
}

[v-cloak] {
    display: none !important;
}

.ffc-discount-inline {
  display: block;
  font-size: 0.85em;
  font-style: italic;
  color: #0066cc;
}

/* Base item styling */
.ffc-base-item {
    font-weight: bold;
    background-color: #f8f9fa;
}

.ffc-base-item .ffc-item-name {
    color: #333;
    font-weight: bold;
}

/* Addon item styling */
.ffc-addon-item {
    font-size: 0.95em;
    background-color: #fdfdfd;
}

.ffc-addon-item .ffc-addon-name {
    color: #555;
    padding-left: 10px;
}

/* Discount item styling */
.ffc-discount-item {
    font-size: 0.85em;
    font-style: italic;
    color: #0066cc;
    background-color: #f0f8ff;
}

.ffc-discount-item .ffc-discount-name {
    padding-left: 20px;
}

.ffc-discount-amount {
    color: #0066cc;
    font-style: italic;
}

/* Item separator */
.ffc-item-separator {
    border: none !important;
}

.ffc-item-separator td {
    border: none !important;
    padding: 5px 0 !important;
}

/* Line total column */
.ffc-line-total {
    position: relative;
}

.ffc-line-total .item-refund-btn {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 10px;
}

/* Ensure proper spacing for refund buttons */
.ffc-base-item .ffc-line-total {
    padding-right: 80px;
}

/* Print-specific styles */
@media print {
    .base-item {
        font-weight: bold;
        background-color: #f8f9fa !important;
    }
    
    .addon-item {
        font-size: 0.95em;
        padding-left: 15px;
    }
    
    .discount-item {
        font-size: 0.85em;
        font-style: italic;
        color: #0066cc !important;
        padding-left: 20px;
    }
}

/* Responsive Media Queries */
@media screen and (max-width: 1200px) {
    .ffc-filter-item {
        min-width: 120px;
    }
}

@media screen and (max-width: 782px) {
    #ffc-orders-app {
        margin: 10px;
    }
    
    .ffc-filters {
        flex-direction: column;
        gap: 10px;
    }
    
    .ffc-filter-item {
        width: 100%;
        min-width: 100%;
    }
    
    .ffc-pagination {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .ffc-pagination-controls {
        margin-top: 10px;
        width: 100%;
        justify-content: space-between;
    }
    
    .ffc-bulk-actions {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .ffc-bulk-actions select,
    .ffc-bulk-actions button {
        width: 100%;
        margin-top: 5px;
    }
    
    .ffc-row-actions {
        flex-direction: column;
        gap: 5px;
    }
    
    .ffc-row-actions button {
        width: 100%;
    }
    
    .ffc-order-summary {
        grid-template-columns: 1fr;
    }
    .ffc-line-total .item-refund-btn {
        position: static;
        transform: none;
        margin-top: 5px;
        display: block;
        width: 100%;
    }
    
    .ffc-base-item .ffc-line-total {
        padding-right: 10px;
    }
}

@media screen and (max-width: 600px) {
    .ffc-modal-content {
        max-height: 100vh;
        border-radius: 0;
    }
    
    .ffc-modal {
        padding: 0;
    }
    
    .ffc-modal-body {
        padding: 15px;
    }
    
    .ffc-modal-header,
    .ffc-modal-footer {
        padding: 10px 15px;
    }
}

/* Toggle Switch Styles */
.ffc-toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.ffc-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.ffc-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #dc3545;
    transition: 0.3s;
    border-radius: 24px;
}

.ffc-toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.ffc-toggle-switch input:checked + .ffc-toggle-slider {
    background-color: #28a745;
}

.ffc-toggle-switch input:checked + .ffc-toggle-slider:before {
    transform: translateX(26px);
}

/* Toggle Message Styles */
.ffc-toggle-message {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ffc-toggle-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.ffc-toggle-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}