/* Main Tool Container */
.js-escape-tool {
    margin-bottom: 2rem;
}

.tool-card {
    background: #fafbfc;
    border: 1px solid #e8ecf1;
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(102, 126, 234, 0.06);
    overflow: hidden;
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.tool-card:hover {
    box-shadow: 0 6px 24px rgba(102, 126, 234, 0.1);
    border-color: #dde2e9;
}

/* Tool Header */
.tool-header {
    padding: 1.5rem;
    background: linear-gradient(135deg, #5a67d8 0%, #667eea 50%, #764ba2 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

.action-btn-primary {
    background: rgba(255, 255, 255, 0.25);
}

.action-btn-primary:hover {
    background: rgba(255, 255, 255, 0.35);
}

.action-btn-secondary {
    background: rgba(255, 255, 255, 0.2);
}

.action-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.3);
}

.action-btn-clear {
    background: rgba(255, 107, 107, 0.3);
}

.action-btn-clear:hover {
    background: rgba(255, 107, 107, 0.4);
}

.action-btn-copy {
    background: rgba(76, 175, 80, 0.3);
}

.action-btn-copy:hover {
    background: rgba(76, 175, 80, 0.4);
}

.btn-icon {
    font-size: 1rem;
    line-height: 1;
}

.btn-text {
    font-weight: 600;
}

/* Stats Bar */
.stats-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    color: #ffffff;
    font-size: 0.875rem;
}

.stat-label {
    opacity: 0.9;
    font-weight: 500;
}

.stat-value {
    font-weight: 700;
    font-size: 1rem;
    color: #ffffff;
}

.stat-unit {
    opacity: 0.8;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-divider {
    opacity: 0.3;
    color: #ffffff;
}

/* Editor Container */
.editor-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    padding: 1.5rem;
    background: #f0f2f5;
}

.editor-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 400px;
    width: 100% !important;
}

.editor-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding: 0.5rem 0;
}

.label-text {
    font-weight: 600;
    font-size: 0.9375rem;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.label-hint {
    font-size: 0.75rem;
    color: #6b7280;
    font-style: italic;
}

.editor-box {
    flex: 1;
    min-height: 350px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    background: #ffffff;
    border: 1px solid #e4e7eb;
}

/* Reference Card */
.reference-card {
    margin-top: 2rem;
    background: #fafbfc;
    border: 1px solid #e8ecf1;
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(102, 126, 234, 0.06);
    overflow: hidden;
}

.reference-card:hover {
    border-color: #dde2e9;
    box-shadow: 0 6px 24px rgba(102, 126, 234, 0.08);
}

.reference-header {
    padding: 1.5rem;
    background: linear-gradient(135deg, #5a67d8 0%, #667eea 50%, #764ba2 100%);
    color: #ffffff;
}

.reference-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
    color: #ffffff;
}

.reference-subtitle {
    font-size: 0.875rem;
    opacity: 0.95;
    margin: 0;
    color: #ffffff;
}

.reference-table-wrapper {
    overflow-x: auto;
}

.reference-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.reference-table thead {
    background: #eef1f6;
}

.reference-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: #2d3748;
    border-bottom: 2px solid #dde2e9;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

.reference-table td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid #e8ecf1;
    color: #4a5568;
}

.reference-table tbody tr {
    transition: background-color 0.2s ease;
}

.reference-table tbody tr:hover {
    background-color: #f0f2f5;
}

.reference-table code {
    background: #e8ecf4;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    
    font-size: 0.8125rem;
    color: #5a67d8;
    font-weight: 600;
}

/* Mobile Responsive */
@media (max-width: 1024px) {
    .editor-container {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

@media (max-width: 768px) {
    .tool-header {
        padding: 1rem;
    }

    .header-actions {
        gap: 0.5rem;
    }

    .action-btn {
        padding: 0.5rem 1rem;
        font-size: 0.8125rem;
    }

    .btn-text {
        display: none;
    }

    .action-btn {
        min-width: 44px;
        justify-content: center;
    }

    .stats-bar {
        gap: 0.75rem;
        font-size: 0.8125rem;
    }

    .stat-divider {
        display: none;
    }

    .stat-item {
        flex: 1;
        justify-content: center;
        padding: 0.25rem;
        background: rgba(255, 255, 255, 0.1);
        border-radius: 6px;
    }

    .editor-container {
        padding: 1rem;
    }

    .editor-wrapper {
        min-height: 300px;
    }

    .editor-box {
        min-height: 250px;
    }

    .editor-label {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    .label-hint {
        display: none;
    }

    .reference-header {
        padding: 1rem;
    }

    .reference-title {
        font-size: 1.25rem;
    }

    .reference-table {
        font-size: 0.8125rem;
    }

    .reference-table th,
    .reference-table td {
        padding: 0.75rem 0.5rem;
    }
}

@media (max-width: 480px) {
    .action-btn {
        padding: 0.5rem;
        min-width: 40px;
    }

    .stats-bar {
        flex-direction: column;
        gap: 0.5rem;
    }

    .stat-item {
        width: 100%;
    }

    .reference-table {
        font-size: 0.75rem;
    }

    .reference-table th,
    .reference-table td {
        padding: 0.5rem 0.375rem;
    }
}

/* ACE Editor Customization */
.ace_editor {
    border-radius: 8px;
}

.ace_editor.ace_autocomplete {
    border-radius: 8px;
}

/* Focus States */
.action-btn:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

/* Loading States */
.action-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Animation for Copy Success */
@keyframes copySuccess {
    0% {
        background: rgba(76, 175, 80, 0.3);
    }
    50% {
        background: rgba(76, 175, 80, 0.6);
    }
    100% {
        background: rgba(76, 175, 80, 0.3);
    }
}

.action-btn-copy.copied {
    animation: copySuccess 0.5s ease;
}
