* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --bg-color: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
}

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

.app-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo h1 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary);
    border-radius: 0.5rem;
    font-size: 0.875rem;
}

.status-indicator {
    font-size: 0.75rem;
    animation: pulse 2s infinite;
}

.status-indicator.connected {
    color: var(--success-color);
}

.status-indicator.disconnected {
    color: var(--danger-color);
}

.status-indicator.checking {
    color: var(--text-secondary);
}

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

.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--border-color);
}

.btn-invest-header {
    background: linear-gradient(135deg, #ff6600 0%, #ff9900 100%);
    color: white;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    animation: pulse-invest 2s infinite;
    box-shadow: 0 2px 10px rgba(255, 102, 0, 0.3);
}

.btn-invest-header:hover {
    background: linear-gradient(135deg, #ff8800 0%, #ffaa00 100%);
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(255, 102, 0, 0.5);
}

@keyframes pulse-invest {
    0%, 100% { box-shadow: 0 2px 10px rgba(255, 102, 0, 0.3); }
    50% { box-shadow: 0 2px 20px rgba(255, 102, 0, 0.6); }
}

.btn-large {
    padding: 0.75rem 2rem;
    font-size: 1rem;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.25rem;
    padding: 0.25rem;
    color: var(--text-primary);
}

.screen {
    flex: 1;
    overflow: auto;
}

.screen.hidden {
    display: none;
}

.setup-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 100px);
    padding: 2rem;
}

.setup-card {
    background: var(--bg-secondary);
    padding: 3rem;
    border-radius: 1rem;
    text-align: center;
    max-width: 400px;
    border: 1px solid var(--border-color);
}

.setup-card h2 {
    margin-bottom: 1rem;
}

.setup-card p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.loading {
    margin-top: 2rem;
}

.loading.hidden {
    display: none;
}

.spinner {
    border: 3px solid var(--bg-tertiary);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

.wallet-grid {
    display: grid;
    grid-template-columns: 300px 1fr;
    max-width: 1400px;
    margin: 0 auto;
    min-height: calc(100vh - 100px);
}

.sidebar {
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 1.5rem;
    overflow-y: auto;
}

.wallet-info {
    margin-bottom: 2rem;
}

.wallet-address {
    margin-bottom: 1.5rem;
}

.wallet-address label,
.balance-display label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.address-display {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    background: var(--bg-tertiary);
    padding: 0.75rem;
    border-radius: 0.5rem;
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    word-break: break-all;
    flex-wrap: wrap;
    min-width: 0;
}

.address-display span {
    flex: 1;
    min-width: 0;
    line-height: 1.5;
    white-space: normal;
    overflow-wrap: break-word;
    word-break: break-all;
    display: block;
    width: 100%;
}

.balance-display {
    text-align: center;
}

.balance-amount {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
    margin: 0.5rem 0;
}

.currency {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.pending-balance {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
    font-weight: normal;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    text-align: left;
    cursor: pointer;
    border-radius: 0.5rem;
    transition: all 0.2s;
    font-size: 0.875rem;
}

.nav-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--primary-color);
    color: white;
}

.nav-item:hover:not([style*="background: var(--danger-color)"]) {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

#logoutBtn:hover {
    background: #dc2626 !important;
    opacity: 0.9;
}

.content-area {
    padding: 2rem;
    overflow-y: auto;
}

.view {
    display: none;
}

.view.active {
    display: block;
}

.view h2 {
    margin-bottom: 2rem;
    font-size: 1.5rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.form {
    max-width: 500px;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    color: var(--text-primary);
    font-size: 1rem;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.receive-card {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
    text-align: center;
    max-width: 500px;
}

.qr-code-placeholder {
    margin: 2rem 0;
    display: flex;
    justify-content: center;
}

.qr-code {
    width: 200px;
    height: 200px;
    background: white;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    padding: 10px;
    box-sizing: border-box;
    border: 2px solid var(--border-color);
}

.qr-code canvas,
.qr-code img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 0.25rem;
}

.qr-code p {
    margin: 0;
    text-align: center;
    font-size: 0.875rem;
}

.address-display-large {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.address-display-large span {
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    word-break: break-all;
    background: var(--bg-tertiary);
    padding: 1rem;
    border-radius: 0.5rem;
    width: 100%;
    text-align: center;
}

.transactions-list,
.blocks-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.transaction-item,
.block-item {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
}

.empty-state {
    text-align: center;
    color: var(--text-secondary);
    padding: 3rem;
}

/* Модальное окно */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: 1rem;
    width: 90%;
    max-width: 500px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-body .form-group {
    margin-bottom: 1.5rem;
}

.modal-body .form-group small {
    display: block;
    margin-top: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.form-actions .btn {
    flex: 1;
}

.test-result {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
}

.test-result.success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid var(--success-color);
    color: var(--success-color);
}

.test-result.error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--danger-color);
    color: var(--danger-color);
}

.mining-status {
    margin-top: 1rem;
}

.mining-status.hidden {
    display: none;
}

.mnemonic-phrase {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: 0.5rem;
    border: 2px solid var(--border-color);
}

.mnemonic-word {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    background: white;
    border-radius: 0.25rem;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    border: 1px solid var(--border-color);
}

.word-number {
    display: inline-block;
    min-width: 1.5rem;
    color: var(--text-secondary);
    font-size: 0.75rem;
    margin-right: 0.5rem;
    font-weight: bold;
}

.mnemonic-input {
    width: 100%;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: 'Courier New', monospace;
    resize: vertical;
}

.mnemonic-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.settings-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
    margin-bottom: -2px;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    display: none;
}

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

/* Адаптивность */
@media (max-width: 768px) {
    .wallet-grid {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }
}


.modal-footer {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    text-align: right;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: var(--text-primary);
}
