/**
 * USBC WooPay Frontend Styles
 *
 * @package USBC_WooPay
 * @since 1.0.0
 */

/* ==========================================================================
   Token Management Page
   ========================================================================== */

.usbc-token-management {
    max-width: 1200px;
    margin: 0 auto;
}

/* Token Header */
.usbc-token-header {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.usbc-token-header h2 {
    margin-top: 0;
    margin-bottom: 15px;
}

.usbc-token-info-box {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

.usbc-info-item {
    display: flex;
    flex-direction: column;
}

.usbc-info-item .label {
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
}

.usbc-info-item .value {
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

.usbc-info-item .value.positive {
    color: #28a745;
}

.usbc-info-item .value.negative {
    color: #dc3545;
}

/* Purchase Section */
.usbc-purchase-section,
.usbc-balance-section,
.usbc-history-section,
.usbc-info-section {
    background: #fff;
    padding: 25px;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-bottom: 30px;
}

.usbc-purchase-section h3,
.usbc-balance-section h3,
.usbc-history-section h3,
.usbc-info-section h3 {
    margin-top: 0;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #0073aa;
}

/* Form Styles */
.usbc-form-row {
    margin-bottom: 20px;
}

.usbc-form-row label {
    display: block;
    font-weight: bold;
    margin-bottom: 8px;
}

.usbc-form-row .required {
    color: #dc3545;
}

.usbc-form-row input[type="text"],
.usbc-form-row input[type="number"] {
    width: 100%;
    max-width: 500px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.usbc-form-row input.error {
    border-color: #dc3545;
}

.usbc-form-row .description {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 13px;
}

/* Price Display */
.usbc-price-display {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-top: 20px;
}

.usbc-price-breakdown {
    margin-bottom: 20px;
}

.price-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #ddd;
}

.price-row.gas-fee {
    background: #fff3cd;
    padding: 12px 10px;
    margin: 5px -10px;
    border-radius: 4px;
    border-bottom: 1px solid #ffc107;
}

.price-row.gas-fee .label {
    color: #856404;
    font-weight: 500;
}

.price-row.gas-fee .label::before {
    content: "⚡ ";
    margin-right: 5px;
}

.price-row.gas-fee .value {
    color: #856404;
    font-weight: 600;
}

.price-row.total {
    font-size: 18px;
    font-weight: bold;
    border-bottom: none;
    border-top: 2px solid #333;
    margin-top: 10px;
    padding-top: 15px;
}

.price-updated {
    text-align: right;
    color: #666;
    font-size: 12px;
    margin-top: 10px;
}

/* Form Actions */
.usbc-form-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.usbc-form-actions .button {
    padding: 10px 20px;
}

/* Loading Spinner */
.usbc-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 4px;
    margin-top: 15px;
}

.usbc-loading .spinner {
    float: none;
    margin: 0;
}

/* Messages */
.usbc-messages {
    margin-top: 15px;
}

.usbc-messages .woocommerce-error,
.usbc-messages .woocommerce-message {
    padding: 12px;
    margin-bottom: 10px;
}

/* Balance Section */
.usbc-balance-form {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.usbc-balance-form input {
    flex: 1;
    max-width: 500px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.usbc-balance-display {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
}

.balance-amount {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.balance-amount .label {
    font-size: 16px;
    color: #666;
}

.balance-amount .value {
    font-size: 24px;
    font-weight: bold;
    color: #0073aa;
}

/* History Table */
.usbc-history-table {
    width: 100%;
    border-collapse: collapse;
}

.usbc-history-table th,
.usbc-history-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.usbc-history-table th {
    background: #f8f9fa;
    font-weight: bold;
}

.usbc-history-table tbody tr:hover {
    background: #f8f9fa;
}

.usbc-no-orders {
    text-align: center;
    padding: 40px;
    color: #666;
}

/* Status Badges */
.usbc-status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
}

.usbc-status.status-completed {
    background: #d4edda;
    color: #155724;
}

.usbc-status.status-processing,
.usbc-status.status-pending {
    background: #fff3cd;
    color: #856404;
}

.usbc-status.status-failed,
.usbc-status.status-refunded,
.usbc-status.status-cancelled {
    background: #f8d7da;
    color: #721c24;
}

/* Transaction Links */
.usbc-tx-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #0073aa;
    text-decoration: none;
}

.usbc-tx-link:hover {
    text-decoration: underline;
}

.usbc-tx-link .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

.usbc-pending {
    color: #856404;
    font-style: italic;
}

/* Token Details */
.usbc-token-details {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.detail-row {
    display: flex;
    gap: 15px;
}

.detail-row .label {
    font-weight: bold;
    min-width: 150px;
}

.detail-row .value {
    flex: 1;
}

.detail-row code {
    background: #f8f9fa;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.usbc-external-link {
    color: #0073aa;
    text-decoration: none;
}

.usbc-external-link:hover {
    color: #005177;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
    .usbc-token-info-box {
        flex-direction: column;
        gap: 15px;
    }

    .usbc-form-row input[type="text"],
    .usbc-form-row input[type="number"] {
        max-width: 100%;
    }

    .usbc-balance-form {
        flex-direction: column;
    }

    .usbc-balance-form input {
        max-width: 100%;
    }

    .usbc-form-actions {
        flex-direction: column;
    }

    .usbc-form-actions .button {
        width: 100%;
    }

    .price-row {
        font-size: 14px;
    }

    .detail-row {
        flex-direction: column;
        gap: 5px;
    }

    .detail-row .label {
        min-width: auto;
    }
}

/* ==========================================================================
   RTL Support
   ========================================================================== */

[dir="rtl"] .usbc-token-management {
    direction: rtl;
}

[dir="rtl"] .usbc-tx-link .dashicons {
    margin-left: 0;
    margin-right: 5px;
}

/* ==========================================================================
   DataTables Overrides
   ========================================================================== */

.dataTables_wrapper .dataTables_paginate .paginate_button {
    padding: 5px 10px;
    margin: 0 2px;
}

.dataTables_wrapper .dataTables_filter input {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 5px 10px;
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .usbc-purchase-section,
    .usbc-balance-section,
    .usbc-form-actions,
    .button {
        display: none;
    }

    .usbc-history-table {
        border: 1px solid #000;
    }

    .usbc-history-table th,
    .usbc-history-table td {
        border: 1px solid #000;
    }
}