/**
 * RaiseFi Web3 Interface Styles
 * Styling for Web3 wallet, network, and transaction components
 * 
 * @package RaiseFi
 * @version 3.0.0
 */

/* ==========================================================================
   Web3 Status Indicators
   ========================================================================== */

.web3-status {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    transition: all 0.3s ease;
}

.web3-status.ready {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.web3-status.wallet-required {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.web3-status.network-required {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.web3-status.not-ready {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* ==========================================================================
   Wallet Connection Interface
   ========================================================================== */

.wallet-connector {
    background: #ffffff;
    border: 1px solid #e1e5e9;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.wallet-connector h3 {
    margin: 0 0 20px 0;
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
}

.wallet-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 20px;
}

.wallet-status.connected {
    background: #d4edda;
    border: 1px solid #c3e6cb;
}

.wallet-status.disconnected {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
}

.wallet-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.wallet-icon {
    width: 24px;
    height: 24px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.wallet-icon.metamask-icon {
    background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTEyIDI0QzE4LjYyNzQgMjQgMjQgMTguNjI3NCAyNCA1MkMyNCA1LjM3MjU4IDE4LjYyNzQgMCAxMiAwQzUuMzcyNTggMCAwIDUuMzcyNTggMCAxMkMwIDE4LjYyNzQgNS4zNzI1OCAyNCAxMiAyNFoiIGZpbGw9IiNGNjg1MkEiLz4KPC9zdmc+');
}

.wallet-icon.coinbase-icon {
    background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTEyIDI0QzE4LjYyNzQgMjQgMjQgMTguNjI3NCAyNCA1MkMyNCA1LjM3MjU4IDE4LjYyNzQgMCAxMiAwQzUuMzcyNTggMCAwIDUuMzcyNTggMCAxMkMwIDE4LjYyNzQgNS4zNzI1OCAyNCAxMiAyNFoiIGZpbGw9IiMwMDUyRkYiLz4KPC9zdmc+');
}

.wallet-address {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 14px;
    color: #6c757d;
    background: #f8f9fa;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid #dee2e6;
}

.wallet-actions {
    display: flex;
    gap: 8px;
}

/* Wallet List */
.wallet-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.wallet-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    background: #ffffff;
    transition: all 0.3s ease;
}

.wallet-item:hover {
    border-color: #007cba;
    box-shadow: 0 2px 8px rgba(0, 124, 186, 0.1);
}

.wallet-item.current {
    border-color: #28a745;
    background: #f8fff9;
}

.wallet-name {
    font-weight: 500;
    color: #2c3e50;
}

.wallet-status.detected {
    color: #28a745;
    font-size: 12px;
    font-weight: 500;
}

.wallet-status.not-detected {
    color: #dc3545;
    font-size: 12px;
    font-weight: 500;
}

/* ==========================================================================
   Network Management Interface
   ========================================================================== */

.network-manager {
    background: #ffffff;
    border: 1px solid #e1e5e9;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.network-manager h3 {
    margin: 0 0 20px 0;
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
}

.network-status {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.network-status.connected {
    background: #d4edda;
    color: #155724;
}

.network-status.unsupported {
    background: #f8d7da;
    color: #721c24;
}

.network-status.disconnected {
    background: #f8f9fa;
    color: #6c757d;
}

.current-network {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 20px;
}

.current-network.supported {
    background: #d4edda;
    border: 1px solid #c3e6cb;
}

.current-network.unsupported {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
}

.network-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.network-name {
    font-weight: 600;
    color: #2c3e50;
}

.network-currency {
    font-size: 14px;
    color: #6c757d;
}

.network-id {
    font-size: 12px;
    color: #adb5bd;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

/* Network List */
.network-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.network-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    background: #ffffff;
    transition: all 0.3s ease;
}

.network-item:hover {
    border-color: #007cba;
    box-shadow: 0 2px 8px rgba(0, 124, 186, 0.1);
}

.network-item.current {
    border-color: #28a745;
    background: #f8fff9;
}

/* Network Messages */
.network-message {
    padding: 12px 16px;
    border-radius: 6px;
    margin: 16px 0;
    font-size: 14px;
    font-weight: 500;
}

.network-message.switching {
    background: #cce5ff;
    color: #004085;
    border: 1px solid #b3d7ff;
}

.network-message.switched {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.network-message.refreshing {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.network-message.refreshed {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.network-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Network Validation */
.validation-result {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-radius: 8px;
    margin: 16px 0;
}

.validation-result.valid {
    background: #d4edda;
    border: 1px solid #c3e6cb;
}

.validation-result.invalid {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
}

.validation-icon {
    font-size: 18px;
    font-weight: bold;
}

.validation-message {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
}

.validation-action {
    margin-top: 12px;
}

/* ==========================================================================
   Transaction Interface
   ========================================================================== */

.transaction-interface {
    background: #ffffff;
    border: 1px solid #e1e5e9;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.transaction-interface h3 {
    margin: 0 0 20px 0;
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
}

/* Transaction List */
.transaction-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.transaction-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    background: #ffffff;
    transition: all 0.3s ease;
}

.transaction-item.pending {
    border-color: #ffc107;
    background: #fff8e1;
}

.transaction-item.confirmed {
    border-color: #28a745;
    background: #f8fff9;
}

.transaction-item.failed {
    border-color: #dc3545;
    background: #fff5f5;
}

.transaction-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.transaction-type {
    font-weight: 600;
    color: #2c3e50;
    text-transform: capitalize;
}

.transaction-hash {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 12px;
    color: #6c757d;
}

.transaction-status {
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.transaction-item.pending .transaction-status {
    color: #856404;
}

.transaction-item.confirmed .transaction-status {
    color: #155724;
}

.transaction-item.failed .transaction-status {
    color: #721c24;
}

.transaction-actions a {
    color: #007cba;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

.transaction-actions a:hover {
    text-decoration: underline;
}

/* ==========================================================================
   Web3 Buttons
   ========================================================================== */

.web3-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.web3-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Primary Web3 Button */
.web3-button.primary {
    background: linear-gradient(135deg, #007cba 0%, #0056b3 100%);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 124, 186, 0.3);
}

.web3-button.primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #0056b3 0%, #004085 100%);
    box-shadow: 0 4px 12px rgba(0, 124, 186, 0.4);
    transform: translateY(-1px);
}

/* Success Web3 Button */
.web3-button.success {
    background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
}

.web3-button.success:hover:not(:disabled) {
    background: linear-gradient(135deg, #1e7e34 0%, #155724 100%);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
    transform: translateY(-1px);
}

/* Warning Web3 Button */
.web3-button.warning {
    background: linear-gradient(135deg, #ffc107 0%, #e0a800 100%);
    color: #212529;
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.3);
}

.web3-button.warning:hover:not(:disabled) {
    background: linear-gradient(135deg, #e0a800 0%, #d39e00 100%);
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.4);
    transform: translateY(-1px);
}

/* Danger Web3 Button */
.web3-button.danger {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
}

.web3-button.danger:hover:not(:disabled) {
    background: linear-gradient(135deg, #c82333 0%, #bd2130 100%);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
    transform: translateY(-1px);
}

/* Secondary Web3 Button */
.web3-button.secondary {
    background: #ffffff;
    color: #6c757d;
    border: 1px solid #dee2e6;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.web3-button.secondary:hover:not(:disabled) {
    background: #f8f9fa;
    border-color: #adb5bd;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

/* Button Loading State */
.web3-button.loading {
    pointer-events: none;
}

.web3-button.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: web3-button-spin 1s linear infinite;
}

@keyframes web3-button-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==========================================================================
   Web3 Recommendation
   ========================================================================== */

.web3-recommendation {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 12px;
    padding: 24px;
    margin: 24px 0;
    text-align: center;
}

.web3-recommendation h3 {
    margin: 0 0 16px 0;
    color: #2c3e50;
    font-size: 20px;
    font-weight: 600;
}

.web3-recommendation p {
    margin: 0 0 20px 0;
    color: #6c757d;
    font-size: 16px;
}

.web3-recommendation ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
}

.web3-recommendation li {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.web3-recommendation a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: #007cba;
    color: #ffffff;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.web3-recommendation a:hover {
    background: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 124, 186, 0.3);
}

/* ==========================================================================
   Connection Status
   ========================================================================== */

.connection-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.connection-status.connecting {
    background: #cce5ff;
    color: #004085;
    border: 1px solid #b3d7ff;
}

.connection-status.connected {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.connection-status.disconnecting {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.connection-status.disconnected {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.connection-status.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Status Icons */
.connection-status::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

.connection-status.connecting::before {
    animation: web3-pulse 1.5s ease-in-out infinite;
}

@keyframes web3-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ==========================================================================
   Gas Price Display
   ========================================================================== */

.gas-price-display {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 14px;
    color: #6c757d;
}

.gas-price-display::before {
    content: '⛽';
    font-size: 16px;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
    .wallet-list,
    .network-list {
        grid-template-columns: 1fr;
    }
    
    .wallet-item,
    .network-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .wallet-actions,
    .network-actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    .web3-recommendation ul {
        flex-direction: column;
        align-items: center;
    }
    
    .transaction-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .transaction-actions {
        width: 100%;
        text-align: right;
    }
}

@media (max-width: 480px) {
    .wallet-connector,
    .network-manager,
    .transaction-interface {
        padding: 16px;
        margin-bottom: 16px;
    }
    
    .web3-button {
        width: 100%;
        justify-content: center;
    }
    
    .wallet-status,
    .current-network {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .wallet-actions {
        width: 100%;
        justify-content: stretch;
    }
    
    .wallet-actions > * {
        flex: 1;
    }
}

/* ==========================================================================
   Dark Mode Support
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    .wallet-connector,
    .network-manager,
    .transaction-interface {
        background: #2c3e50;
        border-color: #34495e;
        color: #ecf0f1;
    }
    
    .wallet-connector h3,
    .network-manager h3,
    .transaction-interface h3 {
        color: #ecf0f1;
    }
    
    .wallet-item,
    .network-item,
    .transaction-item {
        background: #34495e;
        border-color: #4a5f7a;
        color: #ecf0f1;
    }
    
    .wallet-item:hover,
    .network-item:hover {
        border-color: #3498db;
        box-shadow: 0 2px 8px rgba(52, 152, 219, 0.2);
    }
    
    .web3-recommendation {
        background: #34495e;
        border-color: #4a5f7a;
        color: #ecf0f1;
    }
    
    .web3-recommendation h3 {
        color: #ecf0f1;
    }
    
    .gas-price-display {
        background: #34495e;
        border-color: #4a5f7a;
        color: #bdc3c7;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .wallet-connector,
    .network-manager,
    .transaction-interface {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .web3-button {
        background: #fff !important;
        color: #000 !important;
        border: 1px solid #000 !important;
    }
    
    .web3-recommendation {
        display: none;
    }
}
