/* HTML Tree Generator Styles */

/* Input Method Transitions */
.input-method {
    transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
}

.input-method.hidden {
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
}

/* Tree Visualization Styles */
.tree-node {
    margin-left: 20px;
    border-left: 2px solid #e5e7eb;
    padding-left: 12px;
    margin-bottom: 4px;
    position: relative;
    transition: all 0.2s ease-in-out;
}

.tree-node:hover {
    background-color: #f9fafb;
    border-radius: 4px;
    margin-left: 16px;
    padding-left: 16px;
}

.tree-node::before {
    content: "";
    position: absolute;
    left: -2px;
    top: 16px;
    width: 12px;
    height: 2px;
    background-color: #e5e7eb;
}

.tree-node.root {
    margin-left: 0;
    border-left: none;
    padding-left: 0;
}

.tree-node.root::before {
    display: none;
}

/* Tree Node Elements */
.tree-element {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    position: relative;
}

.tree-element:hover {
    background-color: #eef2ff;
    transform: translateX(2px);
}

.tree-element.selected {
    background-color: #ddd6fe;
    border: 1px solid #a78bfa;
}

/* Toggle Button */
.tree-toggle {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: #6366f1;
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-right: 8px;
    font-size: 12px;
    transition: all 0.2s ease-in-out;
}

.tree-toggle:hover {
    background-color: #4f46e5;
    transform: scale(1.1);
}

.tree-toggle.collapsed {
    background-color: #9ca3af;
}

.tree-toggle.collapsed:hover {
    background-color: #6b7280;
}

/* Tag Styling */
.tree-tag {
    font-family: "Monaco", "Menlo", "Ubuntu Mono", monospace;
    font-weight: 600;
    color: #1e40af;
    margin-right: 6px;
}

.tree-tag.self-closing {
    color: #7c3aed;
}

/* Attributes */
.tree-attributes {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-left: 8px;
}

.tree-attribute {
    background-color: #fef3c7;
    color: #92400e;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-family: monospace;
    border: 1px solid #fcd34d;
}

.tree-attribute.id {
    background-color: #dbeafe;
    color: #1d4ed8;
    border-color: #93c5fd;
}

.tree-attribute.class {
    background-color: #dcfce7;
    color: #166534;
    border-color: #86efac;
}

/* Text Content */
.tree-text {
    color: #374151;
    font-style: italic;
    margin-left: 8px;
    background-color: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Children Container */
.tree-children {
    transition: all 0.3s ease-in-out;
    overflow: hidden;
}

.tree-children.collapsed {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
}

.tree-children.expanded {
    max-height: none;
    opacity: 1;
    margin-top: 4px;
}

/* Statistics Cards */
.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.stat-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(-100%);
    transition: transform 0.3s ease-in-out;
}

.stat-card:hover::before {
    transform: translateX(100%);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 8px;
    position: relative;
    z-index: 1;
}

.stat-label {
    font-size: 0.875rem;
    opacity: 0.9;
    position: relative;
    z-index: 1;
}

/* Tag Count Chart */
.tag-chart {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.tag-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    background-color: #f9fafb;
    border-radius: 6px;
    transition: background-color 0.2s ease-in-out;
}

.tag-bar:hover {
    background-color: #f3f4f6;
}

.tag-name {
    font-family: monospace;
    font-weight: 600;
    color: #4338ca;
    min-width: 80px;
}

.tag-progress {
    flex: 1;
    height: 8px;
    background-color: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

.tag-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #8b5cf6, #06b6d4);
    border-radius: 4px;
    transition: width 0.5s ease-in-out;
    animation: progressSlide 0.8s ease-out;
}

@keyframes progressSlide {
    from {
        width: 0;
    }
}

.tag-count {
    font-weight: 600;
    color: #374151;
    min-width: 30px;
    text-align: right;
}

/* Score Displays */
.score-display {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    margin-bottom: 16px;
}

.score-excellent {
    background: conic-gradient(from 0deg, #10b981, #34d399, #10b981);
}

.score-good {
    background: conic-gradient(from 0deg, #f59e0b, #fbbf24, #f59e0b);
}

.score-poor {
    background: conic-gradient(from 0deg, #ef4444, #f87171, #ef4444);
}

.score-display::after {
    content: "";
    position: absolute;
    inset: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
}

.score-display span {
    position: relative;
    z-index: 1;
}

/* Issue Lists */
.issue-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.issue-item {
    padding: 12px;
    border-radius: 8px;
    border-left: 4px solid;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.issue-item.error {
    background-color: #fef2f2;
    border-left-color: #ef4444;
}

.issue-item.warning {
    background-color: #fffbeb;
    border-left-color: #f59e0b;
}

.issue-item.info {
    background-color: #eff6ff;
    border-left-color: #3b82f6;
}

.issue-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin-top: 2px;
}

.issue-content h4 {
    font-weight: 600;
    margin-bottom: 4px;
}

.issue-content p {
    font-size: 0.875rem;
    opacity: 0.8;
    margin: 0;
}

/* Recommendations */
.recommendations-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.recommendation-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 12px;
    background-color: #f0f9ff;
    border-radius: 6px;
    border: 1px solid #e0f2fe;
}

.recommendation-item::before {
    content: "💡";
    font-size: 16px;
    margin-top: 2px;
}

/* Element Tables */
.element-table {
    width: 100%;
    border-collapse: collapse;
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.element-table th {
    background-color: #f8fafc;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #374151;
    border-bottom: 2px solid #e5e7eb;
}

.element-table td {
    padding: 12px;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: top;
}

.element-table tbody tr:hover {
    background-color: #f9fafb;
}

.element-table code {
    background-color: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.875rem;
}

/* Loading States */
.loading-shimmer {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Button Loading States */
.btn-loading {
    position: relative;
    pointer-events: none;
}

.btn-loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Message Animations */
.message-enter {
    animation: slideInRight 0.3s ease-out;
}

.message-exit {
    animation: slideOutRight 0.3s ease-in;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* File Drop Zone */
.file-drop-active {
    border-color: #6366f1 !important;
    background-color: #eef2ff;
}

.file-drop-active::after {
    content: "Drop file here!";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #6366f1;
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
    z-index: 10;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .tree-node {
        margin-left: 16px;
    }

    .tree-attributes {
        flex-direction: column;
        align-items: flex-start;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-number {
        font-size: 2rem;
    }

    .element-table {
        font-size: 0.875rem;
    }

    .element-table th,
    .element-table td {
        padding: 8px;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .tree-node {
        border-left-color: #000;
    }

    .tree-element:hover {
        background-color: #000;
        color: #fff;
    }

    .tree-toggle {
        border: 2px solid #000;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Print Styles */
@media print {
    .tree-element:hover {
        background-color: transparent;
    }

    .stat-card {
        background: #f3f4f6 !important;
        color: #000 !important;
        box-shadow: none;
    }

    .tree-toggle {
        background-color: #000 !important;
        color: #fff !important;
    }
}
