/* =====================================================
   0G Storage - Architecture Cards
   ===================================================== */

/* ==================== Architecture Grid ==================== */
.architecture-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-8);
}

.architecture-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-2xl);
    padding: var(--space-8);
    position: relative;
    overflow: hidden;
    transition: var(--transition-normal);
}

.architecture-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
}

.architecture-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
    border-color: var(--color-purple-300);
}

.architecture-card-header {
    display: flex;
    align-items: flex-start;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
}

.architecture-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: var(--gradient-primary);
    color: var(--text-inverse);
    border-radius: var(--radius-xl);
    font-size: var(--text-2xl);
    flex-shrink: 0;
}

.architecture-label .label-tag {
    margin-bottom: var(--space-2);
}

.architecture-label h3 {
    font-size: var(--text-2xl);
    margin: 0;
}

.architecture-desc {
    font-size: var(--text-base);
    color: var(--text-secondary);
    line-height: var(--leading-relaxed);
    margin-bottom: var(--space-6);
}

.architecture-features {
    list-style: none;
    margin-bottom: var(--space-6);
}

.architecture-features li {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-4) 0;
    border-top: 1px solid var(--border-light);
}

.architecture-features li:last-child {
    border-bottom: 1px solid var(--border-light);
}

.architecture-features li i {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-purple-700);
    font-size: var(--text-base);
}

.architecture-features li div {
    flex: 1;
}

.architecture-features li strong {
    display: block;
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    margin-bottom: var(--space-1);
}

.architecture-features li span {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

/* ==================== Architecture Visual - Log Stream ==================== */
.architecture-visual {
    background: var(--color-gray-900);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    overflow: hidden;
    position: relative;
}

/* Log Layer - Terminal Style Visualization */
.log-stream {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    font-family: var(--font-mono);
    font-size: 10px;
    position: relative;
}

/* Data Particle Stream - Top Layer */
.log-stream::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg,
        transparent 0%,
        var(--color-purple-500) 20%,
        var(--color-purple-300) 40%,
        var(--color-purple-500) 60%,
        var(--color-purple-300) 80%,
        transparent 100%
    );
    background-size: 200% 100%;
    animation: data-stream 1s linear infinite;
    box-shadow: 0 0 8px var(--color-purple-500), 0 0 16px var(--color-purple-700);
}

@keyframes data-stream {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Throughput Indicator */
.throughput-bar {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) 0;
    margin-bottom: var(--space-2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.throughput-label {
    color: var(--color-gray-500);
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.throughput-meter {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.throughput-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 85%;
    background: linear-gradient(90deg, var(--color-purple-700), var(--color-purple-500));
    border-radius: 2px;
    animation: throughput-pulse 2s ease-in-out infinite;
}

.throughput-fill::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    width: 20px;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4));
    animation: throughput-shine 1.5s ease-in-out infinite;
}

@keyframes throughput-pulse {
    0%, 100% { width: 82%; opacity: 0.9; }
    50% { width: 88%; opacity: 1; }
}

@keyframes throughput-shine {
    0%, 100% { transform: translateX(-20px); opacity: 0; }
    50% { transform: translateX(0); opacity: 1; }
}

.throughput-value {
    color: var(--color-purple-400);
    font-weight: 600;
    font-size: 9px;
    white-space: nowrap;
}

/* Log Entries */
.log-entries {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.log-entry {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: 3px 6px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 3px;
    border-left: 2px solid transparent;
    animation: log-entry-appear 0.3s ease-out forwards;
    opacity: 0;
    transform: translateX(-10px);
}

.log-entry:nth-child(1) { animation-delay: 0s; border-left-color: var(--color-purple-500); }
.log-entry:nth-child(2) { animation-delay: 0.6s; border-left-color: var(--color-purple-500); }
.log-entry:nth-child(3) { animation-delay: 1.2s; border-left-color: var(--color-purple-500); }
.log-entry:nth-child(4) { animation-delay: 1.8s; border-left-color: var(--color-purple-400); }
.log-entry.writing {
    border-left-color: var(--color-success);
    background: rgba(34, 197, 94, 0.1);
}

@keyframes log-entry-appear {
    0% { opacity: 0; transform: translateX(-10px); }
    100% { opacity: 1; transform: translateX(0); }
}

/* Continuous animation loop */
.log-entry {
    animation: log-entry-appear 0.3s ease-out forwards, log-entry-cycle 2.4s ease-in-out infinite;
}

.log-entry:nth-child(1) { animation-delay: 0s, 0s; }
.log-entry:nth-child(2) { animation-delay: 0s, 0.6s; }
.log-entry:nth-child(3) { animation-delay: 0s, 1.2s; }
.log-entry:nth-child(4) { animation-delay: 0s, 1.8s; }

@keyframes log-entry-cycle {
    0%, 20% { opacity: 1; transform: translateX(0); }
    25% { opacity: 0; transform: translateX(10px); }
    30%, 100% { opacity: 1; transform: translateX(0); }
}

.log-timestamp {
    color: var(--color-gray-500);
    font-size: 9px;
    min-width: 45px;
}

.log-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    font-size: 8px;
}

.log-status.committed {
    background: var(--color-purple-900);
    color: var(--color-purple-300);
}

.log-status.writing {
    background: var(--color-success);
    color: white;
    animation: status-blink 0.8s ease-in-out infinite;
}

@keyframes status-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.log-hash {
    color: var(--color-gray-400);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.log-size {
    color: var(--color-purple-400);
    font-size: 9px;
    min-width: 35px;
    text-align: right;
}

/* Block visualization at bottom */
.log-blocks {
    display: flex;
    gap: 4px;
    margin-top: var(--space-2);
    padding-top: var(--space-2);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.log-block {
    flex: 1;
    height: 24px;
    background: linear-gradient(180deg,
        rgba(146, 0, 225, 0.3) 0%,
        rgba(146, 0, 225, 0.1) 100%
    );
    border: 1px solid var(--color-purple-700);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

.log-block::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--gradient-primary);
    animation: block-fill 2.4s ease-out infinite;
}

.log-block:nth-child(1)::before { height: 100%; animation: none; }
.log-block:nth-child(2)::before { height: 100%; animation: none; }
.log-block:nth-child(3)::before { height: 100%; animation: none; }
.log-block:nth-child(4)::before { animation-delay: 0s; }
.log-block:nth-child(5)::before { height: 0; animation: none; }

@keyframes block-fill {
    0% { height: 0%; }
    80% { height: 100%; }
    100% { height: 100%; }
}

/* Committed blocks have checkmark */
.log-block.committed::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23E3C1FF' stroke-width='3'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E") center/contain no-repeat;
}

.log-block.writing {
    border-color: var(--color-success);
    animation: writing-glow 1s ease-in-out infinite;
}

@keyframes writing-glow {
    0%, 100% { box-shadow: 0 0 0 rgba(34, 197, 94, 0); }
    50% { box-shadow: 0 0 8px rgba(34, 197, 94, 0.5); }
}

.log-block.empty {
    background: rgba(255, 255, 255, 0.02);
    border-style: dashed;
    border-color: rgba(255, 255, 255, 0.1);
}

/* ==================== Architecture Visual - KV Store ==================== */
.kv-store {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    font-family: var(--font-mono);
    font-size: 10px;
}

/* Header row */
.kv-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: var(--space-2);
    margin-bottom: var(--space-2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.kv-header-label {
    color: var(--color-gray-500);
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.kv-header-count {
    color: var(--color-purple-400);
    font-size: 9px;
}

.kv-entries {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.kv-pair {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: 4px 6px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 4px;
    border-left: 2px solid var(--color-purple-700);
    transition: all 0.2s ease;
}

.kv-pair:hover {
    background: rgba(255, 255, 255, 0.06);
}

.kv-key {
    padding: 2px 6px;
    background: rgba(146, 0, 225, 0.3);
    color: var(--color-purple-300);
    border-radius: 3px;
    font-weight: 500;
    font-size: 9px;
    min-width: 50px;
}

.kv-arrow {
    color: var(--color-gray-600);
    font-size: 10px;
}

.kv-value {
    padding: 2px 6px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    color: var(--color-gray-400);
    flex: 1;
    font-size: 9px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kv-action {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 3px;
    font-size: 8px;
}

.kv-action.read {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

.kv-action.write {
    background: rgba(34, 197, 94, 0.2);
    color: var(--color-success);
    animation: kv-write-pulse 1s ease-in-out infinite;
}

@keyframes kv-write-pulse {
    0%, 100% { opacity: 0.7; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.1); }
}

.kv-pair.updating {
    border-left-color: var(--color-success);
    background: rgba(34, 197, 94, 0.08);
}

.kv-pair.updating .kv-value {
    color: var(--color-success);
    border-color: rgba(34, 197, 94, 0.3);
    animation: kv-value-update 0.8s ease-in-out infinite;
}

@keyframes kv-value-update {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

/* Activity indicator */
.kv-activity {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-top: var(--space-2);
    padding-top: var(--space-2);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.kv-activity-dot {
    width: 6px;
    height: 6px;
    background: var(--color-success);
    border-radius: 50%;
    animation: activity-blink 1s ease-in-out infinite;
}

@keyframes activity-blink {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 rgba(34, 197, 94, 0); }
    50% { opacity: 0.5; box-shadow: 0 0 6px rgba(34, 197, 94, 0.5); }
}

.kv-activity-text {
    color: var(--color-gray-500);
    font-size: 9px;
}

.kv-activity-ops {
    color: var(--color-purple-400);
    font-size: 9px;
    margin-left: auto;
}

/* ==================== Responsive ==================== */
@media (max-width: 1024px) {
    .architecture-grid {
        grid-template-columns: 1fr;
        max-width: 600px;
        margin: 0 auto;
    }
}

@media (max-width: 640px) {
    .architecture-card {
        padding: var(--space-6);
    }

    .architecture-card-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .architecture-label {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .architecture-desc {
        text-align: center;
    }
}
