/* ==========================================
   Quantum Blockchain Dashboard - Styles
   ========================================== */

:root {
    /* Colors */
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    
    /* Backgrounds */
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    
    /* Text */
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    
    /* Borders */
    --border-color: #e2e8f0;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    
    /* Sidebar */
    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;
    --sidebar-bg: #1e293b;
    --sidebar-text: #cbd5e1;
    --sidebar-text-active: #ffffff;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
}

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

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: width 0.3s ease;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

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

.logo-icon {
    font-size: 28px;
}

.logo-text {
    font-size: 18px;
    font-weight: 700;
    color: var(--sidebar-text-active);
    letter-spacing: -0.5px;
}

.nav-menu {
    list-style: none;
    padding: 16px 12px;
    flex-grow: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    margin-bottom: 4px;
    border-radius: var(--border-radius-sm);
    color: var(--sidebar-text);
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--sidebar-text-active);
}

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

.nav-icon {
    font-size: 20px;
    width: 24px;
    text-align: center;
}

.nav-text {
    font-size: 14px;
    font-weight: 500;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--sidebar-text);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--warning);
    animation: pulse 2s infinite;
}

.status-dot.connected {
    background: var(--success);
    animation: none;
}

.status-dot.disconnected {
    background: var(--danger);
    animation: none;
}

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

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 32px;
    max-width: 100%;
}

/* Pages */
.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: 32px;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 15px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stats-grid.stats-small {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    max-width: 600px;
}

.stat-card {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    font-size: 32px;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-sm);
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

/* Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.info-card {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow);
}

.info-card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.info-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-sm);
}

.info-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.info-value {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.badge-primary {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

/* Tables */
.recent-section h3,
.info-card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 20px;
}

.table-container {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 14px 16px;
    text-align: left;
    font-size: 14px;
}

.data-table th {
    background: var(--bg-tertiary);
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
}

.data-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s ease;
}

.data-table tbody tr:last-child {
    border-bottom: none;
}

.data-table tbody tr:hover {
    background: var(--bg-tertiary);
}

.data-table td {
    color: var(--text-primary);
}

.data-table .loading {
    text-align: center;
    color: var(--text-muted);
    padding: 32px;
}

.hash-cell {
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    font-size: 12px;
    color: var(--text-secondary);
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Forms */
.wallet-section,
.settings-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
}

.form-card {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow);
}

.form-card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 20px;
}

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

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-group input[type="text"] {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input[type="text"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-group input[type="checkbox"] {
    margin-right: 8px;
}

.form-hint {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    margin-right: 8px;
    margin-bottom: 8px;
}

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

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

.btn-outline {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

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

/* Result Box */
.result-box {
    margin-top: 20px;
    padding: 20px;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-sm);
}

.result-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

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

.result-label {
    color: var(--text-secondary);
    font-size: 14px;
}

.result-value {
    font-weight: 600;
    font-size: 14px;
}

/* Quick Addresses */
.quick-addresses {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Block Details */
.block-details {
    margin-top: 24px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow);
}

.details-content {
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    font-size: 13px;
    background: var(--bg-tertiary);
    padding: 16px;
    border-radius: var(--border-radius-sm);
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Connection Test Result */
.connection-test-result {
    margin-top: 16px;
    padding: 12px;
    border-radius: var(--border-radius-sm);
    font-size: 14px;
}

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

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

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

.text-success {
    color: var(--success);
}

.text-warning {
    color: var(--warning);
}

.text-danger {
    color: var(--danger);
}

/* Responsive */
@media (max-width: 1024px) {
    .info-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: var(--sidebar-collapsed);
    }
    
    .logo-text,
    .nav-text {
        display: none;
    }
    
    .sidebar-header {
        padding: 24px 12px;
    }
    
    .nav-item {
        justify-content: center;
        padding: 14px 12px;
    }
    
    .nav-icon {
        margin: 0;
    }
    
    .main-content {
        margin-left: var(--sidebar-collapsed);
        padding: 16px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .page-header h1 {
        font-size: 22px;
    }
}

@media (max-width: 480px) {
    .stat-card {
        padding: 16px;
    }
    
    .stat-icon {
        width: 48px;
        height: 48px;
        font-size: 24px;
    }
    
    .stat-value {
        font-size: 20px;
    }
    
    .data-table th,
    .data-table td {
        padding: 10px 12px;
        font-size: 12px;
    }
}
