/* FixLang Page Styles */

.fixlang-container {
    min-height: 100vh;
    padding: 40px 20px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(240, 112, 156, 0.05) 100%);
    position: relative;
    overflow: hidden;
}

/* Floating characters background */
#fx {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.fixlang-content {
    max-width: 1000px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(102, 126, 234, 0.1);
    border-radius: 20px;
    padding: 40px;
    backdrop-filter: blur(10px);
}

.fixlang-content h1 {
    font-size: clamp(28px, 5vw, 48px);
    margin-bottom: 16px;
    text-align: center;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.fixlang-subtitle {
    text-align: center;
    color: #888;
    margin-bottom: 30px;
    font-size: 14px;
}

.fixlang-subtitle strong {
    color: #667eea;
    font-weight: 600;
}

/* Keyboard Selector */
.keyboard-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.selector-label {
    color: #666;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.keyboard-buttons {
    display: inline-flex;
    background: rgba(102, 126, 234, 0.05);
    border: 1px solid rgba(102, 126, 234, 0.15);
    border-radius: 25px;
    padding: 4px;
    gap: 4px;
}

.kb-btn {
    border: none;
    background: transparent;
    color: #666;
    font-family: inherit;
    font-weight: 600;
    font-size: 13px;
    padding: 8px 18px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.25s ease;
}

.kb-btn.on {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.kb-btn:hover:not(.on) {
    color: #667eea;
}

/* Text Panels */
.fixlang-panels {
    display: grid;
    grid-template-columns: 1fr 60px 1fr;
    gap: 16px;
    align-items: stretch;
    margin-bottom: 24px;
}

.fixlang-panel {
    display: flex;
    flex-direction: column;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 12px;
}

.panel-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.panel-title.scrambled {
    color: #f07078;
}

.panel-title.fixed {
    color: #89d76e;
}

.char-count {
    font-size: 12px;
    color: #888;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* Floating characters animation */
@keyframes floatUp {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.3;
    }
    90% {
        opacity: 0.3;
    }
    100% {
        transform: translateY(-100vh) rotate(360deg);
        opacity: 0;
    }
}

.floating-char {
    position: fixed;
    font-weight: bold;
    pointer-events: none;
    z-index: 0;
    font-family: Arial, sans-serif;
    white-space: nowrap;
}

#inputText,
#outputText {
    flex: 1;
    width: 100%;
    min-height: 180px;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid rgba(102, 126, 234, 0.15);
    background: rgba(102, 126, 234, 0.02);
    color: inherit;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 15px;
    line-height: 1.6;
    resize: none;
    transition: all 0.3s ease;
}

#inputText::placeholder,
#outputText::placeholder {
    color: rgba(102, 126, 234, 0.3);
}

#inputText:focus {
    outline: none;
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.04);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#outputText {
    border-color: rgba(137, 215, 110, 0.2);
    background: rgba(137, 215, 110, 0.02);
}

#outputText:focus {
    border-color: #89d76e;
    box-shadow: 0 0 0 3px rgba(137, 215, 110, 0.1);
}

/* Arrow Separator */
.arrow-separator {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.arrow-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #f07078);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    animation: pulse-arrow 2s ease-in-out infinite;
    position: relative;
}

.arrow-circle::after {
    content: "→";
    color: white;
    font-weight: bold;
    font-size: 20px;
}

@keyframes pulse-arrow {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Actions */
.fixlang-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.btn {
    flex: 1;
    padding: 14px 20px;
    border: none;
    border-radius: 12px;
    font-family: inherit;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-copy {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    flex: 1;
}

.btn-copy:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

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

.btn-copy.done {
    background: linear-gradient(135deg, #89d76e, #52d76e);
    box-shadow: 0 4px 15px rgba(137, 215, 110, 0.3);
}

.btn-clear {
    background: transparent;
    color: #667eea;
    border: 1px solid #667eea;
    flex: 0 0 auto;
    padding: 12px 16px;
    font-size: 13px;
    white-space: nowrap;
    min-width: 140px;
    text-align: center;
}

.btn-clear:hover {
    background: rgba(102, 126, 234, 0.1);
}

/* Edit Map Button */
.btn-edit-map {
    padding: 12px 16px;
    border: 1px dashed rgba(102, 126, 234, 0.3);
    background: transparent;
    color: #667eea;
    border-radius: 12px;
    font-family: inherit;
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.25s ease;
    text-align: center;
    flex: 0 0 auto;
    order: -2;
    white-space: nowrap;
    min-width: 140px;
}

.btn-edit-map:hover {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.05);
    color: #764ba2;
}

/* Ripple Effect */
.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%) scale(0);
    animation: ripple-effect 0.6s ease-out;
    pointer-events: none;
}

@keyframes ripple-effect {
    to {
        transform: translate(-50%, -50%) scale(4);
        opacity: 0;
    }
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: linear-gradient(135deg, #89d76e, #667eea);
    color: white;
    font-weight: 700;
    padding: 12px 24px;
    border-radius: 12px;
    z-index: 1000;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.2, 0.9, 0.2, 1);
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    animation: fade-in 0.25s ease;
}

.modal-overlay[hidden] {
    display: none;
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    width: 100%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slide-up 0.3s cubic-bezier(0.2, 0.9, 0.2, 1);
}

@keyframes slide-up {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

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

.modal-header h3 {
    font-size: 18px;
    color: #333;
    margin: 0;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: #999;
    font-size: 24px;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
}

/* Editor Header */
.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.editor-header span {
    color: #666;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Map Grid */
.map-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 16px;
    padding: 8px;
}

.map-row {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(102, 126, 234, 0.05);
    border: 1px solid rgba(102, 126, 234, 0.1);
    border-radius: 8px;
    padding: 6px 8px;
}

.map-row input {
    flex: 1;
    background: transparent;
    border: none;
    color: #333;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    padding: 2px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.map-row input:focus {
    outline: none;
    background: rgba(102, 126, 234, 0.1);
}

.mkey {
    font-family: 'Monaco', 'Courier New', monospace;
    color: #667eea;
}

.meq {
    color: #999;
    font-weight: 600;
    font-size: 11px;
}

.mdel {
    width: 20px;
    height: 20px;
    border: none;
    background: transparent;
    color: #999;
    font-size: 14px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.mdel:hover {
    color: #f07078;
    background: rgba(240, 112, 120, 0.1);
}

/* Editor Footer */
.editor-footer {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 16px;
}

.btn-save {
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-save:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.mini-btn {
    display: inline-flex;
    align-items: center;
    background: transparent;
    border: 1px solid rgba(102, 126, 234, 0.3);
    color: #667eea;
    font-family: inherit;
    font-weight: 600;
    font-size: 12px;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mini-btn:hover {
    color: #764ba2;
    border-color: #764ba2;
    background: rgba(102, 126, 234, 0.05);
}

.mini-btn.danger:hover {
    color: #f07078;
    border-color: #f07078;
    background: rgba(240, 112, 120, 0.05);
}

/* Responsive */
@media (max-width: 768px) {
    .fixlang-content {
        padding: 24px;
    }

    .fixlang-panels {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .arrow-separator {
        transform: rotate(90deg);
        height: 44px;
        margin: 12px 0;
    }

    .fixlang-actions {
        flex-direction: column;
    }

    .btn-clear {
        flex: 1;
    }

    .modal {
        max-height: 90vh;
        padding: 16px;
    }

    .map-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        max-height: 250px;
    }
}

@media (max-width: 480px) {
    .fixlang-container {
        padding: 20px 12px;
    }

    .fixlang-content {
        padding: 16px;
        border-radius: 12px;
    }

    .fixlang-content h1 {
        font-size: 24px;
        margin-bottom: 12px;
    }

    .fixlang-subtitle {
        font-size: 12px;
        margin-bottom: 20px;
    }

    .keyboard-selector {
        gap: 12px;
    }

    #inputText,
    #outputText {
        min-height: 140px;
        font-size: 14px;
    }
}
