/* ============================================================================
   SEPOLIA WALLET MANAGER - COMPLETE CSS
   Clean, optimized stylesheet with terminal enhancements
   ============================================================================ */

/* ============================================================================
   RESET AND BASE STYLES
   ============================================================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.5;
    color: #212529;
    background: #f8f9fa;
    font-size: 14px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* ============================================================================
   HEADER
   ============================================================================ */
.header {
    background: #21325b;
    color: white;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
}

.logo h1 {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

.network-badge {
    background: #dc3545;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    margin-left: 12px;
}

.header-stats {
    display: flex;
    gap: 20px;
}

.stat-item {
    text-align: right;
}

.stat-label {
    font-size: 11px;
    color: #adb5bd;
    display: block;
}

.stat-value {
    font-size: 13px;
    font-weight: 500;
    font-family: 'SF Mono', monospace;
}

/* ============================================================================
   MAIN CONTENT
   ============================================================================ */
.main-content {
    padding: 20px 0;
}

/* ============================================================================
   ALERTS
   ============================================================================ */
.alert {
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.alert-success {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

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

.alert-close {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    opacity: 0.6;
}

.alert-close:hover {
    opacity: 1;
}

/* ============================================================================
   TABS
   ============================================================================ */
.tab-container {
    background: white;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.tab-nav {
    display: flex;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.tab-btn {
    flex: 1;
    background: none;
    border: none;
    padding: 16px 20px;
    font-size: 14px;
    font-weight: 500;
    color: #6c757d;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    background: #e9ecef;
}

.tab-btn.active {
    background: white;
    color: #007bff;
    border-bottom-color: #007bff;
}

.tab-btn .icon {
    margin-right: 8px;
}

.tab-panel {
    display: none;
    padding: 24px;
}

.tab-panel.active {
    display: block;
}

/* ============================================================================
   PANEL HEADERS
   ============================================================================ */
.panel-header {
    text-align: center;
    margin-bottom: 24px;
}

.panel-header h2 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 6px;
}

.panel-header p {
    color: #6c757d;
}

/* ============================================================================
   FORMS
   ============================================================================ */
.form {
    max-width: 600px;
    margin: 0 auto;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #495057;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

.form-input:disabled {
    background: #e9ecef;
    color: #6c757d;
}

/* ============================================================================
   GAS SETTINGS
   ============================================================================ */
.gas-settings {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 16px;
    margin-bottom: 20px;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.settings-header h3 {
    font-size: 16px;
    font-weight: 500;
    margin: 0;
}

/* ============================================================================
   TOGGLE SWITCH
   ============================================================================ */
.toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.toggle input {
    display: none;
}

.toggle-slider {
    width: 40px;
    height: 20px;
    background: #ccc;
    border-radius: 10px;
    position: relative;
    transition: all 0.2s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: white;
    top: 2px;
    left: 2px;
    transition: all 0.2s;
}

.toggle input:checked + .toggle-slider {
    background: #007bff;
}

.toggle input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

.toggle-label {
    font-size: 14px;
    font-weight: 500;
}

/* ============================================================================
   BUTTONS (ENHANCED WITH FULL-WIDTH & IMMEDIATE FEEDBACK)
   ============================================================================ */
.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    border: none;
    width: 100%;
    padding: 16px 32px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.1s ease;
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #0056b3 0%, #004085 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #545b62;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #1e7e34;
}

.btn-info {
    background: #17a2b8;
    color: white;
}

.btn-info:hover:not(:disabled) {
    background: #138496;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

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

/* Enhanced button loading states with immediate feedback */
.btn-loading {
    background: #6c757d !important;
    cursor: not-allowed !important;
    transform: scale(0.98) !important;
    transition: all 0.1s ease !important;
}

.btn-loading .btn-text {
    opacity: 0.7 !important;
}

.btn-loading .btn-loader {
    display: inline-block !important;
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 8px;
}

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

/* ============================================================================
   FAUCET SPIN BUTTON (ENHANCED)
   ============================================================================ */
.faucet-spin-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    width: 100%;
    padding: 16px 32px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.1s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.faucet-spin-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.faucet-spin-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ============================================================================
   TERMINAL-STYLE PROGRESS DISPLAY
   ============================================================================ */
.progress-display {
    background: #000000;
    border: 2px solid #333;
    border-radius: 8px;
    margin: 20px 0;
    padding: 0;
    font-family: 'SF Mono', 'Monaco', 'Menlo', 'Consolas', monospace;
    font-size: 12px;
    line-height: 1.5;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: inset 0 0 10px rgba(0, 255, 0, 0.1);
}

.progress-display.active {
    max-height: 500px;
    opacity: 1;
    padding: 16px;
}

.progress-header {
    color: #00ff00;
    font-weight: bold;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #333;
    text-shadow: 0 0 5px #00ff00;
}

.progress-content {
    max-height: 400px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #00ff00 #000;
}

.progress-content::-webkit-scrollbar {
    width: 8px;
}

.progress-content::-webkit-scrollbar-track {
    background: #000;
}

.progress-content::-webkit-scrollbar-thumb {
    background: #00ff00;
    border-radius: 4px;
}

.progress-line {
    margin: 3px 0;
    padding: 2px 0;
    color: #00ff00;
    opacity: 0;
    transform: translateX(-10px);
    animation: terminalFadeIn 0.3s ease forwards;
    font-family: 'SF Mono', 'Monaco', 'Menlo', 'Consolas', monospace;
}

@keyframes terminalFadeIn {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Terminal colors for different message types */
.progress-line.info { color: #00ff00; }
.progress-line.success { 
    color: #00ff41; 
    text-shadow: 0 0 3px #00ff41; 
    font-weight: bold;
}
.progress-line.warning { 
    color: #ffff00; 
    text-shadow: 0 0 3px #ffff00; 
}
.progress-line.error { 
    color: #ff4444; 
    text-shadow: 0 0 3px #ff4444; 
    font-weight: bold;
}
.progress-line.rpc { color: #66d9ef; }
.progress-line.gas { color: #f92672; }
.progress-line.faucet { 
    color: #a6e22e; 
    text-shadow: 0 0 3px #a6e22e; 
    font-weight: bold;
}
.progress-line.waiting { color: #fd971f; }

/* Terminal cursor effect */
.progress-line:last-child::after {
    content: '█';
    color: #00ff00;
    animation: terminalBlink 1s infinite;
    margin-left: 5px;
}

@keyframes terminalBlink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* Terminal prompt style */
.terminal-prompt::before {
    content: '$ ';
    color: #ffff00;
    font-weight: bold;
}

/* ============================================================================
   WALLET BALANCE DISPLAYS
   ============================================================================ */
.wallet-balance-display {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    margin-top: 8px;
    font-size: 13px;
    transition: all 0.2s ease;
}

.wallet-balance-display.loading {
    background: #fff3cd;
    border-color: #ffeaa7;
}

.wallet-balance-display.loaded {
    background: #d1ecf1;
    border-color: #bee5eb;
}

.wallet-balance-display.error {
    background: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

.balance-label {
    font-weight: 500;
    color: #495057;
}

.balance-amount {
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-weight: 600;
    font-size: 14px;
}

/* ============================================================================
   RESULTS
   ============================================================================ */
.result-card {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 20px;
    margin-top: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.result-card h3 {
    color: #28a745;
    margin-bottom: 16px;
    font-size: 18px;
}

.result-section {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 16px;
    margin: 16px 0;
    border-left: 4px solid #28a745;
}

.result-section h4 {
    margin: 0 0 12px 0;
    color: #495057;
    font-size: 16px;
}

.result-row {
    display: flex;
    justify-content: space-between;
    margin: 8px 0;
    padding: 4px 0;
    border-bottom: 1px solid #e9ecef;
}

.result-row:last-child {
    border-bottom: none;
}

.result-label {
    font-weight: 500;
    color: #6c757d;
}

.result-value {
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    color: #495057;
    word-break: break-all;
    text-align: right;
    max-width: 60%;
}

/* ============================================================================
   WALLETS GRID
   ============================================================================ */
.wallets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.wallet-card {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: all 0.2s;
}

.wallet-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    border-color: #007bff;
}

.wallet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.wallet-name {
    font-size: 18px;
    font-weight: 600;
}

.wallet-badge {
    background: #e9ecef;
    color: #6c757d;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
}

.wallet-address {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 4px;
    border: 1px solid #dee2e6;
}

.address-label {
    font-size: 13px;
    color: #6c757d;
    font-weight: 500;
    min-width: 60px;
}

.address-value {
    font-family: 'SF Mono', monospace;
    font-size: 12px;
    color: #007bff;
    flex: 1;
    word-break: break-all;
    overflow-wrap: break-word;
}

.copy-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 3px;
}

.copy-btn:hover {
    background: #dee2e6;
}

.wallet-balance {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding: 10px;
    background: #007bff;
    border-radius: 4px;
    color: white;
}

.balance-label {
    font-weight: 500;
}

.balance-value {
    font-family: 'SF Mono', monospace;
    font-weight: 600;
    word-break: break-all;
    overflow-wrap: break-word;
}

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

.wallet-actions .btn {
    width: 100%;
}

/* ============================================================================
   FAUCET SPECIFIC STYLES
   ============================================================================ */
.faucet-info {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 24px;
    border: 1px solid #5a6fd8;
}

.faucet-badge {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.address-toggle {
    display: flex;
    gap: 24px;
    margin-bottom: 16px;
}

.address-toggle label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 500;
}

.address-toggle input[type="radio"] {
    margin: 0;
}

.spin-animation {
    text-align: center;
    padding: 20px;
    font-size: 18px;
    color: #667eea;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 8px;
    margin: 16px 0;
}

.spinning-text {
    display: inline-block;
    /* animation: spin 1s linear infinite; */
}

.faucet-success {
    text-align: center;
    margin-bottom: 20px;
}

.faucet-success h3 {
    color: #28a745;
    margin-bottom: 16px;
    text-align: center;
}

.spin-amount {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin: 16px 0;
    padding: 16px;
    background: linear-gradient(135deg, #28a745, #20c997);
    border-radius: 8px;
    color: white;
}

.amount-label {
    font-size: 16px;
    font-weight: 500;
}

.amount-value {
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-size: 20px;
    font-weight: 700;
}

/* Faucet Statistics */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 16px;
    margin: 16px 0;
}

.stats-grid .stat-item {
    text-align: center;
    padding: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

.stats-grid .stat-value {
    display: block;
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
}

.stats-grid .stat-label {
    display: block;
    font-size: 12px;
    opacity: 0.9;
    text-transform: uppercase;
}

/* Cooldown and Eligibility */
.cooldown-notice {
    text-align: center;
    padding: 24px;
    background: linear-gradient(135deg, #ffc107, #fd7e14);
    border-radius: 12px;
    color: #fff;
    margin: 16px 0;
}

.cooldown-notice h3 {
    margin: 0 0 12px 0;
    font-size: 18px;
}

.cooldown-notice p {
    margin: 8px 0;
    font-size: 16px;
}

.faucet-eligibility {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    padding: 12px;
    border-radius: 8px;
    margin: 12px 0;
    font-size: 14px;
}

.faucet-cooldown {
    background: linear-gradient(135deg, #ffc107, #fd7e14);
    color: white;
    padding: 12px;
    border-radius: 8px;
    margin: 12px 0;
    font-size: 14px;
}

/* ============================================================================
   MODAL
   ============================================================================ */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 800px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

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

.modal-header h3 {
    margin: 0;
    color: #333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: #333;
}

.modal-body {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

.transaction-item {
    border-bottom: 1px solid #eee;
    padding: 12px 0;
}

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

/* ============================================================================
   EMPTY STATE
   ============================================================================ */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
    grid-column: 1 / -1;
}

.empty-icon {
    font-size: 36px;
    margin-bottom: 12px;
}

.empty-state h3 {
    font-size: 20px;
    color: #495057;
    margin-bottom: 6px;
}

.empty-state p {
    margin-bottom: 20px;
}

/* ============================================================================
   RESPONSIVE DESIGN
   ============================================================================ */
@media (max-width: 768px) {
    .container {
        padding: 0 12px;
    }
    
    .header-content {
        flex-direction: column;
        gap: 12px;
    }
    
    .header-stats {
        flex-wrap: wrap;
        justify-content: center;
        gap: 12px;
    }
    
    .tab-nav {
        flex-direction: column;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .wallets-grid {
        grid-template-columns: 1fr;
    }
    
    .result-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .result-label {
        min-width: auto;
    }
    
    .result-value {
        text-align: left;
        max-width: 100%;
    }
    
    .address-toggle {
        flex-direction: column;
        gap: 12px;
    }
    
    .wallet-actions {
        justify-content: center;
        flex-direction: column;
    }
    
    .wallet-actions .btn {
        width: 100%;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .faucet-info {
        padding: 16px;
    }
    
    /* Terminal responsive */
    .progress-display {
        font-size: 11px;
        margin: 16px 0;
    }
    
    .progress-header {
        font-size: 13px;
    }
    
    .btn-primary, 
    .faucet-spin-btn {
        padding: 14px 24px;
        font-size: 15px;
    }
    
    .progress-content {
        max-height: 300px;
    }
}