/**
 * AIM-POS Customer Connection Frontend Styles
 */

/* Account Linking Form */
.aimpos-link-form {
    max-width: 600px;
    margin: 20px 0;
}

.aimpos-link-form .form-row {
    margin-bottom: 20px;
}

.aimpos-link-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.aimpos-link-form input[type="text"],
.aimpos-link-form input[type="email"],
.aimpos-link-form input[type="tel"],
.aimpos-link-form select,
.aimpos-link-form textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.aimpos-link-form .form-row-wide {
    width: 100%;
}

.aimpos-link-form .form-row-first,
.aimpos-link-form .form-row-last {
    width: 48%;
    float: left;
}

.aimpos-link-form .form-row-last {
    float: right;
}

.aimpos-link-form .form-row::after {
    content: "";
    display: table;
    clear: both;
}

.aimpos-link-form .button {
    background-color: #0073aa;
    color: #fff;
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    margin-right: 10px;
}

.aimpos-link-form .button:hover {
    background-color: #005a87;
}

.aimpos-link-form .button-secondary {
    background-color: #666;
}

.aimpos-link-form .button-secondary:hover {
    background-color: #555;
}

/* Lookup Results */
.aimpos-lookup-results {
    margin-top: 20px;
    padding: 15px;
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.aimpos-lookup-results h3 {
    margin-top: 0;
}

.aimpos-lookup-result-item {
    padding: 15px;
    margin-bottom: 10px;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.aimpos-lookup-result-item:last-child {
    margin-bottom: 0;
}

.aimpos-lookup-result-item strong {
    display: block;
    margin-bottom: 5px;
}

/* Messages */
.aimpos-message {
    padding: 12px 15px;
    margin: 20px 0;
    border-radius: 4px;
}

.aimpos-message.success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.aimpos-message.error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.aimpos-message.info {
    background-color: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

/* Loading State */
.aimpos-loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
    vertical-align: middle;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Member Pricing - Display in Price HTML */
.aimpos-member-price-wrapper {
    display: inline-block;
}

.aimpos-member-price-wrapper del {
    opacity: 0.5;
    display: inline;
    margin-right: 0.5em;
}

.aimpos-member-price-wrapper del .woocommerce-Price-amount {
    text-decoration: line-through;
    color: #666;
    font-size: 0.9em;
}

.aimpos-member-price-wrapper ins {
    text-decoration: none;
    display: inline;
    font-weight: 700;
    color: #ff6600; /* Orange color similar to sale prices */
}

.aimpos-member-price-wrapper ins .woocommerce-Price-amount {
    color: #ff6600;
    font-weight: 700;
}

.aimpos-member-price-label {
    display: inline-block;
    margin-left: 0.5em;
    font-size: 0.85em;
    color: #666;
    font-weight: 600;
}

/* Legacy Member Pricing Display (kept for backward compatibility) */
.aimpos-member-pricing {
    margin: 20px 0;
    padding: 15px;
    background-color: #f0f8ff;
    border: 1px solid #b3d9ff;
    border-radius: 4px;
}

.aimpos-member-pricing p {
    margin: 5px 0;
}

.aimpos-member-pricing .aimpos-member-price-label {
    font-weight: 600;
    color: #0073aa;
}

.aimpos-member-pricing .aimpos-member-price {
    font-size: 24px;
    font-weight: 700;
    color: #0073aa;
}

.aimpos-regular-price {
    font-size: 14px;
    color: #666;
}

.aimpos-regular-price .aimpos-price-amount {
    text-decoration: line-through;
}

.aimpos-member-pricing-loop {
    font-size: 14px;
    margin-top: 5px;
}

.aimpos-member-pricing-loop .aimpos-member-price-label {
    font-weight: 600;
    color: #0073aa;
    margin-right: 5px;
}

.aimpos-member-pricing-loop .aimpos-member-price {
    font-weight: 700;
    color: #0073aa;
}

/* Store Invoice History */
.aimpos-history-filters {
    margin: 20px 0;
    padding: 15px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.aimpos-history-filter-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    align-items: end;
}

.aimpos-history-filter-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.aimpos-history-filter-form input[type="date"],
.aimpos-history-filter-form input[type="text"],
.aimpos-history-filter-form select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.aimpos-history-filter-form .button {
    width: 100%;
    padding: 10px;
}

.aimpos-history-section .aimpos-sortable-table thead th.aimpos-sortable,
.aimpos-history-section table thead th.aimpos-sortable {
    cursor: pointer;
    user-select: none;
    color: #333 !important;
    background-color: #f5f5f5 !important;
}

.aimpos-history-section .aimpos-sortable-table thead th.aimpos-sortable:hover,
.aimpos-history-section table thead th.aimpos-sortable:hover {
    background-color: #e9e9e9 !important;
}

.aimpos-history-section .aimpos-sortable-table thead th.aimpos-sortable a,
.aimpos-history-section table thead th.aimpos-sortable a {
    text-decoration: none;
    color: #333 !important;
    display: block;
    width: 100%;
}

.aimpos-history-section .aimpos-sortable-table thead th,
.aimpos-history-section table thead th {
    color: #333 !important;
    background-color: #f5f5f5 !important;
    font-weight: 600;
    padding: 12px;
    border: 1px solid #ddd;
}

.aimpos-history-pagination {
    margin: 20px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.aimpos-pagination-info {
    color: #666;
}

.aimpos-pagination-links {
    display: flex;
    gap: 10px;
    align-items: center;
}

.aimpos-pagination-links .button {
    padding: 8px 12px;
    text-decoration: none;
}

.aimpos-pagination-links .button:hover {
    background: #0073aa;
    color: #fff;
}

.aimpos-pagination-disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.aimpos-pagination-current {
    background: #0073aa;
    color: #fff;
    cursor: default;
}

.aimpos-pagination-numbers {
    display: flex;
    gap: 5px;
    align-items: center;
}

.aimpos-pagination-ellipsis {
    padding: 8px 5px;
}
.aimpos-history-section {
    margin: 20px 0;
}

.aimpos-history-section h3 {
    margin-bottom: 15px;
}

/* Invoice Detail */
.aimpos-invoice-detail-section {
    margin: 20px 0;
}

.aimpos-invoice-detail-section h3 {
    margin-bottom: 15px;
}

/* Ensure table headers are visible */
.aimpos-invoice-detail-section table thead th,
.aimpos-invoice-detail-section table thead tr th,
.aimpos-invoice-detail-section .woocommerce-orders-table thead th,
.aimpos-invoice-detail-section .woocommerce-orders-table thead tr th,
.aimpos-invoice-detail-section .shop_table thead th,
.aimpos-invoice-detail-section .shop_table thead tr th {
    color: #333 !important;
    background-color: #f5f5f5 !important;
    background: #f5f5f5 !important;
    font-weight: 600 !important;
    padding: 12px !important;
    text-align: left !important;
    border: 1px solid #ddd !important;
    border-bottom: 2px solid #ccc !important;
}

.aimpos-invoice-detail-section table thead th *,
.aimpos-invoice-detail-section .woocommerce-orders-table thead th * {
    color: #333 !important;
}

.aimpos-invoice-detail-section table tbody td {
    padding: 12px;
    border-bottom: 1px solid #ddd;
}

.aimpos-late-indicator {
    color: #dc3232;
    font-weight: bold;
}

/* Legacy - kept for backward compatibility */
.aimpos-invoices-section {
    margin: 20px 0;
}

.aimpos-invoices-section h3 {
    margin-bottom: 15px;
}

.aimpos-invoice-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.aimpos-invoice-item {
    padding: 15px;
    margin-bottom: 10px;
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.aimpos-invoice-item:last-child {
    margin-bottom: 0;
}

.aimpos-invoice-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.aimpos-invoice-number {
    font-weight: 600;
    font-size: 16px;
}

.aimpos-invoice-date {
    color: #666;
    font-size: 14px;
}

.aimpos-invoice-amount {
    font-size: 18px;
    font-weight: 700;
    color: #0073aa;
}

.aimpos-invoice-status {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 600;
}

.aimpos-invoice-status.paid {
    background-color: #d4edda;
    color: #155724;
}

.aimpos-invoice-status.pending {
    background-color: #fff3cd;
    color: #856404;
}

.aimpos-invoice-status.overdue {
    background-color: #f8d7da;
    color: #721c24;
}

/* Payment Methods */
.aimpos-payment-methods-section {
    margin: 20px 0;
}

.aimpos-payment-methods-section h3 {
    margin-bottom: 15px;
}

.aimpos-current-card {
    padding: 15px;
    margin-bottom: 20px;
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.aimpos-card-info {
    margin-bottom: 10px;
}

.aimpos-card-info strong {
    display: block;
    margin-bottom: 5px;
}

.aimpos-update-card-form {
    max-width: 500px;
    margin-top: 20px;
}

.aimpos-update-card-form .form-row {
    margin-bottom: 15px;
}

.aimpos-update-card-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.aimpos-update-card-form input[type="text"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.aimpos-update-card-form .form-row-half {
    width: 48%;
    float: left;
}

.aimpos-update-card-form .form-row-half:last-child {
    float: right;
}

.aimpos-update-card-form .form-row::after {
    content: "";
    display: table;
    clear: both;
}

/* Already Linked */
.aimpos-already-linked {
    padding: 20px;
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 4px;
    color: #155724;
}

.aimpos-already-linked h3 {
    margin-top: 0;
    color: #155724;
}

.aimpos-account-number {
    font-size: 18px;
    font-weight: 700;
    margin: 10px 0;
}

/* Responsive */
@media (max-width: 768px) {
    .aimpos-link-form .form-row-first,
    .aimpos-link-form .form-row-last {
        width: 100%;
        float: none;
    }

    .aimpos-update-card-form .form-row-half {
        width: 100%;
        float: none;
    }
}

