/**
 * Bitcoin Keys Explorer — Styles
 * Dark theme with crypto-native aesthetic
 */

/* ── Reset scope ── */
#bke-app {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #0a0e17;
    color: #c8cdd8;
    padding: 2rem 1.5rem;
    border-radius: 12px;
    max-width: 100%;
    overflow-x: auto;
    line-height: 1.6;
    direction: ltr;
    text-align: left;
}

#bke-app *, #bke-app *::before, #bke-app *::after {
    box-sizing: border-box;
}

/* ── Header ── */
.bke-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #1e2536;
}

.bke-logo {
    font-size: 3rem;
    color: #f7931a;
    margin-bottom: 0.5rem;
    text-shadow: 0 0 30px rgba(247, 147, 26, 0.3);
}

.bke-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: #fff;
    margin: 0 0 0.5rem;
    letter-spacing: -0.02em;
}

.bke-subtitle {
    font-size: 0.95rem;
    color: #7a8299;
    margin: 0;
    direction: rtl;
}

/* ── Navigation ── */
.bke-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.bke-nav-buttons {
    display: flex;
    gap: 0.25rem;
}

.bke-btn {
    background: #161c2e;
    color: #c8cdd8;
    border: 1px solid #2a3350;
    border-radius: 6px;
    padding: 0.5rem 0.85rem;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.15s ease;
}

.bke-btn:hover {
    background: #1e2740;
    border-color: #3d4f7a;
    color: #fff;
}

.bke-btn-primary {
    background: #f7931a;
    color: #0a0e17;
    border-color: #f7931a;
    font-weight: 600;
}

.bke-btn-primary:hover {
    background: #ffaa3d;
    border-color: #ffaa3d;
}

.bke-btn-accent {
    background: #1a2744;
    border-color: #2e4a80;
    color: #6ea8fe;
}

.bke-btn-accent:hover {
    background: #223560;
    color: #8ec2ff;
}

.bke-page-input-wrap {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.bke-page-input-wrap label {
    font-size: 0.8rem;
    color: #5a6378;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

#bke-page-input {
    width: 180px;
    background: #0d1220;
    border: 1px solid #2a3350;
    border-radius: 6px;
    color: #f7931a;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.85rem;
    padding: 0.5rem 0.6rem;
    text-align: center;
}

#bke-page-input:focus {
    outline: none;
    border-color: #f7931a;
    box-shadow: 0 0 0 2px rgba(247, 147, 26, 0.15);
}

/* ── Auto-Scan ── */
.bke-autoscan {
    background: #0d1220;
    border: 1px solid #1e2536;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.bke-autoscan-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.8rem;
}

.bke-autoscan-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
}

.bke-autoscan-badge {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.bke-autoscan-off {
    background: #2a2a2a;
    color: #666;
}

.bke-autoscan-on {
    background: #1b4332;
    color: #00e676;
    animation: bke-badge-pulse 1.5s ease-in-out infinite;
}

@keyframes bke-badge-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(0, 230, 118, 0.3); }
    50% { box-shadow: 0 0 8px 2px rgba(0, 230, 118, 0.2); }
}

.bke-autoscan-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.8rem;
    margin-bottom: 0.8rem;
}

.bke-autoscan-mode,
.bke-autoscan-speed {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.bke-autoscan-mode label,
.bke-autoscan-speed label {
    font-size: 0.7rem;
    color: #5a6378;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.bke-autoscan-buttons {
    display: flex;
    gap: 0.4rem;
}

.bke-btn-start {
    background: #1b4332 !important;
    color: #00e676 !important;
    border-color: #2d6a4f !important;
    font-weight: 600;
}

.bke-btn-start:hover:not(:disabled) {
    background: #2d6a4f !important;
}

.bke-btn-stop {
    background: #4a1515 !important;
    color: #ff5252 !important;
    border-color: #6e2020 !important;
    font-weight: 600;
}

.bke-btn-stop:hover:not(:disabled) {
    background: #6e2020 !important;
}

.bke-btn-start:disabled,
.bke-btn-stop:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.bke-autoscan-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 1.2rem;
    font-size: 0.8rem;
    color: #5a6378;
    font-family: 'JetBrains Mono', monospace;
    padding-top: 0.6rem;
    border-top: 1px solid #1a2030;
}

.bke-autoscan-stats strong {
    color: #c8cdd8;
}

/* ── Key search ── */
.bke-key-search {
    background: #0d1220;
    border: 1px solid #1e2536;
    border-radius: 8px;
    padding: 0.8rem 1rem;
    margin-bottom: 1rem;
}

.bke-key-search > label {
    display: block;
    font-size: 0.7rem;
    color: #5a6378;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.4rem;
}

.bke-key-search-row {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

.bke-select {
    background: #161c2e;
    color: #c8cdd8;
    border: 1px solid #2a3350;
    border-radius: 6px;
    padding: 0.5rem 0.6rem;
    font-size: 0.8rem;
    cursor: pointer;
    min-width: 80px;
}

.bke-select:focus {
    outline: none;
    border-color: #f7931a;
}

#bke-key-input {
    flex: 1;
    background: #0a0e17;
    border: 1px solid #2a3350;
    border-radius: 6px;
    color: #6ea8fe;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.8rem;
    padding: 0.5rem 0.6rem;
}

#bke-key-input:focus {
    outline: none;
    border-color: #f7931a;
    box-shadow: 0 0 0 2px rgba(247, 147, 26, 0.15);
}

#bke-key-input::placeholder {
    color: #2a3350;
}

/* ── Key info box ── */
.bke-key-info {
    margin-top: 0.7rem;
    padding: 0.8rem 1rem;
    background: #0a0e17;
    border: 1px solid #1e2536;
    border-radius: 6px;
}

.bke-key-valid {
    color: #00e676;
    font-weight: 700;
    font-size: 0.9rem;
}

.bke-key-invalid {
    color: #ff5252;
    font-weight: 700;
    font-size: 0.9rem;
}

.bke-key-detail {
    margin-top: 0.35rem;
    font-size: 0.8rem;
    color: #7a8299;
}

.bke-key-detail span:first-child {
    color: #5a6378;
    font-weight: 600;
    min-width: 60px;
    display: inline-block;
}

.bke-key-detail code {
    font-family: 'JetBrains Mono', 'Consolas', monospace;
    color: #f7931a;
    font-size: 0.75rem;
    word-break: break-all;
}

.bke-key-detail a {
    color: #6ea8fe;
    text-decoration: none;
    font-family: 'JetBrains Mono', 'Consolas', monospace;
    font-size: 0.78rem;
}

.bke-key-detail a:hover {
    text-decoration: underline;
}

/* ── Highlighted row ── */
.bke-row-highlight {
    background: rgba(247, 147, 26, 0.1) !important;
    outline: 1px solid rgba(247, 147, 26, 0.4);
}

.bke-row-highlight td {
    border-bottom-color: rgba(247, 147, 26, 0.2) !important;
}

.bke-row-highlight .bke-col-key code {
    color: #f7931a !important;
    font-weight: 700;
}

/* ── Status bar ── */
.bke-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #0d1220;
    border: 1px solid #1e2536;
    border-radius: 6px;
    padding: 0.5rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.8rem;
    color: #5a6378;
    font-family: 'JetBrains Mono', monospace;
}

/* ── Keys table ── */
.bke-table-wrap {
    overflow-x: auto;
    margin-bottom: 2rem;
    border-radius: 8px;
    border: 1px solid #1e2536;
}

.bke-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.bke-table thead {
    background: #111827;
}

.bke-table th {
    padding: 0.7rem 0.8rem;
    text-align: left;
    color: #5a6378;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid #1e2536;
    white-space: nowrap;
}

.bke-table td {
    padding: 0.45rem 0.8rem;
    border-bottom: 1px solid #131a2a;
    vertical-align: middle;
}

.bke-table tbody tr:hover {
    background: #111827;
}

.bke-col-num {
    color: #3d4f7a;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    white-space: nowrap;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bke-col-key code {
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    color: #8892a8;
    font-size: 0.72rem;
    word-break: break-all;
}

.bke-col-addr a {
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    color: #6ea8fe;
    text-decoration: none;
    font-size: 0.78rem;
}

.bke-col-addr a:hover {
    color: #8ec2ff;
    text-decoration: underline;
}

.bke-col-balance {
    font-family: 'JetBrains Mono', monospace;
    text-align: right;
    white-space: nowrap;
    color: #4a5568;
    font-size: 0.8rem;
}

.bke-balance-loading {
    color: #2a3350;
    animation: bke-pulse 1.5s ease-in-out infinite;
}

@keyframes bke-pulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.8; }
}

/* Balance states */
.bke-has-balance {
    color: #00e676 !important;
    font-weight: 700;
    text-shadow: 0 0 8px rgba(0, 230, 118, 0.3);
}

.bke-was-used {
    color: #7a8299 !important;
}

.bke-row-funded {
    background: rgba(0, 230, 118, 0.05) !important;
}

.bke-row-funded td {
    border-bottom-color: rgba(0, 230, 118, 0.15) !important;
}

.bke-row-used {
    background: rgba(122, 130, 153, 0.03);
}

/* ── Find alert banner ── */
.bke-find-banner {
    background: linear-gradient(135deg, #1b4332, #0d2818);
    border: 2px solid #00e676;
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    animation: bke-find-glow 2s ease-in-out infinite;
}

@keyframes bke-find-glow {
    0%, 100% { box-shadow: 0 0 10px rgba(0, 230, 118, 0.2); }
    50% { box-shadow: 0 0 25px rgba(0, 230, 118, 0.4); }
}

.bke-find-banner-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: #00e676;
    margin-bottom: 1rem;
    text-align: center;
}

.bke-find-banner-item {
    background: rgba(0, 230, 118, 0.05);
    border: 1px solid rgba(0, 230, 118, 0.15);
    border-radius: 6px;
    padding: 0.8rem;
    margin-bottom: 0.6rem;
}

.bke-find-banner-row {
    font-size: 0.85rem;
    color: #c8cdd8;
    margin-bottom: 0.3rem;
}

.bke-find-banner-row span:first-child {
    color: #5a6378;
    font-weight: 600;
    min-width: 90px;
    display: inline-block;
}

.bke-find-banner-row code {
    font-family: 'JetBrains Mono', monospace;
    color: #f7931a;
    font-size: 0.75rem;
    word-break: break-all;
}

.bke-find-banner-row a {
    color: #6ea8fe;
    text-decoration: none;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
}

.bke-find-banner-row strong {
    color: #00e676;
    font-size: 1.1rem;
}

.bke-find-banner-note {
    font-size: 0.8rem;
    color: #7a8299;
    margin-top: 0.6rem;
    text-align: center;
}

/* ── Info section ── */
.bke-info-section {
    margin-bottom: 2rem;
}

.bke-info-section h2 {
    color: #fff;
    font-size: 1.2rem;
    margin: 0 0 1rem;
}

.bke-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.bke-info-card {
    background: #0d1220;
    border: 1px solid #1e2536;
    border-radius: 8px;
    padding: 1.2rem;
}

.bke-info-card h3 {
    color: #f7931a;
    font-size: 0.9rem;
    margin: 0 0 0.5rem;
}

.bke-info-card p {
    font-size: 0.85rem;
    margin: 0;
    line-height: 1.5;
    color: #7a8299;
}

/* ── Stats ── */
.bke-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    padding-top: 1.5rem;
    border-top: 1px solid #1e2536;
}

.bke-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
}

.bke-stat-label {
    font-size: 0.7rem;
    color: #5a6378;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.bke-stat-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: #f7931a;
}

/* ── Mobile responsive ── */
@media (max-width: 768px) {
    #bke-app {
        padding: 1rem 0.75rem;
    }

    .bke-title {
        font-size: 1.2rem;
    }

    .bke-nav {
        gap: 0.4rem;
    }

    #bke-page-input {
        width: 120px;
    }

    .bke-table {
        font-size: 0.7rem;
    }

    .bke-col-key code {
        font-size: 0.6rem;
    }

    .bke-info-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .bke-col-key {
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}
