/**
 * Main CSS Styles for JSONify.xyz
 * 
 * This file contains custom styles that complement TailwindCSS.
 * Includes animations, custom components, and responsive utilities.
 * 
 * @author JSONify.xyz Development Team
 * @version 1.0.0
 */

/* Custom CSS Variables for theming */
:root {
    --primary-50: #eff6ff;
    --primary-100: #dbeafe;
    --primary-200: #bfdbfe;
    --primary-300: #93c5fd;
    --primary-400: #60a5fa;
    --primary-500: #3b82f6;
    --primary-600: #2563eb;
    --primary-700: #1d4ed8;
    --primary-800: #1e40af;
    --primary-900: #1e3a8a;
}

/* Dark mode variables */
.dark {
    --primary-50: #1e3a8a;
    --primary-100: #1e40af;
    --primary-200: #1d4ed8;
    --primary-300: #2563eb;
    --primary-400: #3b82f6;
    --primary-500: #60a5fa;
    --primary-600: #93c5fd;
    --primary-700: #bfdbfe;
    --primary-800: #dbeafe;
    --primary-900: #eff6ff;
}

/* Smooth scrolling for the entire page */
html {
    scroll-behavior: smooth;
}

/* Custom scrollbar styles */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.dark ::-webkit-scrollbar-track {
    background: #1e293b;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.dark ::-webkit-scrollbar-thumb {
    background: #475569;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.dark ::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* Focus styles for accessibility */
*:focus {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
}

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

.focus\:not-sr-only:focus {
    position: static;
    width: auto;
    height: auto;
    padding: 0.5rem 1rem;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* Animation classes */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(-25%);
        animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
    }
    50% {
        transform: translateY(0);
        animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
    }
}

.animate-fadeIn {
    animation: fadeIn 0.5s ease-out;
}

.animate-slideIn {
    animation: slideIn 0.3s ease-out;
}

.animate-pulse-custom {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.animate-bounce-custom {
    animation: bounce 1s infinite;
}

/* Custom gradient backgrounds */
.gradient-primary {
    background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
}

.gradient-secondary {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
}

.gradient-success {
    background: linear-gradient(135deg, #10b981, #059669);
}

.gradient-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.gradient-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

/* JSON syntax highlighting */
.json-key {
    color: #0066cc;
}

.dark .json-key {
    color: #66b3ff;
}

.json-string {
    color: #008000;
}

.dark .json-string {
    color: #90ee90;
}

.json-number {
    color: #ff6600;
}

.dark .json-number {
    color: #ffaa66;
}

.json-boolean {
    color: #cc00cc;
}

.dark .json-boolean {
    color: #ff66ff;
}

.json-null {
    color: #999999;
}

.dark .json-null {
    color: #cccccc;
}

/* Code editor styles */
.code-editor {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 14px;
    line-height: 1.5;
    tab-size: 4;
}

.code-editor:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--primary-500);
}

/* Line numbers for code editor */
.line-numbers {
    background: #f8fafc;
    border-right: 1px solid #e2e8f0;
    color: #64748b;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 12px;
    line-height: 1.5;
    padding: 0.5rem;
    text-align: right;
    user-select: none;
    white-space: nowrap;
}

.dark .line-numbers {
    background: #1e293b;
    border-right-color: #374151;
    color: #9ca3af;
}

/* Toast notification styles */
.toast {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    max-width: 400px;
    padding: 1rem;
    pointer-events: auto;
    transform: translateX(100%);
    transition: all 0.3s ease-in-out;
}

.dark .toast {
    background: #374151;
    color: white;
}

.toast.show {
    transform: translateX(0);
}

.toast.success {
    border-left: 4px solid #10b981;
}

.toast.error {
    border-left: 4px solid #ef4444;
}

.toast.warning {
    border-left: 4px solid #f59e0b;
}

.toast.info {
    border-left: 4px solid #3b82f6;
}

/* Loading spinner */
.spinner {
    animation: spin 1s linear infinite;
    border: 2px solid #f3f4f6;
    border-radius: 50%;
    border-top: 2px solid var(--primary-500);
    height: 20px;
    width: 20px;
}

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

/* Dropdown menu animations */
.dropdown-enter {
    opacity: 0;
    transform: scale(0.95) translateY(-10px);
}

.dropdown-enter-active {
    opacity: 1;
    transform: scale(1) translateY(0);
    transition: all 0.2s ease-out;
}

.dropdown-exit {
    opacity: 1;
    transform: scale(1) translateY(0);
}

.dropdown-exit-active {
    opacity: 0;
    transform: scale(0.95) translateY(-10px);
    transition: all 0.15s ease-in;
}

/* Button hover effects */
.btn-hover-lift {
    transition: all 0.2s ease;
}

.btn-hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Card hover effects */
.card-hover {
    transition: all 0.3s ease;
}

.card-hover:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Progress bar */
.progress-bar {
    background: linear-gradient(90deg, var(--primary-500), var(--primary-600));
    border-radius: 9999px;
    height: 8px;
    transition: width 0.3s ease;
}

/* Custom checkbox and radio styles */
.custom-checkbox {
    appearance: none;
    background: white;
    border: 2px solid #d1d5db;
    border-radius: 0.25rem;
    height: 1.25rem;
    position: relative;
    width: 1.25rem;
}

.custom-checkbox:checked {
    background: var(--primary-500);
    border-color: var(--primary-500);
}

.custom-checkbox:checked::after {
    content: '✓';
    color: white;
    font-size: 0.75rem;
    left: 50%;
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
}

.dark .custom-checkbox {
    background: #374151;
    border-color: #4b5563;
}

/* File upload drag and drop styles */
.file-drop-zone {
    border: 2px dashed #d1d5db;
    border-radius: 0.5rem;
    padding: 2rem;
    text-align: center;
    transition: all 0.3s ease;
}

.file-drop-zone.dragover {
    border-color: var(--primary-500);
    background: var(--primary-50);
}

.dark .file-drop-zone {
    border-color: #4b5563;
}

.dark .file-drop-zone.dragover {
    border-color: var(--primary-400);
    background: rgba(59, 130, 246, 0.1);
}

/* Responsive utilities */
@media (max-width: 640px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
    
    .bg-gray-50,
    .bg-gray-100,
    .bg-gray-800,
    .bg-gray-900 {
        background: white !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .text-gray-500,
    .text-gray-400 {
        color: #000000 !important;
    }
    
    .dark .text-gray-500,
    .dark .text-gray-400 {
        color: #ffffff !important;
    }
}

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

/* RTL language support */
[dir="rtl"] {
    text-align: right;
}

[dir="rtl"] .space-x-2 > * + * {
    margin-left: 0;
    margin-right: 0.5rem;
}

[dir="rtl"] .space-x-4 > * + * {
    margin-left: 0;
    margin-right: 1rem;
}

[dir="rtl"] .ml-2 {
    margin-left: 0;
    margin-right: 0.5rem;
}

[dir="rtl"] .mr-2 {
    margin-right: 0;
    margin-left: 0.5rem;
}

/* Custom utility classes */
.text-shadow {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.backdrop-blur-xs {
    backdrop-filter: blur(2px);
}

.backdrop-blur-sm {
    backdrop-filter: blur(4px);
}

.backdrop-blur-md {
    backdrop-filter: blur(8px);
}

.backdrop-blur-lg {
    backdrop-filter: blur(16px);
}
