/* XOR Cipher Tool - Matrix Theme Styles */

/* Format Selector */
.format-selector {
    margin: 1.5rem 0;
}

.format-selector label {
    display: block;
    color: #00ff00;
    margin-bottom: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.format-buttons {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.format-btn {
    padding: 0.5rem 1.5rem;
    background: rgba(0, 255, 0, 0.1);
    border: 1px solid #00ff00;
    color: #00ff00;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
}

.format-btn:hover {
    background: rgba(0, 255, 0, 0.2);
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.5);
}

.format-btn.active {
    background: #00ff00;
    color: #000;
    font-weight: bold;
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.8);
}

/* Key Info */
.key-info {
    display: block;
    margin-top: 0.5rem;
    color: rgba(0, 255, 0, 0.7);
    font-size: 0.85rem;
    font-style: italic;
}

/* XOR Properties Box */
.xor-properties {
    background: rgba(0, 255, 0, 0.05);
    border: 1px solid #00ff00;
    border-radius: 5px;
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.xor-properties h3 {
    color: #00ff00;
    margin-top: 0;
    margin-bottom: 1rem;
}

.xor-properties ul {
    margin: 0;
    padding-left: 1.5rem;
}

.xor-properties li {
    margin: 0.75rem 0;
    color: #00ff00;
}

/* XOR Truth Table */
.xor-table {
    width: 100%;
    max-width: 300px;
    margin: 1rem 0;
    border-collapse: collapse;
    background: rgba(0, 0, 0, 0.5);
}

.xor-table th,
.xor-table td {
    border: 1px solid #00ff00;
    padding: 0.75rem;
    text-align: center;
    color: #00ff00;
    font-family: 'Courier New', monospace;
}

.xor-table th {
    background: rgba(0, 255, 0, 0.2);
    font-weight: bold;
    text-transform: uppercase;
}

.xor-table tr:hover {
    background: rgba(0, 255, 0, 0.1);
}

/* Operation Display */
.operation-display {
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid #00ff00;
    border-radius: 5px;
    padding: 1.5rem;
    margin-top: 1.5rem;
    max-height: 500px;
    overflow-y: auto;
}

.operation-display h3 {
    color: #00ff00;
    margin-top: 0;
    margin-bottom: 1rem;
}

#operation-steps {
    font-family: 'Courier New', monospace;
}

.operation-step {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: rgba(0, 255, 0, 0.05);
    border-left: 3px solid #00ff00;
}

.operation-step:last-child {
    margin-bottom: 0;
}

.step-header {
    color: #00ff00;
    font-weight: bold;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.step-index {
    background: rgba(0, 255, 0, 0.2);
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    font-size: 0.85rem;
}

.step-content {
    display: grid;
    gap: 0.25rem;
    font-size: 0.9rem;
}

.step-line {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 1rem;
    padding: 0.25rem 0;
}

.step-label {
    color: rgba(0, 255, 0, 0.7);
    text-align: right;
}

.step-value {
    color: #00ff00;
    font-weight: bold;
}

.binary-display {
    font-family: 'Courier New', monospace;
    letter-spacing: 2px;
}

/* Key Candidates Display */
#key-candidates {
    margin-top: 1rem;
}

.key-candidate {
    background: rgba(0, 255, 0, 0.05);
    border: 1px solid #00ff00;
    border-radius: 5px;
    padding: 1rem;
    margin-bottom: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.key-candidate:hover {
    background: rgba(0, 255, 0, 0.1);
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.5);
    transform: translateX(5px);
}

.candidate-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.candidate-key {
    color: #00ff00;
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    font-weight: bold;
}

.candidate-score {
    background: rgba(0, 255, 0, 0.2);
    padding: 0.25rem 0.75rem;
    border-radius: 3px;
    color: #00ff00;
    font-size: 0.85rem;
}

.candidate-preview {
    color: rgba(0, 255, 0, 0.8);
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 3px;
    margin-top: 0.5rem;
    word-break: break-all;
}

.candidate-actions {
    margin-top: 0.75rem;
    display: flex;
    gap: 0.5rem;
}

.candidate-btn {
    padding: 0.5rem 1rem;
    background: rgba(0, 255, 0, 0.1);
    border: 1px solid #00ff00;
    color: #00ff00;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

/* Code Example */
.code-example {
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid #00ff00;
    border-radius: 5px;
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.code-example h4 {
    color: #00ff00;
    margin-top: 0;
    margin-bottom: 1rem;
}

.code-example pre {
    color: #00ff00;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    margin: 0;
    overflow-x: auto;
}

/* Patterns Grid */
.patterns-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.pattern-card {
    background: rgba(0, 255, 0, 0.05);
    border: 1px solid #00ff00;
    border-radius: 5px;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.pattern-card:hover {
    background: rgba(0, 255, 0, 0.1);
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.3);
    transform: translateY(-5px);
}

.pattern-card h3 {
    color: #00ff00;
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1rem;
}

.pattern-card p {
    margin: 0.5rem 0;
    color: rgba(0, 255, 0, 0.9);
    font-size: 0.9rem;
}

.pattern-card strong {
    color: #00ff00;
}

/* Slider Container */
.slider-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1rem 0;
}

.slider-container input[type="range"] {
    flex: 1;
    height: 8px;
    background: rgba(0, 255, 0, 0.2);
    border-radius: 5px;
    outline: none;
    -webkit-appearance: none;
}

.slider-container input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: #00ff00;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.8);
    transition: all 0.3s ease;
}

.slider-container input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 20px rgba(0, 255, 0, 1);
}

.slider-container input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #00ff00;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.8);
    transition: all 0.3s ease;
}

.slider-container input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 20px rgba(0, 255, 0, 1);
}

.slider-container span {
    color: #00ff00;
    font-weight: bold;
    font-size: 1.2rem;
    min-width: 30px;
    text-align: center;
}

/* Mode Sections */
.mode-section {
    display: none;
}

.mode-section.active {
    display: block;
    animation: fadeIn 0.5s ease;
}

/* Checkbox Styling */
.checkbox-group {
    margin: 1.5rem 0;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    color: #00ff00;
    font-size: 1rem;
}

.checkbox-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #00ff00;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scrollbar Styling */
.operation-display::-webkit-scrollbar {
    width: 8px;
}

.operation-display::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.5);
}

.operation-display::-webkit-scrollbar-thumb {
    background: #00ff00;
    border-radius: 4px;
}

.operation-display::-webkit-scrollbar-thumb:hover {
    background: #00cc00;
}

/* Responsive Design */
@media (max-width: 768px) {
    .format-buttons {
        flex-direction: column;
    }
    
    .format-btn {
        width: 100%;
    }
    
    .patterns-grid {
        grid-template-columns: 1fr;
    }
    
    .step-line {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }
    
    .step-label {
        text-align: left;
    }
    
    .candidate-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .candidate-actions {
        flex-direction: column;
    }
    
    .candidate-btn {
        width: 100%;
    }
}

/* Print Styles */
@media print {
    .mode-selector,
    .button-group,
    .copy-btn,
    .candidate-actions {
        display: none;
    }
    
    .operation-display,
    #key-candidates {
        border: 2px solid #000;
        max-height: none;
    }
}