/* CSS Variables for theming */
/* Colorblind-friendly palette (Deuteranomaly/Protanomaly safe) */
:root {
    --bg-primary: #f5f7fa;
    --bg-secondary: #fff;
    --bg-tertiary: #f8fafc;
    --bg-input: #fff;
    --text-primary: #333;
    --text-secondary: #64748b;
    --text-tertiary: #374151;
    --text-muted: #6b7280;
    --border-color: #e2e8f0;
    --border-input: #999;
    --accent-color: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-light: rgba(37, 99, 235, 0.08);
    --accent-lighter: rgba(37, 99, 235, 0.15);
    /* Colorblind-friendly: Blue/Teal for success instead of green */
    --success-bg: #dbeafe;
    --success-text: #1d4ed8;
    /* Colorblind-friendly: Orange/Amber for error instead of red */
    --error-bg: #fef3c7;
    --error-text: #b45309;
    --code-bg: #1e293b;
    --code-text: #e2e8f0;
    --shadow-color: rgba(0, 0, 0, 0.08);
    --modal-overlay: rgba(0, 0, 0, 0.5);
    --pre-bg: #fff;
    --pre-text: #334155;
    --pre-border: #e2e8f0;
}

[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-input: #1e293b;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-tertiary: #cbd5e1;
    --text-muted: #94a3b8;
    --border-color: #475569;
    --border-input: #64748b;
    --accent-color: #3b82f6;
    --accent-hover: #60a5fa;
    --accent-light: rgba(59, 130, 246, 0.15);
    --accent-lighter: rgba(59, 130, 246, 0.25);
    /* Colorblind-friendly: Blue/Teal for success instead of green */
    --success-bg: #1e3a5f;
    --success-text: #60a5fa;
    /* Colorblind-friendly: Orange/Amber for error instead of red */
    --error-bg: #422006;
    --error-text: #fbbf24;
    --code-bg: #0f172a;
    --code-text: #e2e8f0;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --modal-overlay: rgba(0, 0, 0, 0.7);
    --pre-bg: #0f172a;
    --pre-text: #e2e8f0;
    --pre-border: #475569;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-primary);
    min-height: 100vh;
    color: var(--text-primary);
    padding: 10px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 900px;
    margin: 0 auto;
}

header {
    text-align: center;
    padding: 10px 0;
    position: relative;
}

h1 {
    font-size: 1.8rem;
    margin-bottom: 5px;
    color: var(--accent-color);
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Dark mode toggle */
.theme-toggle {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 6px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.theme-toggle-icon {
    font-size: 1rem;
}

@media (max-width: 600px) {
    .theme-toggle {
        position: static;
        transform: none;
        margin: 10px auto 0;
    }
}

.search-box {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px var(--shadow-color);
    border: 1px solid var(--border-color);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 0.8fr 0.8fr;
    gap: 15px;
    align-items: stretch;
}

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

.form-section {
    display: flex;
    flex-direction: column;
}

.form-section textarea:first-of-type {
    flex: 1;
}

.form-label {
    font-weight: 600;
    color: var(--text-tertiary);
    margin-bottom: 5px;
    font-size: 0.85rem;
}

.hint {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-style: italic;
    margin-left: 5px;
}

textarea {
    width: 100%;
    min-height: 150px;
    padding: 8px;
    font-size: 0.85rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    border: 1px solid var(--border-input);
    background: var(--bg-input);
    color: var(--text-primary);
    outline: none;
    resize: vertical;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.3s ease;
    border-radius: 4px;
}

textarea::placeholder {
    color: var(--text-muted);
}

textarea:hover {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px var(--accent-lighter);
}

textarea:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px var(--accent-lighter);
}

select {
    padding: 4px 8px;
    font-size: 0.85rem;
    border: 1px solid var(--border-input);
    background: var(--bg-input);
    color: var(--text-primary);
    cursor: pointer;
    min-width: 100px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.3s ease;
    border-radius: 4px;
}

select:hover {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px var(--accent-lighter);
}

select:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px var(--accent-lighter);
    outline: none;
}

select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.options-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-top: 8px;
}

.option-item {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    padding: 1px 3px;
    margin: -1px -3px;
    border-radius: 3px;
    transition: background-color 0.2s ease;
}

.option-item:hover {
    background-color: var(--accent-light);
}

.option-item input[type="checkbox"],
.option-item input[type="radio"] {
    cursor: pointer;
    width: 14px;
    height: 14px;
    accent-color: var(--accent-color);
    transition: box-shadow 0.2s ease;
}

.option-item:hover input[type="checkbox"],
.option-item:hover input[type="radio"] {
    box-shadow: 0 0 0 3px var(--accent-lighter);
}

.option-item label {
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.nameserver-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.nameserver-section .custom-ns-input {
    flex: 1;
}

.nameserver-option {
    display: flex;
    align-items: center;
    gap: 5px;
}

.nameserver-option input[type="radio"] {
    cursor: pointer;
    width: 14px;
    height: 14px;
    accent-color: var(--accent-color);
}

.nameserver-option label {
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.nameserver-option select {
    margin-left: 5px;
}

.custom-ns-input {
    width: 100%;
    padding: 6px;
    font-size: 0.85rem;
    border: 1px solid var(--border-input);
    background: var(--bg-input);
    color: var(--text-primary);
    margin-top: 3px;
    min-height: 50px;
    resize: vertical;
    border-radius: 4px;
}

.custom-ns-input:disabled {
    opacity: 0.5;
    background: var(--bg-tertiary);
}

.button-row {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.button-row button {
    min-width: 130px;
}

button {
    padding: 8px 25px;
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
}

button.primary {
    background: var(--accent-color);
    color: #fff;
}

button.primary:hover {
    background: var(--accent-hover);
}

button.secondary {
    background: var(--bg-tertiary);
    color: var(--text-tertiary);
    border: 1px solid var(--border-color);
}

button.secondary:hover {
    background: var(--border-color);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.result-box {
    background: var(--bg-secondary);
    border-radius: 6px;
    padding: 10px;
    box-shadow: 0 1px 4px var(--shadow-color);
    border: 1px solid var(--border-color);
    display: none;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.result-box.show {
    display: block;
}

.result-item {
    margin-bottom: 8px;
    padding: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.result-item:last-child {
    margin-bottom: 0;
}

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

.result-title {
    font-size: 0.8rem;
    color: var(--accent-color);
    font-weight: 600;
}

.copy-btn {
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
    font-size: 0.75rem;
}

.copy-btn:hover {
    opacity: 1;
}

.status {
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.65rem;
    font-weight: 600;
}

.status.success {
    background: var(--success-bg);
    color: var(--success-text);
}

.status.error {
    background: var(--error-bg);
    color: var(--error-text);
}

pre {
    background: var(--pre-bg);
    padding: 6px 8px;
    border-radius: 3px;
    overflow-x: auto;
    font-family: 'Fira Code', 'Monaco', monospace;
    font-size: 0.75rem;
    line-height: 1.4;
    color: var(--pre-text);
    white-space: pre-wrap;
    word-wrap: break-word;
    border: 1px solid var(--pre-border);
    margin: 0;
}

.dns-record {
    display: block;
    margin: 1px 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.dns-record span {
    display: inline;
}

.dns-name { color: #16a34a; font-weight: 500; }
.dns-ttl { color: #dc2626; }
.dns-class { color: var(--accent-color); }
.dns-type { color: var(--accent-color); font-weight: 500; }
.dns-value { color: #7c3aed; font-weight: 500; }

[data-theme="dark"] .dns-name { color: #34d399; }
[data-theme="dark"] .dns-ttl { color: #f87171; }
[data-theme="dark"] .dns-value { color: #a78bfa; }

/* Clickable hostnames and nameservers in output */
/* Colorblind-friendly: Teal for hostnames, Purple for nameservers */
.clickable-host,
.clickable-ns {
    cursor: pointer;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 2px;
}

.clickable-host:hover,
.clickable-ns:hover {
    text-decoration-style: solid;
    opacity: 0.8;
}

.clickable-host {
    color: #0891b2; /* Teal/Cyan - colorblind friendly */
}

.clickable-ns {
    color: #7c3aed; /* Purple */
}

[data-theme="dark"] .clickable-host {
    color: #22d3ee; /* Cyan - colorblind friendly */
}

[data-theme="dark"] .clickable-ns {
    color: #a78bfa;
}

.command-display {
    background: var(--code-bg);
    color: var(--code-text);
    padding: 4px 8px;
    border-radius: 3px;
    font-family: 'Fira Code', 'Monaco', monospace;
    font-size: 0.7rem;
    margin-bottom: 4px;
}

.loading {
    display: none;
    text-align: center;
    padding: 20px;
    color: var(--text-primary);
}

.loading.show {
    display: block;
}

.loading .cancel-btn {
    margin-top: 12px;
    padding: 6px 20px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.loading .cancel-btn:hover {
    background: var(--error-bg);
    border-color: var(--error-text);
    color: var(--error-text);
}

.spinner {
    width: 35px;
    height: 35px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.error-message {
    background: var(--error-bg);
    border: 1px solid var(--error-text);
    padding: 4px 8px;
    border-radius: 3px;
    color: var(--error-text);
    margin-top: 4px;
    font-size: 0.75rem;
}

/* Features Guide Section */
.features-guide {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 30px;
    margin-top: 30px;
    border: 1px solid var(--border-color);
}

.features-guide h2 {
    text-align: left;
    color: var(--accent-color);
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.features-text {
    margin-bottom: 20px;
}

.features-text p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 8px;
}

.features-text strong {
    color: var(--text-primary);
}

.tips-section {
    background: var(--accent-light);
    border-radius: 10px;
    padding: 20px 25px;
    border-left: 4px solid var(--accent-color);
}

.tips-section h3 {
    color: var(--accent-color);
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.tips-section ul {
    list-style: none;
    padding: 0;
}

.tips-section li {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
    padding: 5px 0;
    padding-left: 20px;
    position: relative;
}

.tips-section li::before {
    content: "→";
    position: absolute;
    left: 0;
    color: var(--accent-color);
}

.tips-section li strong {
    color: var(--text-primary);
}

.tips-section kbd {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 2px 6px;
    font-family: monospace;
    font-size: 0.85em;
    box-shadow: 0 1px 2px var(--shadow-color);
}

/* Responsive adjustments for features guide */
@media (max-width: 600px) {
    .features-guide {
        padding: 20px 15px;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .feature-card {
        padding: 15px;
    }
    
    .tips-section {
        padding: 15px;
    }
}

footer {
    text-align: center;
    padding: 15px 0;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

footer a {
    color: var(--accent-color);
    text-decoration: none;
}

/* Recent Hostnames Popover */
.hostname-input-wrapper {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.recent-hostnames-popover {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 4px 12px var(--shadow-color);
    z-index: 1000;
    display: none;
    max-height: 280px;
    overflow-y: auto;
    margin-top: 4px;
}

.recent-hostnames-popover.show {
    display: block;
}

.recent-hostnames-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    position: sticky;
    top: 0;
    z-index: 1;
}

.recent-hostnames-filter-wrapper {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    position: sticky;
    top: 33px;
    z-index: 1;
}

.recent-hostnames-filter {
    width: 100%;
    padding: 6px 10px;
    font-size: 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-input);
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.2s ease;
}

.recent-hostnames-filter:focus {
    border-color: var(--accent-color);
}

.recent-hostnames-filter::placeholder {
    color: var(--text-muted);
}

.recent-hostnames-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.recent-hostnames-clear {
    font-size: 0.75rem;
    color: var(--accent-color);
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 3px;
    transition: background-color 0.2s ease;
}

.recent-hostnames-clear:hover {
    background: var(--accent-light);
}

.recent-hostnames-list {
    padding: 4px 0;
}

.recent-hostname-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.recent-hostname-item:hover {
    background: var(--accent-light);
}

.recent-hostname-icon {
    font-size: 0.9rem;
    opacity: 0.6;
}

.recent-hostname-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.recent-hostname-actions {
    display: flex;
    gap: 4px;
}

.recent-hostname-item:hover .recent-hostname-actions {
    opacity: 1;
}

.recent-hostname-btn {
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    transition: all 0.2s ease;
}

.recent-hostname-btn.add-btn {
    background: var(--success-bg);
    color: var(--success-text);
}

.recent-hostname-btn.add-btn:hover {
    background: var(--success-text);
    color: #fff;
}

.recent-hostname-btn.delete-btn {
    background: var(--error-bg);
    color: var(--error-text);
}

.recent-hostname-btn.delete-btn:hover {
    background: var(--error-text);
    color: #fff;
}

.recent-hostnames-empty {
    padding: 16px 12px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Nameserver input wrapper for popover positioning */
.nameserver-input-wrapper {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Recent inputs toggle */
.recent-inputs-toggle {
    position: absolute;
    right: 90px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 6px 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    white-space: nowrap;
}

.recent-inputs-toggle:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.recent-inputs-toggle input[type="checkbox"] {
    width: 14px;
    height: 14px;
    cursor: pointer;
    accent-color: var(--accent-color);
    margin: 0;
    flex-shrink: 0;
}

.recent-inputs-toggle label {
    cursor: pointer;
    white-space: nowrap;
}

@media (max-width: 600px) {
    .recent-inputs-toggle {
        display: none;
    }
    
    .recent-hostnames-popover {
        display: none !important;
    }
    
    header .theme-toggle {
        position: static;
        transform: none;
        margin: 10px auto 0;
    }
}

footer a:hover {
    text-decoration: underline;
}

.feedback-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.feedback-link:hover {
    background: var(--bg-tertiary);
    text-decoration: none;
    transform: translateY(-1px);
}

.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    color: white;
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(37, 99, 235, 0.3);
    z-index: 1000;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    max-width: 90%;
    text-align: center;
    font-size: 0.9rem;
    line-height: 1.5;
}

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

.toast strong {
    display: block;
    font-size: 1rem;
    margin-bottom: 4px;
}

/* History Button */
.history-btn {
    background: var(--success-bg);
    color: var(--success-text);
    border: 1px solid var(--success-text);
}

.history-btn:hover {
    filter: brightness(0.95);
}

/* History Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--modal-overlay);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: var(--bg-secondary);
    border-radius: 12px;
    max-width: 800px;
    width: 100%;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}

.modal-header h2 {
    font-size: 1.1rem;
    color: var(--accent-color);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    max-height: calc(80vh - 120px);
    background: var(--bg-secondary);
}

.modal-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    text-align: right;
}

/* CAPTCHA Modal Styles */
.captcha-modal {
    max-width: 420px;
}

.captcha-content {
    text-align: center;
    padding: 25px;
}

.captcha-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.captcha-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--accent-color);
    margin-bottom: 10px;
}

.captcha-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 20px;
    line-height: 1.5;
}

.captcha-image-container {
    background: var(--bg-tertiary);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    display: inline-block;
}

.captcha-image {
    display: block;
    border-radius: 4px;
    box-shadow: 0 2px 8px var(--shadow-color);
}

.captcha-refresh {
    margin-top: 10px;
    background: none;
    border: none;
    color: var(--accent-color);
    cursor: pointer;
    font-size: 0.85rem;
    text-decoration: underline;
}

.captcha-refresh:hover {
    color: var(--accent-hover);
}

.captcha-input-container {
    margin-bottom: 20px;
}

.captcha-input {
    width: 180px;
    padding: 12px 15px;
    font-size: 1.2rem;
    text-align: center;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    outline: none;
    text-transform: uppercase;
    letter-spacing: 3px;
    transition: border-color 0.2s ease;
    background: var(--bg-input);
    color: var(--text-primary);
}

.captcha-input:focus {
    border-color: var(--accent-color);
}

.captcha-input.error {
    border-color: var(--error-text);
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

.captcha-error {
    color: var(--error-text);
    font-size: 0.85rem;
    margin-top: 10px;
    display: none;
}

.captcha-error.show {
    display: block;
}

.captcha-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.captcha-buttons button {
    padding: 10px 25px;
    border-radius: 6px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.captcha-submit {
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-hover) 100%);
    color: white;
    border: none;
}

.captcha-submit:hover {
    filter: brightness(1.1);
}

.captcha-submit:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
}

.captcha-cancel {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.captcha-cancel:hover {
    background: var(--border-color);
}

.captcha-info {
    margin-top: 15px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.history-item {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 12px;
    overflow: hidden;
}

.history-item:last-child {
    margin-bottom: 0;
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    cursor: pointer;
    gap: 10px;
}

.history-item-header:hover {
    filter: brightness(0.95);
}

.history-item-info {
    flex: 1;
    min-width: 0;
}

.history-item-domains {
    font-weight: 600;
    color: var(--accent-color);
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.history-item-actions {
    display: flex;
    gap: 8px;
}

.history-item-actions button {
    padding: 4px 10px;
    font-size: 0.75rem;
}

.history-item-body {
    display: none;
    padding: 12px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.history-item-body.show {
    display: block;
}

.history-item-body pre {
    margin: 0;
    font-size: 0.7rem;
    max-height: 200px;
    overflow-y: auto;
}

.history-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.history-empty-icon {
    font-size: 3rem;
    margin-bottom: 10px;
}

.clear-history-btn {
    background: var(--error-bg);
    color: var(--error-text);
    border: 1px solid var(--error-text);
}

.clear-history-btn:hover {
    filter: brightness(0.95);
}

.export-history-btn {
    background: var(--accent-light);
    color: var(--accent-color);
    border: 1px solid var(--accent-color);
}

.export-history-btn:hover {
    filter: brightness(0.95);
}

.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: space-between;
    flex-wrap: wrap;
}

.modal-footer-left {
    display: flex;
    gap: 10px;
}

.modal-footer-right {
    display: flex;
    gap: 10px;
}

/* Compare feature styles */
.compare-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--accent-color);
    margin-right: 8px;
    flex-shrink: 0;
}

.compare-btn {
    background: var(--accent-light);
    color: var(--accent-color);
    border: 1px solid var(--accent-color);
}

.compare-btn:hover:not(:disabled) {
    filter: brightness(0.95);
}

.compare-btn:disabled {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    border-color: var(--border-color);
    cursor: not-allowed;
}

/* Compare Modal - wider */
.compare-modal {
    max-width: 95vw;
    width: 1400px;
}

.compare-container {
    display: flex;
    gap: 20px;
}

.compare-panel {
    flex: 1;
    min-width: 0;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-secondary);
}

.compare-panel-header {
    background: var(--bg-tertiary);
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.compare-panel-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.compare-panel-title {
    font-weight: 600;
    color: var(--accent-color);
    font-size: 0.9rem;
    margin: 0;
}

.compare-panel-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.compare-section {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.compare-section:last-child {
    border-bottom: none;
}

.compare-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    margin-bottom: 8px;
}

.compare-param {
    display: flex;
    font-size: 0.8rem;
    margin-bottom: 4px;
}

.compare-param-label {
    color: var(--text-secondary);
    width: 90px;
    flex-shrink: 0;
}

.compare-param-value {
    color: var(--text-primary);
    font-weight: 500;
    word-break: break-word;
}

.compare-param-value.diff {
    background: #fef3c7;
    padding: 0 4px;
    border-radius: 3px;
}

[data-theme="dark"] .compare-param-value.diff {
    background: #78350f;
}

.compare-output {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding: 0;
    border-radius: 6px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.75rem;
    max-height: 400px;
    overflow-y: auto;
}

.diff-line {
    display: flex;
    padding: 2px 8px;
    border-bottom: 1px solid var(--border-color);
    min-height: 20px;
}

.diff-line:last-child {
    border-bottom: none;
}

.diff-line-number {
    color: var(--text-muted);
    width: 30px;
    flex-shrink: 0;
    text-align: right;
    padding-right: 10px;
    user-select: none;
    border-right: 1px solid var(--border-color);
    margin-right: 8px;
}

.diff-line-content {
    white-space: pre-wrap;
    word-break: break-word;
    flex: 1;
}

.diff-line.diff-removed {
    background: var(--error-bg);
}

.diff-line.diff-removed .diff-line-content {
    color: var(--error-text);
}

.diff-line.diff-added {
    background: var(--success-bg);
}

.diff-line.diff-added .diff-line-content {
    color: var(--success-text);
}

.diff-line.diff-unchanged {
    background: var(--bg-secondary);
}

.diff-line.diff-unchanged .diff-line-content {
    color: var(--text-tertiary);
}

.diff-line.diff-partial {
    background: var(--bg-secondary);
}

.char-same {
    /* No highlight for matching characters */
}

.char-diff-left {
    color: #991b1b;
    background: #fee2e2;
}

.char-diff-right {
    color: #166534;
    background: #dcfce7;
}

[data-theme="dark"] .char-diff-left {
    color: #fca5a5;
    background: #450a0a;
}

[data-theme="dark"] .char-diff-right {
    color: #6ee7b7;
    background: #064e3b;
}

.compare-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 1.5rem;
    padding: 0 5px;
}

.compare-selection-info {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-secondary);
    padding: 8px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    margin-bottom: 15px;
}

@media (max-width: 900px) {
    .compare-container {
        flex-direction: column;
    }
    .compare-divider {
        transform: rotate(90deg);
        padding: 10px 0;
    }
}
