/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

/* App Layout */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.app-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header-left h1 {
    color: #667eea;
    font-size: 1.5rem;
    font-weight: 600;
}

.header-left i {
    margin-right: 0.5rem;
    color: #764ba2;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* RPC Selector */
.rpc-selector {
    position: relative;
    min-width: 320px;
}

/* rpc dropdown */
.rpc-dropdown {
    position: relative;
}

.rpc-selected {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 40px;
}

.rpc-selected:hover {
    border-color: #4F46E5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.rpc-selected i.fa-chevron-down {
    margin-left: auto;
    transition: transform 0.2s ease;
}

.rpc-selected.open i.fa-chevron-down {
    transform: rotate(180deg);
}

.rpc-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    min-width: 320px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    margin-top: 4px;
    overflow: hidden;
}

.rpc-options.hidden {
    display: none;
}

/* regular options */
.rpc-option {
    padding: 12px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    gap: 8px;
}

.rpc-option:hover {
    background-color: #f8fafc;
}

.rpc-option:last-child {
    border-bottom: none;
}

/* custom rpc options */
.custom-rpc-option {
    padding: 0;
    cursor: default;
}

.custom-rpc-option:hover {
    background-color: transparent;
}

/* custom rpc input section */
.custom-rpc-input-section {
    padding: 12px;
}

.custom-rpc-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-weight: 500;
    color: #374151;
}

.custom-rpc-controls {
    display: flex;
    gap: 8px;
    align-items: center;
    width: 100%;
}

.custom-url-input {
    flex: 1;
    min-width: 200px;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 13px;
    background: white;
    transition: all 0.2s ease;
}

.custom-url-input:focus {
    outline: none;
    border-color: #4F46E5;
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1);
}

.apply-btn {
    background: #4F46E5;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 60px;
}

.apply-btn:hover {
    background: #4338CA;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(67, 56, 202, 0.3);
}

.apply-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(67, 56, 202, 0.3);
}

/* custom rpc display section */
.custom-rpc-display-section {
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
}

.custom-rpc-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    min-width: 0;
    overflow: hidden;
}

.custom-rpc-info:hover {
    background-color: #f8fafc;
}

.custom-rpc-url {
    font-size: 13px;
    color: #4F46E5;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.edit-btn {
    background: #6B7280;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 6px 16px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    min-width: 50px;
}

.edit-btn:hover {
    background: #4B5563;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(107, 114, 128, 0.3);
}

.edit-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(107, 114, 128, 0.3);
}

/* Wallet Section */
.wallet-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.wallet-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.wallet-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.wallet-info {
    display: flex;
    align-items: center;
    background: rgba(76, 175, 80, 0.1);
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.wallet-connected {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: rgba(34, 197, 94, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.wallet-balance {
    display: flex;
    align-items: center;
    gap: 4px;
}

.balance-amount {
    font-size: 13px;
    font-weight: 600;
    color: #059669;
    background: rgba(34, 197, 94, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.wallet-address-info {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
}

.wallet-address {
    font-size: 14px;
    color: #059669;
    font-weight: 500;
}

.disconnect-btn {
    background: #f44336;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.disconnect-btn:hover {
    background: #d32f2f;
}

/* Main Content */
.main-content {
    display: flex;
    flex: 1;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-right: 1px solid rgba(255, 255, 255, 0.2);
    padding: 2rem 0;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.nav-menu {
    padding: 0 1rem;
}

.nav-section {
    margin-bottom: 2rem;
}

.nav-section h3 {
    color: #667eea;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 1rem;
    padding: 0 1rem;
}

.nav-list {
    list-style: none;
}

.nav-item {
    margin-bottom: 0.5rem;
}

.nav-btn {
    width: 100%;
    background: transparent;
    border: none;
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #555;
    font-size: 14px;
    font-weight: 500;
    text-align: left;
}

.nav-btn:hover {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
}

.nav-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.nav-btn i {
    width: 20px;
    text-align: center;
}

/* Content Area */
.content-area {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

/* Page System */
.page {
    display: none;
}

.page.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.page-header {
    margin-bottom: 2rem;
}

.page-header h2 {
    color: white;
    font-size: 2rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-header p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.1rem;
}

/* Coming Soon */
.coming-soon {
    text-align: center;
    padding: 4rem 2rem;
    color: white;
}

.coming-soon i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.7;
}

.coming-soon h3 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.coming-soon p {
    font-size: 1.2rem;
    opacity: 0.8;
}

/* Footer */
.app-footer {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding: 1rem 2rem;
    text-align: center;
    color: #666;
    font-size: 14px;
}

.app-footer a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
}

.app-footer a:hover {
    text-decoration: underline;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Message Containers */
.loading, .error-message, .info-message, .warning-message, .success-message {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border-left: 4px solid;
}

.loading {
    border-left-color: #2196f3;
    color: #1565c0;
}

.error-message {
    border-left-color: #f44336;
    color: #c62828;
}

.info-message {
    border-left-color: #2196f3;
    color: #1565c0;
}

.warning-message {
    border-left-color: #ff9800;
    color: #ef6c00;
}

.success-message {
    border-left-color: #4caf50;
    color: #2e7d32;
}

.loading i, .info-message.loading i {
    animation: spin 1s linear infinite;
}

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

/* Message Links */
.error-message a, .info-message a, .warning-message a, .success-message a {
    color: inherit;
    text-decoration: underline;
    font-weight: 500;
}

/* Modal Base Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { opacity: 0; transform: scale(0.9) translateY(-20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

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

.modal-header h3 {
    color: #333;
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #666;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

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

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 20px 24px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Modal Buttons */
.btn-cancel, .btn-confirm {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-cancel {
    background: #f5f5f5;
    color: #666;
}

.btn-cancel:hover {
    background: #e0e0e0;
}

.btn-confirm {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-confirm:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-confirm:disabled {
    background: #e0e0e0;
    color: #999;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Modal Notes */
.modal-note {
    background: rgba(102, 126, 234, 0.1);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 8px;
    padding: 12px;
    margin: 16px 0;
    font-size: 14px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.modal-note i {
    color: #667eea;
    margin-top: 2px;
}

.balance-info {
    margin-top: 8px;
    color: #666;
    font-size: 13px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .app-header {
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
    }
    
    .header-right {
        width: 100%;
        justify-content: space-between;
    }
    
    .main-content {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        padding: 1rem 0;
    }
    
    .content-area {
        padding: 1rem;
    }
    
    .modal-content {
        margin: 20px;
        width: auto;
    }
}

/* custom rpc styles */
.rpc-selector {
    position: relative;
}

.custom-rpc-wrapper {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 12px;
    margin-top: 4px;
    z-index: 1000;
    transition: all 0.2s ease;
}

.custom-rpc-wrapper.hidden {
    display: none;
}

.custom-rpc-wrapper .input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.custom-rpc-input {
    flex: 1;
    padding: 8px 12px 8px 32px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    transition: border-color 0.2s ease;
}

.custom-rpc-input:focus {
    outline: none;
    border-color: #4F46E5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.custom-rpc-wrapper .input-wrapper i {
    position: absolute;
    left: 10px;
    color: #6b7280;
    z-index: 1;
}

.apply-rpc-btn {
    background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.apply-rpc-btn:hover {
    background: linear-gradient(135deg, #4338CA 0%, #6D28D9 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(79, 70, 229, 0.3);
}

.apply-rpc-btn:active {
    transform: translateY(0);
}

/* custom rpc display mode */
.custom-rpc-display {
    display: flex;
    align-items: center;
    gap: 12px;
}

.custom-rpc-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(79, 70, 229, 0.05);
    border: 1px solid rgba(79, 70, 229, 0.2);
    border-radius: 6px;
}

.custom-rpc-info i {
    color: #4F46E5;
}

.custom-rpc-url {
    font-size: 13px;
    color: #4F46E5;
    font-weight: 500;
    word-break: break-all;
}

.edit-rpc-btn {
    background: linear-gradient(135deg, #6B7280 0%, #4B5563 100%);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.edit-rpc-btn:hover {
    background: linear-gradient(135deg, #4B5563 0%, #374151 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(107, 114, 128, 0.3);
}

.edit-rpc-btn:active {
    transform: translateY(0);
}
