/**
 * Blockchain Common CSS
 * Shared styles for all blockchain tools
 */

/* Visualizer Container - Used by all tools */
.visualizer-container {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    box-sizing: border-box;
    width: 100%;
    overflow-x: hidden;
}

/* Block Card Styling */
.block-card {
    background: rgba(0, 20, 40, 0.95);
    border: 1px solid #00ffff;
    border-radius: 8px;
    padding: 20px;
    margin: 15px 0;
    position: relative;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    box-sizing: border-box;
}

.block-card:hover {
    border-color: #00ff88;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
    transform: translateY(-2px);
}

.block-card.invalid {
    border-color: #ff3333;
    background: rgba(40, 0, 0, 0.8);
}

.block-card.invalid:hover {
    box-shadow: 0 0 20px rgba(255, 51, 51, 0.3);
}

.block-card.mining {
    border-color: #ffd700;
    animation: mining-pulse 1s ease-in-out infinite;
}

@keyframes mining-pulse {
    0%, 100% {
        box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
    }
    50% {
        box-shadow: 0 0 30px rgba(255, 215, 0, 0.6);
    }
}

/* Block Header */
.block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(0, 255, 255, 0.2);
    flex-wrap: wrap;
    gap: 10px;
}

.block-index {
    font-size: 1.2em;
    font-weight: bold;
    color: #00ffff;
    font-family: 'Courier New', monospace;
}

.block-timestamp {
    font-size: 0.9em;
    color: #00ff88;
    font-family: 'Courier New', monospace;
}

/* Hash Display */
.hash-display {
    font-family: 'Courier New', monospace;
    font-size: 0.85em;
    word-break: break-all;
    padding: 10px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 4px;
    border-left: 3px solid #00ffff;
    margin: 8px 0;
    position: relative;
    box-sizing: border-box;
}

.hash-display.valid {
    border-left-color: #00ff88;
    color: #00ff88;
}

.hash-display.invalid {
    border-left-color: #ff3333;
    color: #ff3333;
}

.hash-display.mining {
    border-left-color: #ffd700;
    color: #ffd700;
}

.hash-label {
    font-size: 0.8em;
    color: #00ffff;
    text-transform: uppercase;
    margin-bottom: 5px;
    display: block;
}

.hash-value {
    color: #ffffff;
    word-break: break-all;
}

/* Copy button for hashes */
.hash-copy-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 255, 255, 0.1);
    border: 1px solid #00ffff;
    color: #00ffff;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8em;
    transition: all 0.2s ease;
}

.hash-copy-btn:hover {
    background: rgba(0, 255, 255, 0.3);
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

/* Block Data Display */
.block-data {
    margin: 10px 0;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    box-sizing: border-box;
}

.block-data-label {
    font-size: 0.8em;
    color: #00ffff;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.block-data-value {
    color: #ffffff;
    font-family: 'Courier New', monospace;
    word-break: break-all;
}

/* Nonce Display */
.nonce-display {
    display: inline-block;
    padding: 5px 10px;
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid #ffd700;
    border-radius: 4px;
    color: #ffd700;
    font-family: 'Courier New', monospace;
    font-weight: bold;
}

/* Chain Connection Visualization */
.chain-connector {
    position: relative;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chain-connector::before {
    content: '⛓️';
    font-size: 1.5em;
    opacity: 0.5;
}

.chain-connector.valid::before {
    opacity: 1;
    filter: drop-shadow(0 0 5px #00ffff);
}

.chain-connector.invalid::before {
    content: '❌';
    filter: drop-shadow(0 0 5px #ff3333);
}

/* Blockchain Control Panel */
.blockchain-controls {
    background: rgba(0, 20, 40, 0.95);
    border: 1px solid #00ffff;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    backdrop-filter: blur(10px);
    box-sizing: border-box;
}

.control-group {
    margin: 15px 0;
    box-sizing: border-box;
}

.control-group label {
    display: block;
    color: #00ffff;
    margin-bottom: 8px;
    font-size: 0.9em;
    text-transform: uppercase;
}

.control-group input,
.control-group textarea,
.control-group select {
    width: 100%;
    padding: 10px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid #00ffff;
    border-radius: 4px;
    color: #ffffff;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    box-sizing: border-box;
}

.control-group input:focus,
.control-group textarea:focus,
.control-group select:focus {
    outline: none;
    border-color: #00ff88;
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.3);
}

/* Blockchain Action Buttons */
.blockchain-btn {
    padding: 10px 20px;
    background: rgba(0, 255, 255, 0.1);
    border: 1px solid #00ffff;
    border-radius: 4px;
    color: #00ffff;
    cursor: pointer;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    transition: all 0.3s ease;
    margin: 5px;
    box-sizing: border-box;
}

.blockchain-btn:hover {
    background: rgba(0, 255, 255, 0.3);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.5);
    transform: translateY(-2px);
}

.blockchain-btn:active {
    transform: translateY(0);
}

.blockchain-btn.primary {
    background: rgba(0, 255, 136, 0.2);
    border-color: #00ff88;
    color: #00ff88;
}

.blockchain-btn.primary:hover {
    background: rgba(0, 255, 136, 0.4);
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.5);
}

.blockchain-btn.danger {
    background: rgba(255, 51, 51, 0.2);
    border-color: #ff3333;
    color: #ff3333;
}

.blockchain-btn.danger:hover {
    background: rgba(255, 51, 51, 0.4);
    box-shadow: 0 0 15px rgba(255, 51, 51, 0.5);
}

.blockchain-btn.mining {
    background: rgba(255, 215, 0, 0.2);
    border-color: #ffd700;
    color: #ffd700;
}

.blockchain-btn.mining:hover {
    background: rgba(255, 215, 0, 0.4);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
}

.blockchain-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.blockchain-btn:disabled:hover {
    background: rgba(0, 255, 255, 0.1);
    box-shadow: none;
    transform: none;
}

/* Statistics Display */
.blockchain-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin: 20px 0;
    box-sizing: border-box;
}

.stat-card {
    background: rgba(0, 20, 40, 0.6);
    border: 1px solid #00ffff;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    box-sizing: border-box;
}

.stat-label {
    font-size: 0.8em;
    color: #00ffff;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 1.5em;
    color: #00ff88;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    word-break: break-word;
}

/* Chain Visualization Container */
.chain-container {
    position: relative;
    padding: 20px 0;
    overflow-x: auto;
    overflow-y: visible;
    background: rgba(0, 10, 20, 0.95);
    border-radius: 8px;
    backdrop-filter: blur(10px);
    scroll-behavior: smooth;
    scroll-padding: 20px;
    box-sizing: border-box;
    width: 100%;
}

.chain-scroll {
    display: flex;
    gap: 30px;
    padding: 20px;
    min-width: min-content;
    width: fit-content;
}

/* Scrollbar Styling - Cyan Theme */
.chain-container::-webkit-scrollbar,
.chain-scroll::-webkit-scrollbar {
    height: 12px;
}

.chain-container::-webkit-scrollbar-track,
.chain-scroll::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.5);
    border-radius: 6px;
    margin: 0 10px;
}

.chain-container::-webkit-scrollbar-thumb,
.chain-scroll::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 255, 0.6);
    border-radius: 6px;
    border: 2px solid rgba(0, 0, 0, 0.3);
}

.chain-container::-webkit-scrollbar-thumb:hover,
.chain-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 255, 255, 0.9);
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

/* Loading Animation */
.blockchain-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #00ffff;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Difficulty Indicator */
.difficulty-indicator {
    display: flex;
    gap: 5px;
    align-items: center;
}

.difficulty-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.difficulty-dot.active {
    background: #ffd700;
    box-shadow: 0 0 10px #ffd700;
}

/* Responsive Design */
@media (max-width: 768px) {
    .visualizer-container {
        padding: 10px;
    }

    .block-card {
        padding: 15px;
    }

    .hash-display {
        font-size: 0.75em;
        padding: 8px;
        padding-right: 40px;
    }

    .hash-copy-btn {
        position: static;
        transform: none;
        width: 100%;
        margin-top: 8px;
    }

    .blockchain-stats {
        grid-template-columns: 1fr;
    }

    .chain-scroll {
        gap: 15px;
    }

    .blockchain-btn {
        width: 100%;
        margin: 5px 0;
    }
    
    .block-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Small mobile devices */
@media (max-width: 480px) {
    .block-card {
        padding: 12px;
    }
    
    .hash-display {
        font-size: 0.7em;
        padding: 6px;
    }
    
    .stat-card {
        padding: 12px;
    }
    
    .stat-value {
        font-size: 1.2em;
    }
    
    .blockchain-stats {
        gap: 10px;
    }
}