/**
 * HTML Encoder Tool Styles
 * HTML编码解码工具专用样式
 */

/* Main Styles */
.html-encoder-tool {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* Textarea Styles */
.font-monospace {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
}

.form-control:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* Statistics Display */
.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #0d6efd;
}

.stat-label {
    font-size: 0.875rem;
    color: #6c757d;
    margin-top: 0.25rem;
}

.stat-item {
    padding: 1rem;
    border-radius: 0.5rem;
    background-color: #f8f9fa;
    transition: all 0.3s ease;
}

.stat-item:hover {
    background-color: #e9ecef;
    transform: translateY(-2px);
}

/* Button Styles */
.btn {
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.btn-check:checked + .btn {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

/* Copy Success Animation */
.copy-success {
    background-color: #198754 !important;
    border-color: #198754 !important;
    color: white !important;
    animation: copySuccessPulse 0.6s ease;
}

@keyframes copySuccessPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* HTML Preview Styles */
#htmlPreview {
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
}

#previewContent {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
}

#previewContent h1,
#previewContent h2,
#previewContent h3,
#previewContent h4,
#previewContent h5,
#previewContent h6 {
    margin-top: 0;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

#previewContent p {
    margin-top: 0;
    margin-bottom: 1rem;
}

#previewContent ul,
#previewContent ol {
    margin-bottom: 1rem;
    padding-left: 2rem;
}

#previewContent blockquote {
    border-left: 4px solid #0d6efd;
    padding-left: 1rem;
    margin: 1rem 0;
    font-style: italic;
    color: #6c757d;
}

#previewContent code {
    background-color: #f8f9fa;
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.875em;
}

#previewContent pre {
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 0.5rem;
    overflow-x: auto;
}

#previewContent pre code {
    background: none;
    padding: 0;
}

/* Tab Styles */
.nav-tabs {
    border-bottom: 2px solid #dee2e6;
}

.nav-tabs .nav-link {
    border-radius: 0.5rem 0.5rem 0 0;
    border: none;
    color: #6c757d;
    font-weight: 500;
    transition: all 0.3s ease;
}

.nav-tabs .nav-link:hover {
    color: #0d6efd;
    background-color: #f8f9fa;
}

.nav-tabs .nav-link.active {
    color: #0d6efd;
    background-color: #fff;
    border-bottom: 2px solid #0d6efd;
}

/* Table Styles */
.table {
    margin-bottom: 0;
}

.table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #495057;
    border-top: none;
    border-bottom: 2px solid #dee2e6;
}

.table td {
    vertical-align: middle;
    border-bottom: 1px solid #e9ecef;
}

.table-responsive {
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Character Reference Table */
.character-table {
    font-size: 0.875rem;
}

.character-table .table td:first-child {
    font-family: monospace;
    font-size: 1.1rem;
    text-align: center;
    background-color: #f8f9fa;
    font-weight: bold;
}

.character-table .table td:nth-child(2),
.character-table .table td:nth-child(3) {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

/* Alert Styles */
.alert {
    border-radius: 0.5rem;
    border: none;
    font-weight: 500;
}

.alert-info {
    background-color: #e7f3ff;
    color: #084298;
}

.alert-success {
    background-color: #d1e7dd;
    color: #0f5132;
}

.alert-warning {
    background-color: #fff3cd;
    color: #664d03;
}

.alert-danger {
    background-color: #f8d7da;
    color: #842029;
}

/* Card Styles */
.card {
    border-radius: 0.75rem;
    border: 1px solid #e9ecef;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.card-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    border-radius: 0.75rem 0.75rem 0 0 !important;
    font-weight: 600;
    color: #495057;
}

/* Form Check Styles */
.form-check {
    margin-bottom: 0.5rem;
}

.form-check-input:checked {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

.form-check-input:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0d6efd;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Highlight Effect */
.highlight {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 0.25rem;
    padding: 0.125rem 0.25rem;
    animation: highlightFade 2s ease;
}

@keyframes highlightFade {
    0% { background-color: #ffeaa7; }
    100% { background-color: transparent; }
}

/* Status Bar Animation */
.status-bar-enter {
    animation: slideDown 0.3s ease;
}

.status-bar-exit {
    animation: slideUp 0.3s ease;
}

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

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

/* Clean Result Styles */
#cleanedResult {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Tab Content Animation */
.tab-pane {
    animation: tabFadeIn 0.3s ease;
}

@keyframes tabFadeIn {
    from {
        opacity: 0;
        transform: translateX(10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .stat-value {
        font-size: 1.25rem;
    }

    .btn-group .btn {
        font-size: 0.875rem;
        padding: 0.5rem 0.75rem;
    }

    .card-header {
        font-size: 0.875rem;
    }

    .table-responsive {
        font-size: 0.875rem;
    }

    .nav-tabs .nav-link {
        font-size: 0.875rem;
        padding: 0.5rem 1rem;
    }
}

@media (max-width: 576px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .row.g-3 > * {
        padding-bottom: 1rem;
    }

    .btn-group {
        width: 100%;
    }

    .btn-group .btn {
        flex: 1;
        font-size: 0.75rem;
        padding: 0.375rem 0.5rem;
    }

    .character-table .table td {
        font-size: 0.75rem;
        padding: 0.25rem;
    }

    .form-check {
        margin-bottom: 0.25rem;
    }

    .form-check-label {
        font-size: 0.875rem;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .card {
        background-color: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }

    .card-header {
        background-color: #4a5568;
        color: #e2e8f0;
    }

    .form-control {
        background-color: #4a5568;
        border-color: #718096;
        color: #e2e8f0;
    }

    .form-control:focus {
        background-color: #4a5568;
        border-color: #63b3ed;
        color: #e2e8f0;
    }

    .table {
        color: #e2e8f0;
    }

    .table th {
        background-color: #4a5568;
        color: #e2e8f0;
    }

    .nav-tabs {
        border-bottom-color: #4a5568;
    }

    .nav-tabs .nav-link {
        color: #a0aec0;
    }

    .nav-tabs .nav-link:hover {
        color: #63b3ed;
        background-color: #4a5568;
    }

    .nav-tabs .nav-link.active {
        color: #63b3ed;
        background-color: #2d3748;
        border-bottom-color: #63b3ed;
    }

    #htmlPreview {
        border-color: #4a5568;
        background-color: #2d3748;
    }

    #previewContent {
        color: #e2e8f0;
    }

    #previewContent blockquote {
        border-left-color: #63b3ed;
        color: #a0aec0;
    }

    #previewContent code {
        background-color: #4a5568;
        color: #63b3ed;
    }

    #previewContent pre {
        background-color: #4a5568;
    }
}

/* Print Styles */
@media print {
    .btn-group,
    .btn-close,
    .alert,
    .nav-tabs {
        display: none !important;
    }

    .card {
        border: 1px solid #000 !important;
        box-shadow: none !important;
        page-break-inside: avoid;
    }

    .form-control {
        border: 1px solid #000 !important;
    }

    .tab-content > .tab-pane {
        display: block !important;
        opacity: 1 !important;
    }
}

/* Accessibility */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus Styles */
.btn:focus,
.form-control:focus,
.form-check-input:focus,
.nav-link:focus {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .btn {
        border-width: 2px;
    }

    .card {
        border-width: 2px;
    }

    .form-control {
        border-width: 2px;
    }

    .nav-tabs .nav-link.active {
        border-bottom-width: 3px;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Scrollbar Styles */
#htmlPreview::-webkit-scrollbar {
    width: 6px;
}

#htmlPreview::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

#htmlPreview::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

#htmlPreview::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}