/**
 * WooCommerce Frontend Dashboard Styles
 */

.wfd-dashboard-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    margin: 20px auto;
    padding: 20px;
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 5px;
    max-width: 1200px; /* Adjust as needed */
}

.wfd-dashboard-container h1 {
    font-size: 24px;
    margin-bottom: 20px;
    color: #333;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.wfd-dashboard-container h2 {
    font-size: 20px;
    margin-top: 30px;
    margin-bottom: 15px;
    color: #444;
}

.wfd-section {
    background-color: #fff;
    padding: 15px;
    border: 1px solid #e5e5e5;
    border-radius: 3px;
    margin-bottom: 20px;
}

.wfd-sales-stats ul {
    list-style: none;
    padding-left: 0;
}

.wfd-sales-stats li {
    padding: 8px 0;
    border-bottom: 1px dotted #eee;
}

.wfd-sales-stats li:last-child {
    border-bottom: none;
}

.wfd-sales-stats strong {
    display: inline-block;
    min-width: 150px; /* Adjust as needed */
}

/* Table Styles */
.wfd-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    font-size: 14px;
}

.wfd-table th,
.wfd-table td {
    text-align: left;
    padding: 10px 12px;
    border: 1px solid #ddd;
}

.wfd-table thead th {
    background-color: #f0f0f0;
    font-weight: bold;
    color: #555;
}

.wfd-table tbody tr:nth-child(even) {
    background-color: #f9f9f9;
}

.wfd-table tbody tr:hover {
    background-color: #f1f1f1;
}

.wfd-order-status {
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 0.9em;
    color: #fff;
    text-transform: capitalize;
    display: inline-block;
    min-width: 80px;
    text-align: center;
}

/* Specific Order Status Colors - Add more as needed */
.wfd-order-status-pending { background-color: #ffba00; /* Orange */ }
.wfd-order-status-processing { background-color: #2476be; /* Blue */ }
.wfd-order-status-on-hold { background-color: #ffba00; /* Orange */ }
.wfd-order-status-completed { background-color: #2ea240; /* Green */ }
.wfd-order-status-cancelled { background-color: #d63638; /* Red */ }
.wfd-order-status-refunded { background-color: #7f8c8d; /* Grey */ }
.wfd-order-status-failed { background-color: #d63638; /* Red */ }
.wfd-order-status-quote { background-color: #9b59b6; /* Purple for custom quote status */ }


.wfd-table .button,
.wfd-change-status-form .button {
    padding: 5px 10px;
    font-size: 0.9em;
    margin-right: 5px;
    cursor: pointer;
    text-decoration: none;
    border: 1px solid #ccc;
    background-color: #f7f7f7;
    color: #555;
    border-radius: 3px;
}
.wfd-change-status-form .button:hover {
    background-color: #eee;
    border-color: #999;
}

.wfd-change-status-form {
    display: flex;
    align-items: center;
}

.wfd-new-status-select {
    padding: 6px;
    font-size: 0.9em;
    margin-right: 5px;
    border-radius: 3px;
    border: 1px solid #ccc;
    max-width: 150px; /* Limit width of select */
}

/* Pagination */
.wfd-pagination {
    margin-top: 20px;
    text-align: center;
}
.wfd-pagination .page-numbers {
    display: inline-block;
    padding: 5px 10px;
    margin: 0 2px;
    border: 1px solid #ddd;
    text-decoration: none;
    color: #555;
    border-radius: 3px;
}
.wfd-pagination .page-numbers.current,
.wfd-pagination .page-numbers:hover {
    background-color: #0073aa; /* WordPress blue */
    color: #fff;
    border-color: #0073aa;
}

/* Responsive adjustments for table */
@media screen and (max-width: 768px) {
    .wfd-table thead {
        display: none; /* Hide table headers on small screens */
    }
    .wfd-table, .wfd-table tbody, .wfd-table tr, .wfd-table td {
        display: block;
        width: 100%;
    }
    .wfd-table tr {
        margin-bottom: 15px;
        border: 1px solid #ddd;
    }
    .wfd-table td {
        text-align: right; /* Align text to the right */
        padding-left: 50%; /* Create space for the data label */
        position: relative;
        border: none;
        border-bottom: 1px dotted #eee;
    }
    .wfd-table td::before {
        content: attr(data-label); /* Use data-label for pseudo-header */
        position: absolute;
        left: 10px;
        width: calc(50% - 20px); /* Adjust width */
        padding-right: 10px;
        font-weight: bold;
        text-align: left;
    }
    .wfd-change-status-form {
        flex-direction: column;
        align-items: flex-end; /* Align form items to the right */
    }
    .wfd-new-status-select,
    .wfd-change-status-form .button {
        width: 100%;
        margin-bottom: 5px;
        box-sizing: border-box; /* Ensure padding and border are included in width */
    }
    .wfd-change-status-form .button {
        margin-right: 0;
    }
}

/* Customer Details View & Edit Form */
.wfd-customer-details-table th {
    width: 25%; /* Adjust as needed */
    background-color: #f9f9f9;
}
.wfd-customer-details-table td {
    background-color: #fff;
}

.wfd-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}
.wfd-form input[type="text"],
.wfd-form input[type="email"],
.wfd-form input[type="tel"],
.wfd-form input[type="password"],
.wfd-form select,
.wfd-form textarea {
    width: 100%;
    padding: 8px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 3px;
    box-sizing: border-box; /* Include padding and border in the element's total width and height */
}
.wfd-form input[readonly] {
    background-color: #f0f0f0;
    cursor: not-allowed;
}

.wfd-form .button-primary {
    background-color: #0073aa; /* WordPress blue */
    border-color: #006799;
    color: #fff;
    padding: 8px 15px;
    font-size: 1em;
}
.wfd-form .button-primary:hover {
    background-color: #005a87;
}

.wfd-form-message .success {
    color: green;
    border: 1px solid green;
    padding: 10px;
    margin-top: 10px;
    background-color: #e6ffe6;
}
.wfd-form-message .error {
    color: red;
    border: 1px solid red;
    padding: 10px;
    margin-top: 10px;
    background-color: #ffe6e6;
}

.wfd-customer-search-form {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
}
.wfd-customer-search-form input[type="text"] {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 3px;
    margin-right: 5px;
    flex-grow: 1;
}
.wfd-customer-search-form .button {
     padding: 7px 12px; /* Slightly adjust padding to match input height better */
}


/* Customer Table specific styles if needed */
.wfd-customer-table .button {
    /* Styles for buttons within the customer table actions column */
}

/* Customer Details View specific styles */
.wfd-customer-details-view .wfd-section {
    margin-bottom: 25px;
}
.wfd-customer-details-view h1 {
    font-size: 22px;
}
.wfd-customer-details-view h2 {
    font-size: 18px;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
    margin-top: 0; /* Adjust if it's the first h2 in a section */
}
.wfd-customer-details-view p a {
    text-decoration: none;
}
.wfd-customer-details-view p a:hover {
    text-decoration: underline;
}

/* Edit Customer Form specific styles */
.wfd-customer-edit-form-view .wfd-section {
    margin-bottom: 25px;
}
.wfd-customer-edit-form-view h1 {
    font-size: 22px;
}
.wfd-customer-edit-form-view h2 {
    font-size: 18px;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
    margin-top: 0;
}

/* Tab Navigation */
.wfd-nav-tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 1px solid #ddd;
}
.wfd-nav-tab {
    padding: 10px 15px;
    cursor: pointer;
    border: 1px solid transparent;
    border-bottom: none;
    margin-right: 5px;
    text-decoration: none;
    color: #555;
    background-color: #f1f1f1;
    border-radius: 4px 4px 0 0;
    position: relative;
    bottom: -1px; /* Align with the border of the content */
}
.wfd-nav-tab:hover {
    background-color: #e9e9e9;
    color: #333;
}
.wfd-nav-tab.wfd-nav-tab-active {
    background-color: #fff;
    border-color: #ddd #ddd transparent #ddd; /* Create the tab effect */
    color: #333;
    font-weight: bold;
}

.wfd-tab-content .wfd-tab-pane {
    display: none; /* Hide all panes by default */
    padding: 20px;
    border: 1px solid #ddd;
    border-top: none; /* Tabs provide the top border */
    background-color: #fff;
}
.wfd-tab-content .wfd-tab-pane.wfd-active {
    display: block; /* Show active pane */
}

/* Ensure sections within tabs don't have double top margin if h2 is first */
.wfd-tab-pane .wfd-section:first-child > h2:first-child {
    margin-top: 0;
}

/* Order Management - Items Section */
.wfd-order-items-section .wc-product-search,
.wfd-order-management-view .wc-customer-search { /* Apply to customer search too */
    min-width: 300px; /* Ensure select2 has enough space */
    width: 100%; /* Make it full width within its container */
}

.wfd-order-items-table th.item-thumb,
.wfd-order-items-table td.thumb {
    width: 50px;
    text-align: center;
    vertical-align: middle;
}
.wfd-order-items-table td.thumb img {
    max-width: 40px;
    max-height: 40px;
    border: 1px solid #eee;
    display: block;
    margin: 0 auto;
}
.wfd-order-items-table th.item-name,
.wfd-order-items-table td.name {
    /* width: auto; */ /* Takes remaining space */
}
.wfd-order-items-table th.item-cost, .wfd-order-items-table td.item_cost,
.wfd-order-items-table th.item-qty, .wfd-order-items-table td.quantity,
.wfd-order-items-table th.item-total, .wfd-order-items-table td.line_total,
.wfd-order-items-table th.item-actions, .wfd-order-items-table td.actions {
    width: 12%; /* Adjust as needed */
    text-align: right;
    vertical-align: middle;
}
.wfd-order-items-table td.actions {
    text-align: center;
}
.wfd-order-items-table input[type="number"] {
    width: 70px !important; /* Override general form input width for these */
    padding: 5px !important;
    text-align: right;
    margin-bottom: 0; /* Remove margin from general form inputs */
}
.wfd-order-items-table td.name .wc-item-meta {
    font-size: 0.9em;
    color: #777;
    margin-top: 5px;
}
.wfd-order-items-table td.name .wc-item-meta ul,
.wfd-order-items-table td.name .wc-item-meta li {
    list-style: none;
    padding: 0;
    margin: 0 0 2px 0;
}
.wfd-order-items-table td.name .wc-item-meta strong {
    margin-right: 5px;
}


.wfd-order-items-table tr.deleted-item td {
    opacity: 0.5;
}
.wfd-order-items-table tr.deleted-item {
    /* text-decoration: line-through; */ /* Can be too much with opacity */
}


.wfd-order-totals {
    text-align: right;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 2px solid #e5e5e5;
}
.wfd-order-totals p {
    margin-bottom: 8px;
    font-size: 1.1em;
}
.wfd-order-totals strong {
    display: inline-block;
    min-width: 150px; /* Adjust as needed */
    text-align: left;
    margin-right: 10px;
    color: #555;
}
.wfd-order-totals .wfd-order-grandtotal {
    font-weight: bold;
    font-size: 1.2em;
}

.wfd-add-selected-items-button {
    margin-top: 10px;
    margin-bottom: 15px;
}


/* Responsive adjustments for order items table */
@media screen and (max-width: 768px) {
    .wfd-order-items-table th.item-thumb,
    .wfd-order-items-table td.thumb {
        /* display: none; */ /* Optionally hide thumb on very small screens */
    }
     .wfd-order-items-table th.item-cost, .wfd-order-items-table td.item_cost,
    .wfd-order-items-table th.item-qty, .wfd-order-items-table td.quantity,
    .wfd-order-items-table th.item-total, .wfd-order-items-table td.line_total {
        /* Adjust widths or stacking for small screens if needed */
         padding-left: 40% !important; /* Ensure data label has space */
    }
    .wfd-order-items-table td.item_cost::before,
    .wfd-order-items-table td.quantity::before,
    .wfd-order-items-table td.line_total::before {
        width: calc(40% - 20px) !important; /* Adjust for data label */
    }

    .wfd-order-items-table input[type="number"] {
        width: 100% !important; /* Make inputs full width in their cell */
        box-sizing: border-box;
    }
    .wfd-order-totals {
        text-align: left; /* Stack totals on small screens */
    }
    .wfd-order-totals strong {
        display: block; /* Stack label above value */
        margin-bottom: 3px;
    }
    .wfd-order-totals span {
        display: block;
        margin-bottom: 10px;
        padding-left: 10px;
    }
}