/**
 * Keyed Substitution Cipher Tool Styles
 * Public free tool - SEO friendly
 */

/* Base Styles */
body {
    margin: 0;
    padding: 0;
    font-family: 'Courier New', monospace;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 100%);
    color: #0f0;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* Matrix Canvas Background */
#matrix {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 0.3;
}

/* Matrix Controls */
#matrix-controls {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100;
    display: flex;
    gap: 10px;
}

.matrix-control-btn {
    background: rgba(0, 255, 65, 0.2);
    border: 2px solid #0f0;
    color: #0f0;
    padding: 10px;
    cursor: pointer;
    border-radius: 5px;
    font-size: 18px;
    transition: all 0.3s ease;
}

.matrix-control-btn:hover {
    background: rgba(0, 255, 65, 0.4);
    box-shadow: 0 0 15px rgba(0, 255, 65, 0.6);
}

/* Container */
.tool-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    z-index: 1;
}

/* Header */
.tool-header {
    text-align: center;
    margin-bottom: 30px;
    padding: 30px 20px;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid #0ff;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
}

.tool-header h1 {
    color: #0ff;
    font-size: 42px;
    margin: 0 0 10px 0;
    text-shadow: 0 0 10px #0ff, 0 0 20px #0ff;
}

.subtitle {
    color: #0f0;
    font-size: 16px;
    margin: 0;
}

/* Glitch Effect */
.glitch {
    position: relative;
    animation: glitch-skew 1s infinite;
}

@keyframes glitch-skew {
    0% { transform: skew(0deg); }
    10% { transform: skew(-2deg); }
    20% { transform: skew(2deg); }
    30% { transform: skew(0deg); }
    100% { transform: skew(0deg); }
}

/* Breadcrumb */
.breadcrumb {
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    font-size: 14px;
}

.breadcrumb a {
    color: #0ff;
    text-decoration: none;
    transition: color 0.3s ease;
}

.breadcrumb a:hover {
    color: #ffd700;
}

.breadcrumb span {
    color: #0f0;
}

/* Tool Box */
.tool-box {
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid #0ff;
    border-radius: 10px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.3);
}

/* Mode Toggle */
.mode-toggle {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 30px;
}

.mode-btn {
    flex: 1;
    max-width: 200px;
    padding: 15px;
    background: rgba(0, 255, 255, 0.1);
    border: 2px solid #0ff;
    color: #0ff;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-family: 'Courier New', monospace;
}

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

.mode-btn.active {
    background: rgba(0, 255, 255, 0.3);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.7);
}

/* Key Section */
.key-section {
    background: rgba(0, 255, 255, 0.05);
    border: 2px solid #0ff;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
}

.key-section h3 {
    color: #0ff;
    margin: 0 0 10px 0;
    font-size: 20px;
}

.instruction {
    color: #0f0;
    margin: 0 0 20px 0;
    font-size: 14px;
}

/* Input Groups */
.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    color: #0ff;
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 8px;
}

.key-input,
textarea {
    width: 100%;
    padding: 12px;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid #0ff;
    color: #0ff;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    border-radius: 6px;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.key-input {
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: bold;
}

textarea {
    resize: vertical;
    min-height: 100px;
}

.key-input:focus,
textarea:focus {
    outline: none;
    border-color: #ffd700;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
}

.key-info {
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(255, 215, 0, 0.1);
    border-left: 3px solid #ffd700;
    color: #ffd700;
    font-size: 12px;
    border-radius: 4px;
}

/* Generate Button */
.generate-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, rgba(0, 255, 255, 0.3), rgba(0, 200, 255, 0.4));
    border: 2px solid #0ff;
    color: #fff;
    font-size: 18px;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
    margin-top: 15px;
}

.generate-btn:hover {
    background: linear-gradient(135deg, rgba(0, 255, 255, 0.5), rgba(0, 200, 255, 0.6));
    box-shadow: 0 0 25px rgba(0, 255, 255, 0.7);
    transform: translateY(-2px);
}

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

/* Alphabet Section */
.alphabet-section {
    background: rgba(0, 255, 0, 0.05);
    border: 2px solid #0f0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
    display: none;
}

.alphabet-section.visible {
    display: block;
    animation: fadeIn 0.5s ease;
}

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

.alphabet-section h3 {
    color: #0f0;
    margin: 0 0 15px 0;
    font-size: 18px;
}

.alphabet-comparison {
    background: rgba(0, 0, 0, 0.5);
    padding: 20px;
    border-radius: 6px;
    margin-bottom: 15px;
}

.alphabet-row {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.alphabet-row:last-child {
    margin-bottom: 0;
}

.alphabet-label {
    color: #0ff;
    font-weight: bold;
    min-width: 80px;
    font-size: 14px;
}

.alphabet-display {
    flex: 1;
    padding: 10px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid #0ff;
    border-radius: 4px;
    color: #0ff;
    font-size: 14px;
    letter-spacing: 3px;
    text-align: center;
}

.alphabet-display.cipher {
    border-color: #0f0;
    color: #0f0;
    font-weight: bold;
}

.alphabet-arrow {
    text-align: center;
    font-size: 24px;
    color: #ffd700;
    margin: 10px 0;
}

.alphabet-explanation {
    color: #0f0;
    font-size: 13px;
    padding: 10px;
    background: rgba(0, 255, 0, 0.1);
    border-radius: 4px;
}

/* Process Button */
.process-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, rgba(0, 255, 0, 0.3), rgba(0, 200, 0, 0.4));
    border: 2px solid #0f0;
    color: #fff;
    font-size: 18px;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
    margin-bottom: 20px;
}

.process-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, rgba(0, 255, 0, 0.5), rgba(0, 200, 0, 0.6));
    box-shadow: 0 0 25px rgba(0, 255, 0, 0.7);
    transform: translateY(-2px);
}

.process-btn:active:not(:disabled) {
    transform: translateY(0);
}

.process-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Output Group */
.output-group {
    margin-bottom: 20px;
}

.output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.output-header label {
    color: #0f0;
    font-size: 14px;
    font-weight: bold;
}

.copy-btn {
    padding: 8px 16px;
    background: rgba(255, 215, 0, 0.2);
    border: 2px solid #ffd700;
    color: #ffd700;
    font-size: 14px;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    cursor: pointer;
    border-radius: 5px;
    transition: all 0.3s ease;
    display: none;
}

.copy-btn.visible {
    display: inline-block;
}

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

/* Toggle Section */
.toggle-section {
    margin-top: 20px;
    text-align: center;
}

.toggle-btn {
    padding: 12px 24px;
    background: rgba(255, 0, 255, 0.2);
    border: 2px solid #f0f;
    color: #f0f;
    font-size: 14px;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.3s ease;
}

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

/* Mapping Table */
.mapping-table-container {
    margin-top: 20px;
    padding: 20px;
    background: rgba(255, 0, 255, 0.05);
    border: 2px solid #f0f;
    border-radius: 8px;
    display: none;
}

.mapping-table-container.visible {
    display: block;
    animation: fadeIn 0.5s ease;
}

.mapping-table-container h4 {
    color: #f0f;
    margin: 0 0 15px 0;
    font-size: 16px;
}

.mapping-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 10px;
}

.mapping-item {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid #f0f;
    border-radius: 4px;
    padding: 10px;
    text-align: center;
}

.mapping-normal {
    color: #0ff;
    font-size: 18px;
    font-weight: bold;
    display: block;
}

.mapping-arrow {
    color: #ffd700;
    font-size: 12px;
    display: block;
    margin: 3px 0;
}

.mapping-cipher {
    color: #0f0;
    font-size: 18px;
    font-weight: bold;
    display: block;
}

/* Educational Content */
.content-section {
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid #0f0;
    border-radius: 10px;
    padding: 30px;
    margin-bottom: 30px;
    color: #0f0;
}

.content-section h2 {
    color: #0ff;
    margin-top: 0;
    font-size: 28px;
    text-shadow: 0 0 10px #0ff;
}

.content-section h3 {
    color: #0f0;
    margin-top: 25px;
    font-size: 22px;
}

.content-section p {
    line-height: 1.8;
    margin: 15px 0;
}

.content-section ul,
.content-section ol {
    line-height: 1.8;
    margin: 15px 0;
    padding-left: 30px;
}

.example-box {
    background: rgba(0, 255, 255, 0.1);
    border-left: 4px solid #0ff;
    padding: 20px;
    margin: 20px 0;
    border-radius: 6px;
}

.example-box p {
    margin: 10px 0;
}

.example-box ul {
    margin: 10px 0;
}

.alphabet-example {
    background: rgba(0, 0, 0, 0.5);
    padding: 15px;
    border-radius: 4px;
    margin: 10px 0;
    font-family: 'Courier New', monospace;
}

.alphabet-example div {
    margin: 5px 0;
    letter-spacing: 2px;
}

/* FAQ Section */
.faq-section {
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid #ffd700;
    border-radius: 10px;
    padding: 30px;
    margin-bottom: 30px;
}

.faq-section h2 {
    color: #ffd700;
    margin-top: 0;
    font-size: 28px;
    text-shadow: 0 0 10px #ffd700;
}

.faq-item {
    margin-bottom: 25px;
}

.faq-item h3 {
    color: #0ff;
    font-size: 18px;
    margin-bottom: 10px;
}

.faq-item p {
    color: #0f0;
    line-height: 1.8;
    margin: 0;
}

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

    .tool-header h1 {
        font-size: 32px;
    }

    .mode-toggle {
        flex-direction: column;
    }

    .mode-btn {
        max-width: 100%;
    }

    .alphabet-label {
        min-width: 60px;
        font-size: 12px;
    }

    .alphabet-display {
        font-size: 11px;
        letter-spacing: 1px;
    }

    .mapping-grid {
        grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
        gap: 8px;
    }

    .mapping-normal,
    .mapping-cipher {
        font-size: 16px;
    }
}