/**
 * Platform Shippo Shipping Frontend CSS
 */

/* Primary color */
:root {
    --pss-primary-color: #2c3e30;
    --pss-primary-color-light: #3c5240;
    --pss-primary-color-dark: #1c2e20;
}

/* Vendor Dashboard */
.pss-vendor-dashboard {
    margin: 20px 0;
}

.pss-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
    background: #f9f9f9;
    padding: 15px;
    border-radius: 4px;
}

.pss-filter-group {
    display: flex;
    flex-direction: column;
}

.pss-filter-group label {
    margin-bottom: 5px;
    font-weight: 500;
}

.pss-orders-table-container {
    overflow-x: auto;
}

.pss-orders-table {
    width: 100%;
    border-collapse: collapse;
}

.pss-orders-table th,
.pss-orders-table td {
    padding: 10px;
    border-bottom: 1px solid #eee;
    text-align: left;
}

.pss-orders-table th {
    background-color: #f9f9f9;
    font-weight: 600;
}

.pss-status {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 500;
}

.pss-status-processing {
    background-color: #f8dda7;
    color: #94660c;
}

.pss-status-pending {
    background-color: #f8dda7;
    color: #94660c;
}

.pss-status-pre_transit {
    background-color: #c6e1c6;
    color: #5b841b;
}

.pss-status-transit {
    background-color: #c8d7e1;
    color: #2e4453;
}

.pss-status-delivered {
    background-color: #c6e1c6;
    color: #5b841b;
}

.pss-status-returned {
    background-color: #eba3a3;
    color: #761919;
}

.pss-status-failure {
    background-color: #eba3a3;
    color: #761919;
}

.pss-button {
    margin: 0 5px 5px 0;
}

/* Modal */
.pss-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
}

.pss-modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 600px;
    border-radius: 4px;
}

.pss-modal-close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.pss-modal-body {
    margin-top: 20px;
}

.pss-modal-actions {
    margin-top: 20px;
    text-align: right;
}

/* Rate options */
.pss-rate-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border: 1px solid #ddd;
    margin-bottom: 10px;
    border-radius: 4px;
    cursor: pointer;
}

.pss-rate-option:hover {
    background-color: #f9f9f9;
}

.pss-rate-option.selected {
    border-color: var(--pss-primary-color);
    background-color: #f0f5f0;
}

.pss-rate-details {
    flex-grow: 1;
}

.pss-rate-provider {
    font-weight: 600;
}

.pss-rate-service {
    color: #666;
    font-size: 0.9em;
}

.pss-rate-delivery {
    font-size: 0.9em;
    color: var(--pss-primary-color);
}

.pss-rate-price {
    font-weight: 600;
    color: var(--pss-primary-color);
}

.pss-success-message {
    color: green;
    font-weight: 600;
}

.pss-error-message {
    color: red;
    font-weight: 600;
}

/* Tracking form */
.pss-tracking-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.pss-tracking-form {
    margin-bottom: 30px;
}

.pss-tracking-tabs {
    display: flex;
    border-bottom: 1px solid #ddd;
    margin-bottom: 20px;
}

.pss-tracking-tab {
    background: none;
    border: none;
    padding: 10px 15px;
    cursor: pointer;
    font-weight: 500;
    color: #666;
    border-bottom: 2px solid transparent;
    transition: all 0.3s;
}

.pss-tracking-tab.active {
    color: var(--pss-primary-color);
    border-bottom-color: var(--pss-primary-color);
}

.pss-tracking-tab-content {
    display: none;
}

.pss-tracking-tab-content.active {
    display: block;
}

.pss-form-group {
    margin-bottom: 15px;
}

.pss-form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.pss-input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.pss-form-actions {
    margin-top: 20px;
}

.pss-tracking-error {
    padding: 15px;
    background-color: #f8d7da;
    border-radius: 4px;
    margin-bottom: 20px;
}

.pss-tracking-results {
    margin-top: 30px;
}

.pss-tracking-header {
    margin-bottom: 20px;
}

.pss-tracking-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 10px;
}

.pss-label {
    font-weight: 600;
    margin-right: 5px;
}

.pss-tracking-status {
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
    margin-bottom: 30px;
}

.pss-status-indicator {
    display: flex;
    align-items: center;
}

.pss-status-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    margin-right: 15px;
}

.pss-status-text {
    display: flex;
    flex-direction: column;
}

.pss-status-label {
    font-size: 18px;
    font-weight: 600;
}

.pss-eta {
    font-size: 14px;
    color: #666;
    margin-top: 5px;
}

.pss-tracking-timeline {
    margin-top: 30px;
}

.pss-timeline {
    position: relative;
    padding-left: 30px;
}

.pss-timeline-item {
    position: relative;
    padding-bottom: 20px;
}

.pss-timeline-item:last-child {
    padding-bottom: 0;
}

.pss-timeline-item:before {
    content: '';
    position: absolute;
    left: -30px;
    top: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--pss-primary-color);
}

.pss-timeline-item:after {
    content: '';
    position: absolute;
    left: -24px;
    top: 12px;
    width: 1px;
    height: calc(100% - 12px);
    background: #ddd;
}

.pss-timeline-item:last-child:after {
    display: none;
}

.pss-timeline-date {
    font-size: 14px;
    color: #666;
    margin-bottom: 5px;
}

.pss-timeline-status {
    font-weight: 600;
    margin-bottom: 5px;
}

.pss-timeline-location {
    font-size: 14px;
    color: #666;
}

/* Status colors */
.pss-status-UNKNOWN .pss-status-icon,
.pss-status-unknown .pss-status-icon {
    background-color: #999;
}

.pss-status-PRE_TRANSIT .pss-status-icon,
.pss-status-pre_transit .pss-status-icon {
    background-color: #f8dda7;
}

.pss-status-TRANSIT .pss-status-icon,
.pss-status-transit .pss-status-icon {
    background-color: #c8d7e1;
}

.pss-status-DELIVERED .pss-status-icon,
.pss-status-delivered .pss-status-icon {
    background-color: #c6e1c6;
}

.pss-status-RETURNED .pss-status-icon,
.pss-status-returned .pss-status-icon,
.pss-status-FAILURE .pss-status-icon,
.pss-status-failure .pss-status-icon {
    background-color: #eba3a3;
}

/* Shipping Calculator */
.pss-calculator-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.pss-calculator-form {
    margin-bottom: 30px;
}

.pss-form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 15px;
}

.pss-form-group {
    flex: 1;
    min-width: 200px;
}

.pss-form-group label .required {
    color: red;
}

.pss-calculator-error {
    padding: 15px;
    background-color: #f8d7da;
    border-radius: 4px;
    margin-bottom: 20px;
}

.pss-calculator-results {
    margin-top: 30px;
}

.pss-shipping-rates {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.pss-rate-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    transition: all 0.3s;
}

.pss-rate-card:hover {
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* Product shipping cost */
.pss-shipping-estimate {
    margin: 15px 0;
    padding: 10px;
    background-color: #f9f9f9;
    border-radius: 4px;
}

.pss-shipping-cost {
    margin: 0;
}

.pss-delivery-estimate {
    font-size: 0.9em;
    color: #666;
}

/* Vendor address reminder */
.pss-address-reminder {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 10px 15px;
    background-color: #fff8e5;
    border-left: 4px solid #ffb900;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
    width: 100%;
    box-sizing: border-box;
    flex-wrap: wrap;
}

/* Button styling that works in both contexts */
.pss-address-reminder .dokan-btn,
.pss-address-reminder .button {
    margin-left: 15px;
    text-decoration: none;
}

/* Ensure text doesn't overflow on mobile */
@media screen and (max-width: 782px) {
    .pss-address-reminder {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .pss-address-reminder .dokan-btn,
    .pss-address-reminder .button {
        margin-left: 0;
        margin-top: 10px;
        align-self: flex-start;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .pss-tracking-meta,
    .pss-form-row {
        flex-direction: column;
        gap: 10px;
    }
    
    .pss-shipping-rates {
        grid-template-columns: 1fr;
    }
}

/* Debug information */
.pss-debug-btn {
    margin-top: 15px;
    background-color: #f0f0f0;
    color: #333;
    border: 1px solid #ccc;
    padding: 5px 10px;
    cursor: pointer;
}

.pss-debug-info {
    margin-top: 10px;
    padding: 15px;
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    max-height: 400px;
    overflow-y: auto;
}

.pss-debug-info pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: monospace;
    font-size: 12px;
    line-height: 1.4;
}

/* Error messages */
.pss-error {
    padding: 15px;
    background-color: #fff5f5;
    border: 1px solid #ffdddd;
    border-radius: 4px;
    margin-bottom: 20px;
}

.pss-error p {
    color: #d8000c;
    margin: 0 0 10px 0;
}

/* Loading message */
.loading {
    display: inline-block;
    position: relative;
    padding-left: 25px;
}

.loading:before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    width: 15px;
    height: 15px;
    margin-top: -8px;
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-top-color: #000;
    border-radius: 50%;
    animation: pss-spin 1s linear infinite;
}

@keyframes pss-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Shipping rates table */
.pss-rates-table-container {
    margin-bottom: 20px;
    overflow-x: auto;
}

.pss-rates-table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
}

.pss-rates-table th,
.pss-rates-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.pss-rates-table th {
    background-color: #f5f5f5;
    font-weight: bold;
}

.pss-rates-table tr:hover {
    background-color: #f9f9f9;
}

/* Label container */
.pss-label-container {
    display: flex;
    flex-wrap: wrap;
    margin-top: 20px;
}

.pss-label-image {
    flex: 0 0 60%;
    max-width: 60%;
    padding-right: 20px;
}

.pss-label-image img {
    max-width: 100%;
    height: auto;
}

.pss-label-details {
    flex: 0 0 40%;
    max-width: 40%;
}

@media (max-width: 768px) {
    .pss-label-image,
    .pss-label-details {
        flex: 0 0 100%;
        max-width: 100%;
        padding-right: 0;
    }
    
    .pss-label-details {
        margin-top: 20px;
    }
}

/* Customer selected shipping method */
.pss-customer-selected-notice {
    margin-bottom: 15px;
    padding: 10px;
    background-color: #f0f8ff;
    border: 1px solid #b8d4f5;
    border-radius: 4px;
}

.pss-customer-selected-notice p {
    margin: 0;
    color: #0073aa;
}

.pss-restriction-note {
    color: #d63638;
    font-weight: bold;
    margin-top: 5px;
}

tr.pss-customer-selected {
    background-color: #f0f8ff !important;
}

tr.pss-customer-selected td {
    border-left: 3px solid #0073aa;
}

/* Warning notice */
.pss-warning-notice {
    background-color: #fcf8e3;
    border: 1px solid #faebcc;
    color: #8a6d3b;
    padding: 10px;
    margin-bottom: 15px;
    border-radius: 3px;
}

/* Fix for form fields not being clickable */
.dokan-form-group input[type="number"],
.dokan-form-group input[type="text"],
.dokan-form-group input[type="email"],
.dokan-form-group input[type="password"],
.dokan-form-group select,
.dokan-form-group textarea {
    position: relative;
    z-index: 1;
}

/* Ensure proper stacking context for form groups */
.dokan-form-group {
    position: relative;
    z-index: auto;
}

/* Fix for dimension fields */
.content-half-part {
    position: relative;
    z-index: 1;
}

/* Ensure labels don't overlap input fields */
.dokan-form-group label {
    pointer-events: none;
}

/* Allow clicking on label text */
.dokan-form-group label span {
    pointer-events: auto;
}

/* Fix for overlapping elements */
.dokan-shipping-dimension input,
.dokan-form-control {
    position: relative;
    z-index: 2;
}

/* Specific fixes for Shippo form fields */
.shippo-form-field {
    position: relative;
    z-index: 5;
}

.shippo-input {
    position: relative;
    z-index: 10;
    pointer-events: auto !important;
}

/* Ensure inputs are clickable */
.shippo-input:focus {
    outline: 2px solid #2271b1;
}

/* Fix for any potential parent elements that might interfere */
.dokan-dashboard .dokan-product-edit-area .dokan-edit-left .dokan-shipping-dimension,
.dokan-dashboard .dokan-product-edit-area .dokan-edit-left .content-half-part {
    position: relative;
    z-index: 5;
}

/* Ensure labels don't interfere with inputs */
.shippo-form-field label {
    pointer-events: none;
}

/* But allow clicking on the required asterisk */
.shippo-form-field label .required {
    pointer-events: auto;
}

/* Additional fixes for all dimension fields */
input[name="product_height"],
input[name="product_length"],
input[name="product_width"],
input[name="product_weight"] {
    z-index: 100 !important;
    position: relative !important;
    pointer-events: auto !important;
    background-color: #fff !important;
}

/* Ensure all form fields are properly accessible */
.dokan-form-group input[type="number"] {
    cursor: text !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Fix for any overlapping elements */
.dokan-form-group.content-half-part {
    overflow: visible !important;
}

/* Fix for height field specifically */
input#product_height {
    z-index: 999 !important;
    position: relative !important;
}

/* Special styling for weight field to ensure visibility */
.shippo-weight-field {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    z-index: 9999 !important;
    margin-bottom: 20px !important;
    background-color: #fff !important;
    padding: 10px !important;
    border: 1px solid #ddd !important;
    clear: both !important;
}

/* Force weight field to be visible */
input#product_weight,
input[name="product_weight"] {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    z-index: 9999 !important;
    width: 100% !important;
    max-width: 100% !important;
    background-color: #fff !important;
    border: 1px solid #ddd !important;
    padding: 8px !important;
    margin-top: 5px !important;
}

/* Override any theme styling that might hide the weight field */
.dokan-dashboard .dokan-product-edit-area .dokan-edit-left .dokan-form-group input[name="product_weight"] {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
} 