/* YAML Formatter Tool Styles */

.yaml-formatter-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Toggle Switch Styles */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #d1d5db;
    transition: 0.3s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked + .toggle-slider {
    background-color: #3b82f6;
}

input:focus + .toggle-slider {
    box-shadow: 0 0 1px #3b82f6;
}

input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

/* Quick Action Buttons */
.quick-action {
    min-width: 80px;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.quick-action:active {
    transform: scale(0.95);
}

.quick-action:hover {
    transform: scale(1.02);
}

/* Mode Button Styles */
.mode-btn.active {
    background-color: #3b82f6;
    color: white;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

.mode-btn:not(.active):hover {
    background-color: #f3f4f6;
    color: #374151;
}

/* Input/Output Areas */
#yamlInput,
#yamlOutput {
    font-family: "Consolas", "Monaco", "Courier New", "SF Mono", monospace;
    line-height: 1.6;
    background-color: #fafafa;
    border: 2px solid #e5e7eb;
    transition: all 0.2s ease;
    font-size: 13px;
    letter-spacing: 0.3px;
}

#yamlInput:focus {
    border-color: #3b82f6;
    background-color: #ffffff;
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

#yamlOutput {
    background-color: #f8fafc;
    color: #374151;
    border-color: #d1d5db;
}

#yamlInput.dragover {
    border-color: #3b82f6;
    background-color: #eff6ff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Syntax Highlighting for YAML */
.yaml-key {
    color: #7c3aed;
    font-weight: 600;
}

.yaml-value {
    color: #059669;
}

.yaml-string {
    color: #dc2626;
}

.yaml-number {
    color: #ea580c;
    font-weight: 500;
}

.yaml-boolean {
    color: #2563eb;
    font-weight: 600;
}

.yaml-null {
    color: #6b7280;
    font-style: italic;
}

.yaml-comment {
    color: #6b7280;
    font-style: italic;
}

.yaml-anchor {
    color: #c2410c;
    font-weight: 500;
}

.yaml-alias {
    color: #c2410c;
    text-decoration: underline;
}

.yaml-tag {
    color: #7c2d12;
    font-weight: 500;
}

.yaml-literal {
    color: #164e63;
    background-color: #f0f9ff;
    padding: 2px 4px;
    border-radius: 3px;
}

.yaml-folded {
    color: #164e63;
    background-color: #f0fdf4;
    padding: 2px 4px;
    border-radius: 3px;
}

/* Processing Overlay */
.processing-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
}

.processing-overlay.hidden {
    display: none;
}

/* Help Modal */
.help-modal {
    display: flex;
    align-items: center;
    justify-content: center;
}

.help-modal.hidden {
    display: none;
}

/* Toast Notifications */
#toast {
    transition: transform 0.3s ease;
}

#toast.show {
    transform: translateX(0);
}

.toast-success {
    border-left: 4px solid #10b981;
    background-color: #ecfdf5;
}

.toast-error {
    border-left: 4px solid #ef4444;
    background-color: #fef2f2;
}

.toast-warning {
    border-left: 4px solid #f59e0b;
    background-color: #fffbeb;
}

.toast-info {
    border-left: 4px solid #3b82f6;
    background-color: #eff6ff;
}

/* Copy Button Animation */
.copy-success {
    animation: copyPulse 0.3s ease;
}

@keyframes copyPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

/* Validation Results */
.validation-success {
    background-color: #dcfce7;
    color: #166534;
    padding: 12px 16px;
    border-radius: 8px;
    border-left: 4px solid #16a34a;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.validation-error {
    background-color: #fef2f2;
    color: #991b1b;
    padding: 12px 16px;
    border-radius: 8px;
    border-left: 4px solid #dc2626;
    margin-bottom: 8px;
}

.validation-warning {
    background-color: #fffbeb;
    color: #92400e;
    padding: 12px 16px;
    border-radius: 8px;
    border-left: 4px solid #f59e0b;
    margin-bottom: 8px;
}

/* Analysis Sections */
.analysis-section {
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    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;
}

/* Statistics Cards */
.stat-card {
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.stat-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-error {
    background-color: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.badge-warning {
    background-color: #fffbeb;
    color: #92400e;
    border: 1px solid #fed7aa;
}

.badge-success {
    background-color: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.badge-info {
    background-color: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

/* Complexity Indicators */
.complexity-simple {
    background-color: #dcfce7;
    color: #166534;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

.complexity-moderate {
    background-color: #fffbeb;
    color: #92400e;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

.complexity-complex {
    background-color: #fef2f2;
    color: #991b1b;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

/* Path Input Container */
.path-input-container.show {
    display: block;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading Animation */
.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    margin: auto;
    border: 2px solid transparent;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

@keyframes spin {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }
    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .yaml-formatter-container {
        padding-left: 16px;
        padding-right: 16px;
    }

    h1 {
        font-size: 28px;
    }

    .quick-action {
        min-width: 70px;
        min-height: 70px;
        padding: 12px;
    }

    .quick-action span:first-child {
        font-size: 16px;
    }

    .quick-action span:last-child {
        font-size: 10px;
    }

    .mode-btn {
        padding: 8px 12px;
        font-size: 12px;
    }

    #yamlInput,
    #yamlOutput {
        height: 250px;
        font-size: 12px;
    }

    .stat-card {
        padding: 12px;
    }

    .stat-value {
        font-size: 16px;
    }

    .stat-label {
        font-size: 10px;
    }
}

@media (max-width: 480px) {
    .yaml-formatter-container {
        padding-top: 24px;
    }

    h1 {
        font-size: 24px;
        margin-bottom: 16px;
    }

    .quick-action {
        min-width: 60px;
        min-height: 60px;
        padding: 8px;
    }

    .quick-action span:first-child {
        font-size: 14px;
        margin-bottom: 2px;
    }

    .quick-action span:last-child {
        font-size: 9px;
    }

    #yamlInput,
    #yamlOutput {
        height: 200px;
        font-size: 11px;
        padding: 12px;
    }

    .toggle-switch {
        width: 36px;
        height: 20px;
    }

    .toggle-slider:before {
        height: 14px;
        width: 14px;
        left: 3px;
        bottom: 3px;
    }

    input:checked + .toggle-slider:before {
        transform: translateX(16px);
    }
}

/* Accessibility Enhancements */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .yaml-key {
        color: #4c1d95;
        font-weight: 700;
    }

    .yaml-value {
        color: #065f46;
        font-weight: 600;
    }

    .yaml-string {
        color: #991b1b;
        font-weight: 600;
    }

    .mode-btn.active {
        background-color: #1e40af;
        border: 2px solid #1e3a8a;
    }

    .quick-action:hover {
        border-width: 3px;
    }
}

/* Print Styles */
@media print {
    .quick-action,
    .mode-btn,
    button {
        display: none;
    }

    #yamlInput,
    #yamlOutput {
        border: 1px solid #000;
        box-shadow: none;
        background: white;
        color: black;
        font-size: 10px;
        line-height: 1.4;
    }

    .yaml-formatter-container {
        max-width: none;
        padding: 0;
    }
}

/* Focus Styles for Better Accessibility */
button:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Custom Scrollbar */
#yamlInput::-webkit-scrollbar,
#yamlOutput::-webkit-scrollbar {
    width: 8px;
}

#yamlInput::-webkit-scrollbar-track,
#yamlOutput::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

#yamlInput::-webkit-scrollbar-thumb,
#yamlOutput::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

#yamlInput::-webkit-scrollbar-thumb:hover,
#yamlOutput::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Selection Styles */
#yamlInput::selection,
#yamlOutput::selection {
    background-color: #3b82f6;
    color: white;
}

#yamlInput::-moz-selection,
#yamlOutput::-moz-selection {
    background-color: #3b82f6;
    color: white;
}

/* Hover Effects */
.stat-card:hover .stat-value {
    color: #3b82f6;
}

.analysis-section:hover {
    border-color: #d1d5db;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* Animation Improvements */
.quick-action {
    transform: translateZ(0);
    backface-visibility: hidden;
}

.quick-action:hover {
    animation: hoverPulse 0.6s ease;
}

@keyframes hoverPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
    100% {
        transform: scale(1.02);
    }
}

/* Error State Enhancements */
.validation-error {
    position: relative;
    overflow: hidden;
}

.validation-error::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(239, 68, 68, 0.1), transparent);
    animation: errorShimmer 2s ease-in-out infinite;
}

@keyframes errorShimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* Success State Enhancements */
.validation-success {
    position: relative;
    overflow: hidden;
}

.validation-success::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(34, 197, 94, 0.1), transparent);
    animation: successShimmer 2s ease-in-out infinite;
}

@keyframes successShimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}
