/* =============================================================================
   HEADER LAYOUT
   ============================================================================= */

.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10, 11, 15, 0.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: var(--space-md) 0;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-lg);
    max-width: 100%;
    flex-wrap: wrap;
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    text-decoration: none;
    color: var(--text-main);
    font-weight: 700;
    font-size: var(--text-lg);
}

.logo i {
    font-size: 1.5rem;
    color: var(--primary);
}

.logo-text {
    font-family: var(--font-display);
    letter-spacing: -0.02em;
}

/* Header Layout */
.header-left {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    flex-shrink: 0;
    min-width: 0;
}

/* Network Switcher */
.network-switcher {
    position: relative;
}

.btn-network {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-network:hover {
    border-color: var(--border-hover);
    background: var(--bg-card);
}

.network-menu {
    position: absolute;
    top: calc(100% + var(--space-xs));
    left: 0;
    min-width: 160px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: var(--z-dropdown);
    display: none;
    overflow: hidden;
}

.network-menu.show {
    display: block;
}

.network-option {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: var(--text-sm);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.network-option:hover {
    background: var(--bg-elevated);
}

.network-option.active {
    background: rgba(0, 82, 255, 0.1);
    color: var(--primary);
}

.network-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.network-dot.mainnet {
    background: var(--success);
}

.network-dot.testnet {
    background: var(--warning);
}

.nav {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-wrap: wrap;
    justify-content: flex-end;
    min-width: 0;
}

.view-btn {
    position: relative;
}

.view-btn.active {
    background: var(--bg-elevated);
    color: var(--primary);
}

.view-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 2px;
    background: var(--primary);
    border-radius: 1px;
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: var(--space-md);
        padding: var(--space-sm) 0;
    }
    
    .header-left {
        flex-direction: column;
        gap: var(--space-sm);
    }
    
    .nav {
        flex-wrap: wrap;
        justify-content: center;
        gap: var(--space-xs);
    }
    
    .logo-text {
        display: none;
    }
    
    .nav-link {
        padding: var(--space-xs) var(--space-sm);
        font-size: var(--text-sm);
    }
    
    .btn-sm {
        padding: var(--space-xs) var(--space-sm);
        font-size: var(--text-xs);
    }
    
    .network-menu {
        left: 50%;
        transform: translateX(-50%);
    }
}

@media (max-width: 480px) {
    .header {
        padding: var(--space-xs) 0;
    }
    
    .header-content {
        gap: var(--space-sm);
    }
    
    .logo i {
        font-size: 1.25rem;
    }
    
    .btn-network {
        font-size: var(--text-xs);
        padding: var(--space-xs);
    }
}

/* =============================================================================
   MAIN CONTENT
   ============================================================================= */

.main {
    padding: var(--space-xl) 0;
    min-height: calc(100vh - 200px);
}

/* =============================================================================
   HELP SECTION
   ============================================================================= */

.help-section {
    margin-bottom: var(--space-xl);
}

.help-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-md) var(--space-lg);
    color: var(--text-muted);
    font-size: var(--text-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.help-toggle:hover {
    color: var(--text-main);
    border-color: var(--border-light);
}

.help-toggle span {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.help-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.help-content.show {
    max-height: 600px;
    margin-top: var(--space-md);
}

.help-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--space-lg);
    padding: var(--space-lg);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.help-card {
    text-align: center;
    padding: var(--space-lg);
}

.help-icon {
    font-size: 2rem;
    margin-bottom: var(--space-md);
}

.help-card h3 {
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: var(--space-sm);
}

.help-card p {
    font-size: var(--text-sm);
    color: var(--text-muted);
    line-height: 1.6;
}

.help-note {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-top: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    color: var(--text-muted);
}

.help-note i {
    color: var(--primary);
}

/* =============================================================================
   FILTERS SECTION
   ============================================================================= */

.filters-section {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
    padding: var(--space-lg);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.filters-row {
    display: flex;
    gap: var(--space-md);
    align-items: center;
}

.filters-row .search-wrapper {
    flex: 1;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--space-md);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.filter-label {
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.search-wrapper {
    position: relative;
}

.search-wrapper i {
    position: absolute;
    left: var(--space-md);
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-input {
    width: 100%;
    padding: var(--space-md) var(--space-md) var(--space-md) var(--space-2xl);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-size: var(--text-sm);
    transition: all var(--transition-fast);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-faded);
}

.filters-right {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.filter-select {
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-size: var(--text-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.filter-select:hover {
    border-color: var(--border-light);
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary);
}

@media (max-width: 768px) {
    .filters-section {
        padding: var(--space-md);
    }
    
    .filters-row {
        flex-wrap: wrap;
    }
    
    .filters-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-sm);
    }
    
    .search-wrapper {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .filters-section {
        padding: var(--space-sm);
    }
    
    .filters-grid {
        grid-template-columns: 1fr;
    }
    
    .filter-select {
        font-size: var(--text-sm);
        padding: var(--space-sm);
    }
}

/* =============================================================================
   ORDERS SECTION
   ============================================================================= */

.orders-section {
    min-height: 300px;
}

.orders-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: var(--space-lg);
}

@media (max-width: 768px) {
    .orders-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: var(--space-md);
    }
}

@media (max-width: 480px) {
    .orders-grid {
        grid-template-columns: 1fr;
        gap: var(--space-sm);
    }
    
    .orders-section {
        margin: 0 calc(-1 * var(--space-md));
        padding: 0 var(--space-sm);
    }
}

.loading-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-3xl);
    color: var(--text-muted);
}

.spinner-large {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: var(--space-md);
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: var(--space-3xl);
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: var(--space-md);
    opacity: 0.5;
}

/* =============================================================================
   FOOTER
   ============================================================================= */

.footer {
    border-top: 1px solid var(--border);
    padding: var(--space-lg) 0;
    margin-top: auto;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-md);
    font-size: var(--text-sm);
    color: var(--text-muted);
}

.footer-left,
.footer-right {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.footer-divider {
    opacity: 0.3;
}

.footer a {
    color: var(--text-sub);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    transition: color var(--transition-fast);
}

.footer a:hover {
    color: var(--primary);
}

@media (max-width: 768px) {
    .footer-content {
        flex-direction: column;
        text-align: center;
    }
}

/* =============================================================================
   INTRO SECTION (deprecated, keeping for compatibility)
   ============================================================================= */

.intro-section {
    background: linear-gradient(180deg, var(--bg-elevated) 0%, var(--bg-card) 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    margin-bottom: var(--space-2xl);
    display: none;
}

.intro-section.show {
    display: block;
    animation: fadeSlideIn 0.3s ease;
}

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

.intro-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-2xl);
}

.intro-col h2 {
    font-family: var(--font-display);
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.intro-col h2 i {
    color: var(--primary);
}

.intro-col p {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    margin-bottom: var(--space-md);
    line-height: 1.7;
}

.intro-col h3 {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-main);
    margin-top: var(--space-lg);
    margin-bottom: var(--space-md);
}

.feature-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.feature-list li {
    display: flex;
    gap: var(--space-sm);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    line-height: 1.5;
}

.feature-list li i {
    color: var(--primary);
    margin-top: 3px;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .intro-grid {
        grid-template-columns: 1fr;
        gap: var(--space-xl);
    }
}

/* =============================================================================
   FILTERS BAR
   ============================================================================= */

.filters-bar {
    display: flex;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
    flex-wrap: wrap;
    align-items: center;
}

.search-box {
    flex: 1;
    min-width: 280px;
}

@media (max-width: 640px) {
    .filters-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-box {
        min-width: 100%;
    }
}

/* =============================================================================
   FOOTER
   ============================================================================= */

.footer {
    margin-top: var(--space-2xl);
    padding: var(--space-2xl) 0;
    border-top: 1px solid var(--border);
    text-align: center;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: var(--space-xl);
    margin-bottom: var(--space-lg);
}

.footer-links a {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    color: var(--text-muted);
    font-size: var(--text-sm);
    transition: color var(--transition-fast);
}

.footer-links a:hover {
    color: var(--primary);
}

.footer-contract {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--text-muted);
    background: var(--bg-input);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
}
