/* UTF-8 Encoder/Decoder Tool Styles */

/* Matrix Canvas - Full Background */
#matrix,
#matrix-snow {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

.tool-header {
    text-align: center;
    margin-bottom: 2rem;
}

.tool-subtitle {
    color: #00ff41;
    font-size: 1.1rem;
    margin-top: 0.5rem;
    opacity: 0.9;
}

/* Mode Selector */
.mode-selector {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 2rem;
}

.mode-btn {
    padding: 0.75rem 1.5rem;
    background: rgba(0, 255, 65, 0.1);
    border: 2px solid #00ff41;
    color: #00ff41;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

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

.mode-btn.active {
    background: rgba(0, 255, 65, 0.3);
    box-shadow: 0 0 20px rgba(0, 255, 65, 0.6);
    font-weight: bold;
}

.mode-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 255, 65, 0.3), transparent);
    transition: left 0.5s;
}

.mode-btn:hover::before {
    left: 100%;
}

/* Mode Panels */
.mode-panel {
    display: none;
}

.mode-panel.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.mode-help {
    background: rgba(0, 255, 65, 0.1);
    border-left: 4px solid #00ff41;
    padding: 1rem;
    margin-bottom: 1.5rem;
    color: #00ff41;
    border-radius: 4px;
    font-size: 0.95rem;
}

.mode-help strong {
    color: #00ff65;
    font-size: 1.05rem;
}

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

/* Input and Output Sections */
.input-section,
.output-section {
    margin-bottom: 1.5rem;
}

.input-section label,
.output-section label {
    display: block;
    color: #00ff41;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

.tool-textarea {
    width: 100%;
    min-height: 150px;
    padding: 1rem;
    background: rgba(0, 20, 0, 0.8);
    border: 2px solid #00ff41;
    color: #00ff41;
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    resize: vertical;
    transition: all 0.3s ease;
}

.tool-textarea:focus {
    outline: none;
    box-shadow: 0 0 15px rgba(0, 255, 65, 0.5);
    border-color: #00ff65;
}

.tool-textarea::placeholder {
    color: rgba(0, 255, 65, 0.4);
}

.tool-textarea:read-only {
    background: rgba(0, 20, 0, 0.6);
    cursor: default;
}

/* Encoding/Decoding Options */
.encoding-options,
.decoding-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: rgba(0, 255, 65, 0.05);
    border: 1px solid rgba(0, 255, 65, 0.2);
    border-radius: 4px;
}

.option-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #00ff41;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0.5rem;
}

.option-label:hover {
    background: rgba(0, 255, 65, 0.1);
    border-radius: 4px;
}

.option-label input[type="radio"] {
    cursor: pointer;
    accent-color: #00ff41;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.action-btn {
    padding: 0.75rem 2rem;
    border: 2px solid #00ff41;
    background: rgba(0, 255, 65, 0.1);
    color: #00ff41;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.action-btn.primary {
    background: rgba(0, 255, 65, 0.2);
}

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

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

.action-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(0, 255, 65, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.action-btn:active::after {
    width: 300px;
    height: 300px;
}

/* Copy Button */
.copy-btn {
    margin-top: 0.5rem;
    padding: 0.5rem 1.5rem;
    background: rgba(0, 255, 65, 0.1);
    border: 1px solid #00ff41;
    color: #00ff41;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.copy-btn.copied {
    background: rgba(0, 255, 65, 0.3);
    border-color: #00ff65;
}

/* Analysis Section */
.analysis-section {
    margin-top: 1.5rem;
    padding: 1rem;
    background: rgba(0, 255, 65, 0.05);
    border: 1px solid rgba(0, 255, 65, 0.3);
    border-radius: 4px;
    display: none;
}

.analysis-section.active {
    display: block;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 500px;
    }
}

.analysis-section h3 {
    color: #00ff41;
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

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

.analysis-item {
    padding: 0.75rem;
    background: rgba(0, 20, 0, 0.5);
    border: 1px solid rgba(0, 255, 65, 0.2);
    border-radius: 4px;
}

.analysis-item .label {
    color: rgba(0, 255, 65, 0.7);
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.analysis-item .value {
    color: #00ff41;
    font-size: 1.1rem;
    font-weight: bold;
    font-family: 'Courier New', monospace;
}

.byte-breakdown {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(0, 20, 0, 0.5);
    border: 1px solid rgba(0, 255, 65, 0.2);
    border-radius: 4px;
}

.byte-breakdown h4 {
    color: #00ff41;
    margin-top: 0;
    margin-bottom: 0.75rem;
}

.byte-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.byte-item {
    padding: 0.5rem;
    background: rgba(0, 255, 65, 0.1);
    border: 1px solid rgba(0, 255, 65, 0.3);
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

.byte-item .char {
    color: #00ff41;
    font-weight: bold;
    margin-right: 0.5rem;
}

.byte-item .bytes {
    color: rgba(0, 255, 65, 0.8);
}

/* Info Section */
.info-section {
    margin-top: 3rem;
    padding: 2rem;
    background: rgba(0, 255, 65, 0.05);
    border: 1px solid rgba(0, 255, 65, 0.2);
    border-radius: 4px;
}

.info-section h2 {
    color: #00ff41;
    margin-top: 0;
    margin-bottom: 1.5rem;
    text-align: center;
    font-size: 1.8rem;
}

.info-section h3 {
    color: #00ff41;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    font-size: 1.3rem;
}

.info-section h4 {
    color: #00ff41;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.info-content p {
    color: rgba(0, 255, 65, 0.9);
    line-height: 1.8;
    margin-bottom: 1rem;
}

.info-content ol {
    color: rgba(0, 255, 65, 0.9);
    line-height: 1.8;
    margin-left: 1.5rem;
    margin-bottom: 1.5rem;
}

.info-content ol li {
    margin-bottom: 0.75rem;
}

.info-content ul {
    color: rgba(0, 255, 65, 0.9);
    line-height: 1.8;
    margin-left: 1.5rem;
}

.info-content li {
    margin-bottom: 0.5rem;
}

.info-content strong {
    color: #00ff41;
}

/* Example Boxes */
.mode-distinction {
    margin-bottom: 2rem;
}

.distinction-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-top: 1rem;
}

.distinction-box {
    background: rgba(0, 20, 0, 0.6);
    border: 2px solid rgba(0, 255, 65, 0.3);
    padding: 1.5rem;
    border-radius: 4px;
}

.distinction-box.encode-box {
    border-left: 6px solid #00ff41;
}

.distinction-box.decode-box {
    border-left: 6px solid #00ccff;
}

.distinction-box h4 {
    margin-top: 0;
    color: #00ff65;
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

.distinction-box p {
    margin: 0.5rem 0;
    font-family: 'Courier New', monospace;
    color: rgba(0, 255, 65, 0.95);
    line-height: 1.6;
}

.distinction-box p strong {
    color: #00ff41;
    font-weight: bold;
}

.example-box {
    background: rgba(0, 20, 0, 0.6);
    border: 1px solid rgba(0, 255, 65, 0.3);
    border-left: 4px solid #00ff41;
    padding: 1.25rem;
    margin: 1.5rem 0;
    border-radius: 4px;
}

.example-box h4 {
    margin-top: 0;
    color: #00ff65;
    font-size: 1.1rem;
}

.example-box p {
    margin: 0.75rem 0;
    font-family: 'Courier New', monospace;
    color: rgba(0, 255, 65, 0.95);
}

.example-box p strong {
    color: #00ff41;
    font-weight: bold;
    display: inline-block;
    min-width: 120px;
}

@media (max-width: 768px) {
    .distinction-grid {
        grid-template-columns: 1fr;
    }
}

/* Navigation Links */
.navigation-links {
    margin-top: 2rem;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.nav-link {
    padding: 0.75rem 1.5rem;
    background: rgba(0, 255, 65, 0.1);
    border: 1px solid #00ff41;
    color: #00ff41;
    text-decoration: none;
    transition: all 0.3s ease;
}

.nav-link:hover {
    background: rgba(0, 255, 65, 0.2);
    box-shadow: 0 0 15px rgba(0, 255, 65, 0.4);
    transform: translateY(-2px);
}

/* Error Messages */
.error-message {
    padding: 1rem;
    background: rgba(255, 0, 0, 0.1);
    border: 1px solid rgba(255, 0, 0, 0.5);
    color: #ff6b6b;
    border-radius: 4px;
    margin-top: 1rem;
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.success-message {
    padding: 1rem;
    background: rgba(0, 255, 65, 0.1);
    border: 1px solid rgba(0, 255, 65, 0.5);
    color: #00ff41;
    border-radius: 4px;
    margin-top: 1rem;
    animation: fadeIn 0.3s;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .mode-selector {
        flex-direction: column;
    }
    
    .mode-btn {
        width: 100%;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .action-btn {
        width: 100%;
    }
    
    .encoding-options,
    .decoding-options {
        grid-template-columns: 1fr;
    }
    
    .navigation-links {
        flex-direction: column;
    }
    
    .nav-link {
        text-align: center;
    }
}

/* Dark mode enhancements */
@media (prefers-color-scheme: dark) {
    .tool-textarea {
        background: rgba(0, 10, 0, 0.9);
    }
    
    .analysis-section {
        background: rgba(0, 20, 0, 0.8);
    }
}