/* Almadaa Wallet CSS Fixes */

/* Fix form input validation styling */
.wallet-topup-form input:invalid,
.wallet-transfer-form input:invalid,
.wallet-external-form input:invalid {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

.wallet-topup-form input:valid,
.wallet-transfer-form input:valid,
.wallet-external-form input:valid {
    border-color: #28a745;
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25);
}

/* Improve transaction table readability */
.wallet-transactions table {
    table-layout: fixed;
}

.wallet-transactions th:first-child,
.wallet-transactions td:first-child {
    width: 80px;
}

.wallet-transactions th:nth-child(2),
.wallet-transactions td:nth-child(2) {
    width: 120px;
}

.wallet-transactions th:last-child,
.wallet-transactions td:last-child {
    width: 100px;
}

/* Loading states */
.wallet-form-loading {
    opacity: 0.6;
    pointer-events: none;
}

.wallet-form-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Better error/success message styling */
.wallet-message {
    padding: 15px;
    margin: 15px 0;
    border-radius: 4px;
    border-left: 4px solid;
}

.wallet-message.success {
    background-color: #d4edda;
    border-color: #28a745;
    color: #155724;
}

.wallet-message.error {
    background-color: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}

.wallet-message.warning {
    background-color: #fff3cd;
    border-color: #ffc107;
    color: #856404;
}

/* Accessibility improvements */
.screen-reader-text {
    clip: rect(1px, 1px, 1px, 1px);
    position: absolute !important;
    height: 1px;
    width: 1px;
    overflow: hidden;
}

.wallet-balance-amount {
    font-size: 2em;
    font-weight: bold;
    color: #2c5aa0;
    text-align: center;
    margin: 15px 0;
}

.wallet-balance-notes {
    text-align: center;
    margin-top: 20px;
}

.wallet-balance-note {
    display: inline-block;
    background: rgba(44, 90, 160, 0.1);
    color: rgba(44, 90, 160, 0.8);
    padding: 5px 10px;
    margin: 2px;
    border-radius: 3px;
    font-size: 0.9em;
}

/* Print styles */
@media print {
    .wallet-balance-container,
    .wallet-summary-card,
    .wallet-transactions {
        border: 1px solid #000 !important;
        background: #fff !important;
        box-shadow: none !important;
    }
    
    .wallet-topup-form,
    .wallet-transfer-form,
    .wallet-external-form {
        display: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .wallet-balance-inner,
    .wallet-summary-card {
        border: 2px solid #000;
        background: #fff;
    }
    
    .wallet-balance-heading {
        color: #000;
    }
    
    button, .button, input[type="submit"] {
        background-color: #000;
        color: #fff;
        border: 2px solid #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus improvements for keyboard navigation */
.wallet-topup-form input:focus,
.wallet-transfer-form input:focus,
.wallet-external-form input:focus,
.wallet-transfer-form select:focus,
.wallet-topup-form textarea:focus,
.wallet-external-form textarea:focus {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
    box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.8);
}

/* Transaction Details Styling */
.transaction-summary-card,
.transfer-details-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid #dee2e6;
    border-radius: 12px;
    padding: 24px;
    margin: 20px 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.transaction-summary-card h4,
.transfer-details-card h4 {
    color: #495057;
    margin-bottom: 20px;
    font-size: 1.2em;
    border-bottom: 2px solid #007cba;
    padding-bottom: 8px;
}

.transaction-detail-grid {
    display: grid;
    grid-template-columns: 1fr 160px;
    gap: 24px;
    align-items: start;
}

.qr-code-section {
    text-align: center;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 12px;
}

.qr-code-section p {
    margin: 0 0 8px 0;
    font-size: 11px;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.qr-code-section img {
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background: white;
}

.transaction-actions {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #dee2e6;
}

.transaction-actions a {
    display: inline-block;
    margin: 0 5px;
    padding: 10px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

.transaction-actions a:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.status-pending {
    color: #856404;
    background: #fff3cd;
    border: 1px solid #ffc107;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
}

.status-completed {
    color: #155724;
    background: #d4edda;
    border: 1px solid #28a745;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
}

.verification-code {
    background: #e9ecef;
    border: 1px solid #ced4da;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    letter-spacing: 1px;
}

/* Mobile-first improvements */
@media (max-width: 480px) {
    .transaction-detail-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .qr-code-section {
        order: -1;
        margin-bottom: 16px;
    }
    .wallet-transactions {
        font-size: 14px;
    }
    
    .wallet-transactions table,
    .wallet-transactions thead,
    .wallet-transactions tbody,
    .wallet-transactions th,
    .wallet-transactions td,
    .wallet-transactions tr {
        display: block;
    }
    
    .wallet-transactions thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    
    .wallet-transactions tr {
        border: 1px solid #ccc;
        margin-bottom: 10px;
        padding: 10px;
        border-radius: 5px;
    }
    
    .wallet-transactions td {
        border: none;
        position: relative;
        padding-left: 50% !important;
    }
    
    .wallet-transactions td:before {
        content: attr(data-label) ": ";
        position: absolute;
        left: 6px;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        font-weight: bold;
    }
}
