/* XML Formatter Tool Styles */

.xml-formatter-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Toggle Switch Styles */
.toggle-switch {
    appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid #d1d5db;
    border-radius: 4px;
    background-color: #ffffff;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toggle-switch:checked {
    background-color: #10b981;
    border-color: #10b981;
}

.toggle-switch:checked::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 6px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.toggle-switch:focus {
    outline: none;
    box-shadow: 0 0 0 2px #10b981;
}

/* Quick Action Buttons */
.quick-action {
    min-width: 80px;
    min-height: 80px;
}

.quick-action:active {
    transform: scale(0.95);
}

/* Mode Button Styles */
.mode-btn.active {
    background-color: #10b981;
    color: white;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
}

.mode-btn:not(.active):hover {
    background-color: #f3f4f6;
}

/* Input/Output Areas */
#xmlInput,
#xmlOutput {
    font-family: "Consolas", "Monaco", "Courier New", monospace;
    line-height: 1.5;
    background-color: #fafafa;
    border: 2px solid #e5e7eb;
    transition: border-color 0.2s ease;
}

#xmlInput:focus {
    border-color: #10b981;
    background-color: #ffffff;
    outline: none;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

#xmlOutput {
    background-color: #f8fafc;
    color: #374151;
}

/* Syntax Highlighting */
.xml-element {
    color: #7c3aed;
    font-weight: 500;
}

.xml-attribute {
    color: #059669;
}

.xml-attribute-value {
    color: #dc2626;
}

.xml-comment {
    color: #6b7280;
    font-style: italic;
}

.xml-cdata {
    color: #b45309;
    background-color: #fef3c7;
    padding: 0 2px;
    border-radius: 2px;
}

.xml-text {
    color: #374151;
}

.xml-declaration {
    color: #7c2d12;
    font-weight: 600;
}

/* Results Section Styles */
#resultsSection {
    max-height: 500px;
    overflow-y: auto;
}

/* Validation Results */
.validation-error {
    background-color: #fef2f2;
    border-left: 4px solid #ef4444;
    padding: 12px;
    margin-bottom: 8px;
    border-radius: 0 6px 6px 0;
}

.validation-warning {
    background-color: #fffbeb;
    border-left: 4px solid #f59e0b;
    padding: 12px;
    margin-bottom: 8px;
    border-radius: 0 6px 6px 0;
}

.validation-info {
    background-color: #eff6ff;
    border-left: 4px solid #3b82f6;
    padding: 12px;
    margin-bottom: 8px;
    border-radius: 0 6px 6px 0;
}

.validation-success {
    background-color: #f0fdf4;
    border-left: 4px solid #22c55e;
    padding: 12px;
    margin-bottom: 8px;
    border-radius: 0 6px 6px 0;
}

/* Statistics Cards */
.stat-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 12px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Analysis Section */
.analysis-section {
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.analysis-title {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.analysis-content {
    font-size: 13px;
    color: #6b7280;
    line-height: 1.5;
}

/* Complexity Indicators */
.complexity-simple {
    color: #059669;
    background-color: #d1fae5;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.complexity-moderate {
    color: #d97706;
    background-color: #fed7aa;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.complexity-complex {
    color: #dc2626;
    background-color: #fecaca;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.complexity-very-complex {
    color: #7c2d12;
    background-color: #fed7aa;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

/* Toast Notification */
#toast.show {
    transform: translateX(0);
}

.toast-success #toastIcon::before {
    content: "✓";
    color: #10b981;
    font-weight: bold;
}

.toast-error #toastIcon::before {
    content: "✗";
    color: #ef4444;
    font-weight: bold;
}

.toast-warning #toastIcon::before {
    content: "⚠";
    color: #f59e0b;
    font-weight: bold;
}

.toast-info #toastIcon::before {
    content: "ℹ";
    color: #3b82f6;
    font-weight: bold;
}

/* Processing Animation */
.processing-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #e5e7eb;
    border-radius: 50%;
    border-top-color: #10b981;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* File Upload Styles */
.file-drop-zone {
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    transition: all 0.2s ease;
    cursor: pointer;
}

.file-drop-zone.dragover {
    border-color: #10b981;
    background-color: #f0fdf4;
}

.file-drop-zone:hover {
    border-color: #9ca3af;
}

/* Code Block Styles */
.code-block {
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 12px;
    font-family: "Consolas", "Monaco", "Courier New", monospace;
    font-size: 13px;
    overflow-x: auto;
    white-space: pre;
    line-height: 1.4;
}

/* XPath Input Styles */
.xpath-input-container.show {
    display: block !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .xml-formatter-container {
        padding: 16px 12px;
    }

    .quick-action {
        min-width: 60px;
        min-height: 60px;
        padding: 8px;
    }

    .quick-action span:first-child {
        font-size: 14px;
    }

    .quick-action span:last-child {
        font-size: 10px;
    }

    #xmlInput,
    #xmlOutput {
        height: 250px;
        font-size: 13px;
    }

    .grid-cols-2.md\\:grid-cols-4.lg\\:grid-cols-8 {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .grid-cols-1.lg\\:grid-cols-3 {
        gap: 16px;
    }

    .stat-card {
        padding: 12px;
    }

    .stat-value {
        font-size: 20px;
    }

    .analysis-section {
        padding: 12px;
    }
}

@media (max-width: 640px) {
    .grid-cols-2.md\\:grid-cols-4.lg\\:grid-cols-8 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .mode-btn {
        padding: 8px 12px;
        font-size: 12px;
    }

    .quick-action {
        min-width: 50px;
        min-height: 50px;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .quick-action,
    .mode-btn,
    .stat-card,
    .toggle-switch,
    #xmlInput {
        transition: none;
    }

    .processing-spinner {
        animation: none;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .xml-element {
        color: #4c1d95;
    }

    .xml-attribute {
        color: #065f46;
    }

    .xml-attribute-value {
        color: #991b1b;
    }

    .xml-comment {
        color: #374151;
    }

    .validation-error {
        border-left-width: 6px;
    }

    .validation-warning {
        border-left-width: 6px;
    }

    .validation-info {
        border-left-width: 6px;
    }

    .validation-success {
        border-left-width: 6px;
    }
}

/* Dark Mode Preparation (for future use if needed) */
@media (prefers-color-scheme: dark) {
    /* Note: Keeping light theme as requested, but structure ready for dark mode */
}

/* Print Styles */
@media print {
    .xml-formatter-container {
        background: white !important;
    }

    #toast,
    .quick-action,
    .mode-btn,
    button {
        display: none !important;
    }

    #xmlOutput {
        background: white !important;
        border: 1px solid #000 !important;
    }

    .analysis-section,
    .stat-card {
        border: 1px solid #000 !important;
        background: white !important;
    }
}

/* Focus Styles for Better Accessibility */
button:focus,
select:focus,
input:focus {
    outline: 2px solid #10b981;
    outline-offset: 2px;
}

/* Loading States */
.loading {
    pointer-events: none;
    opacity: 0.6;
    position: relative;
}

.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #e5e7eb;
    border-radius: 50%;
    border-top-color: #10b981;
    animation: spin 1s ease-in-out infinite;
}

/* Custom Scrollbar */
#resultsSection::-webkit-scrollbar,
#xmlOutput::-webkit-scrollbar,
#xmlInput::-webkit-scrollbar {
    width: 8px;
}

#resultsSection::-webkit-scrollbar-track,
#xmlOutput::-webkit-scrollbar-track,
#xmlInput::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

#resultsSection::-webkit-scrollbar-thumb,
#xmlOutput::-webkit-scrollbar-thumb,
#xmlInput::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

#resultsSection::-webkit-scrollbar-thumb:hover,
#xmlOutput::-webkit-scrollbar-thumb:hover,
#xmlInput::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Selection Styles */
::selection {
    background-color: #bfdbfe;
    color: #1e40af;
}

/* Copy Success Animation */
@keyframes copySuccess {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.copy-success {
    animation: copySuccess 0.3s ease-in-out;
}

/* Help Modal Styles */
#helpModal code {
    background-color: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: "Consolas", "Monaco", "Courier New", monospace;
    font-size: 12px;
    color: #475569;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 4px;
    background-color: #e5e7eb;
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background-color: #10b981;
    transition: width 0.3s ease;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success {
    background-color: #dcfce7;
    color: #166534;
}

.badge-error {
    background-color: #fef2f2;
    color: #991b1b;
}

.badge-warning {
    background-color: #fefce8;
    color: #a16207;
}

.badge-info {
    background-color: #eff6ff;
    color: #1d4ed8;
}

/* Utility Classes */
.font-mono {
    font-family: "Consolas", "Monaco", "Courier New", monospace;
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}
