/* Frontend Styles for MarkShop Store Wallets */

/* Shortcode Styles */
.wallet-lookup-form {
    max-width: 500px;
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.wallet-lookup-input {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.wallet-lookup-input input[type="text"] {
    flex: 1;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.wallet-lookup-input input[type="text"]:focus {
    border-color: #0073aa;
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

.wallet-lookup-input button {
    padding: 12px 20px;
    background: #0073aa;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.wallet-lookup-input button:hover {
    background: #005a87;
}

.wallet-lookup-input button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Wallet Balance Display */
.wallet-balance-display {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
}

.wallet-code {
    font-family: 'Courier New', monospace;
    font-size: 18px;
    margin-bottom: 10px;
    color: #333;
}

.wallet-balance {
    margin-bottom: 15px;
}

.balance-amount {
    font-size: 24px;
    font-weight: bold;
}

.balance-amount.positive {
    color: #00a32a;
}

.balance-amount.negative {
    color: #d63638;
}

.wallet-limit {
    font-size: 14px;
    color: #666;
    margin-bottom: 20px;
}

/* Transaction History */
.wallet-transactions {
    margin-top: 20px;
}

.wallet-transactions h4 {
    margin-bottom: 15px;
    color: #333;
    border-bottom: 2px solid #0073aa;
    padding-bottom: 5px;
}

.wallet-transactions-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border-radius: 4px;
    overflow: hidden;
}

.wallet-transactions-table th {
    background: #f8f9fa;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #dee2e6;
}

.wallet-transactions-table td {
    padding: 12px;
    border-bottom: 1px solid #dee2e6;
}

.wallet-transactions-table tr:hover {
    background: #f8f9fa;
}

.wallet-transactions-table .positive {
    color: #00a32a;
    font-weight: 600;
}

.wallet-transactions-table .negative {
    color: #d63638;
    font-weight: 600;
}

/* My Wallets Display */
.my-wallets-display {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.my-wallets-display h3 {
    color: #333;
    margin-bottom: 20px;
    border-bottom: 2px solid #0073aa;
    padding-bottom: 10px;
}

.wallet-item {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: box-shadow 0.3s;
}

.wallet-item:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.wallet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.wallet-header .wallet-code {
    font-family: 'Courier New', monospace;
    font-size: 16px;
    font-weight: bold;
    color: #333;
}

.wallet-header .balance-amount {
    font-size: 20px;
    font-weight: bold;
}

.wallet-limit {
    font-size: 14px;
    color: #666;
    margin-bottom: 15px;
}

.wallet-recent-transactions h5 {
    margin: 15px 0 10px 0;
    color: #333;
}

.transaction-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.transaction-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
    font-size: 14px;
}

.transaction-item:last-child {
    border-bottom: none;
}

.transaction-date {
    color: #666;
    font-size: 12px;
}

.transaction-amount {
    font-weight: 600;
}

.transaction-amount.positive {
    color: #00a32a;
}

.transaction-amount.negative {
    color: #d63638;
}

.transaction-description {
    flex: 1;
    margin-left: 10px;
    color: #666;
    font-size: 12px;
}

.no-transactions {
    color: #666;
    font-style: italic;
    text-align: center;
    padding: 20px;
}

/* Installment Filter Controls - matching modal styling */
.installments-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.installments-status-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.installments-status-filters .filters-label {
    font-weight: 600;
    margin-right: 6px;
}

.installment-status-filter {
    border: 1px solid #0073aa;
    background: #f0f8ff;
    color: #005177;
    padding: 6px 12px;
    border-radius: 16px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.15s;
}

.installment-status-filter:hover {
    background: #e0f0ff;
}

.installment-status-filter:focus {
    outline: 2px solid #005177;
    outline-offset: 2px;
}

.installment-status-filter.is-inactive {
    opacity: 0.5;
    background: #fafafa;
    color: #666;
    border-color: #ccc;
}

.installment-status-filter.status-filter-reset {
    border-color: #444;
    background: #fff;
    color: #222;
}

.toggle-paid-installments {
    border: 1px solid #0073aa;
    background: #fff;
    color: #0073aa;
    padding: 6px 16px;
    border-radius: 16px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.15s;
}

.toggle-paid-installments:hover {
    background: #f0f8ff;
}

.toggle-paid-installments:focus {
    outline: 2px solid #005177;
    outline-offset: 2px;
}

.toggle-paid-installments.active {
    background: #0073aa;
    color: white;
}

.toggle-paid-installments.is-loading {
    opacity: 0.7;
    cursor: wait;
}

.toggle-paid-installments .btn-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid #cde2f7;
    border-top-color: #0073aa;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
    animation: installments-spin 0.8s linear infinite;
}

@keyframes installments-spin {
    to { transform: rotate(360deg); }
}

.installments-list-area {
    min-height: 100px;
}

.no-installments {
    color: #666;
    font-style: italic;
    text-align: center;
    padding: 20px;
}

/* Installment card actions */
.installment-actions {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #eee;
}

.view-products-btn {
    border: 1px solid #0073aa;
    background: #fff;
    color: #0073aa;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.15s;
}

.view-products-btn:hover {
    background: #f0f8ff;
}

/* Installment products display */
.installment-products {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #eee;
}

.products-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.product-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    background: #f9f9f9;
    border-radius: 4px;
}

.product-thumbnail {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}

.product-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.product-name {
    font-weight: 500;
    font-size: 13px;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.product-qty {
    font-size: 12px;
    color: #666;
}

.product-total {
    font-size: 12px;
    color: #0073aa;
    font-weight: 500;
}

.products-loading,
.products-error {
    font-size: 13px;
    color: #666;
    padding: 10px 0;
}

.products-error {
    color: #c62828;
}

.no-products {
    font-size: 13px;
    color: #666;
    font-style: italic;
}

/* Responsive styles for filters */
@media (max-width: 768px) {
    .installments-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .installments-status-filters {
        justify-content: flex-start;
    }
    
    .installment-status-filter {
        padding: 5px 10px;
        font-size: 12px;
    }
    
    .toggle-paid-installments {
        width: 100%;
        text-align: center;
    }
}

/* Error and Info Messages */
.wallet-error {
    background: #ffebee;
    border-left: 4px solid #d63638;
    color: #c62828;
    padding: 12px 16px;
    border-radius: 4px;
    margin: 15px 0;
}

.wallet-info {
    background: #e3f2fd;
    border-left: 4px solid #1976d2;
    color: #0d47a1;
    padding: 12px 16px;
    border-radius: 4px;
    margin: 15px 0;
}

.wallet-success {
    background: #e8f5e8;
    border-left: 4px solid #4caf50;
    color: #1b5e20;
    padding: 12px 16px;
    border-radius: 4px;
    margin: 15px 0;
}

/* Loading States */
.wallet-loading {
    text-align: center;
    padding: 20px;
    color: #666;
}

.wallet-loading::after {
    content: "";
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-left: 10px;
    border: 2px solid #ddd;
    border-top-color: #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* WooCommerce Account Integration */
.woocommerce-account .wallet-item {
    margin-bottom: 30px;
}

.woocommerce-account .wallet-header {
    background: #f8f9fa;
    margin: -20px -20px 20px -20px;
    padding: 20px;
    border-radius: 8px 8px 0 0;
}

/* Checkout Form Styles */
.wc-payment-form fieldset {
    border: none;
    margin: 0;
    padding: 0;
}

.wc-payment-form .form-row {
    margin-bottom: 15px;
}

.wc-payment-form label {
    font-weight: 600;
    margin-bottom: 5px;
    display: block;
}

.wc-payment-form select,
.wc-payment-form input[type="text"] {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.wc-payment-form select:focus,
.wc-payment-form input[type="text"]:focus {
    border-color: #0073aa;
    outline: none;
}

#wallet_balance_info {
    background: #f0f8ff;
    border: 1px solid #b3d9ff;
    border-radius: 4px;
    padding: 15px;
    margin-top: 10px;
}

.wallet-balance-sufficient {
    color: #00a32a;
    font-weight: 600;
}

.wallet-balance-insufficient {
    color: #d63638;
    font-weight: 600;
}

/* Responsive Design */
@media (max-width: 768px) {
    .wallet-lookup-input {
        flex-direction: column;
    }
    
    .wallet-lookup-input input[type="text"],
    .wallet-lookup-input button {
        width: 100%;
        margin-bottom: 10px;
    }
    
    .wallet-header {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .wallet-transactions-table {
        font-size: 14px;
    }
    
    .wallet-transactions-table th,
    .wallet-transactions-table td {
        padding: 8px;
    }
    
    .transaction-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .transaction-description {
        margin-left: 0;
    }
}

@media (max-width: 480px) {
    .wallet-transactions-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
    
    .balance-amount {
        font-size: 18px !important;
    }
    
    .wallet-code {
        font-size: 14px !important;
        word-break: break-all;
    }
}
