/**
 * Theme Styles for JSONify.xyz
 * 
 * This file contains theme-specific styles for light and dark modes.
 * Includes smooth transitions and custom theme variables.
 * 
 * @author JSONify.xyz Development Team
 * @version 1.0.0
 */

/* Theme transition for smooth mode switching */
* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Light theme (default) */
:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-tertiary: #9ca3af;
    --border-primary: #e5e7eb;
    --border-secondary: #d1d5db;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Dark theme */
.dark {
    --bg-primary: #111827;
    --bg-secondary: #1f2937;
    --bg-tertiary: #374151;
    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --text-tertiary: #9ca3af;
    --border-primary: #374151;
    --border-secondary: #4b5563;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
}

/* Theme-aware utility classes */
.bg-theme-primary {
    background-color: var(--bg-primary);
}

.bg-theme-secondary {
    background-color: var(--bg-secondary);
}

.bg-theme-tertiary {
    background-color: var(--bg-tertiary);
}

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

.text-theme-secondary {
    color: var(--text-secondary);
}

.text-theme-tertiary {
    color: var(--text-tertiary);
}

.border-theme-primary {
    border-color: var(--border-primary);
}

.border-theme-secondary {
    border-color: var(--border-secondary);
}

.shadow-theme-sm {
    box-shadow: var(--shadow-sm);
}

.shadow-theme-md {
    box-shadow: var(--shadow-md);
}

.shadow-theme-lg {
    box-shadow: var(--shadow-lg);
}

.shadow-theme-xl {
    box-shadow: var(--shadow-xl);
}

/* Theme switcher button styles */
.theme-switcher {
    position: relative;
    overflow: hidden;
}

.theme-switcher::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.2) 50%, transparent 70%);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.theme-switcher:hover::before {
    transform: translateX(100%);
}

/* Dark mode specific adjustments */
.dark .bg-white {
    background-color: #1f2937;
}

.dark .bg-gray-50 {
    background-color: #111827;
}

.dark .bg-gray-100 {
    background-color: #1f2937;
}

.dark .bg-gray-200 {
    background-color: #374151;
}

.dark .text-gray-900 {
    color: #f9fafb;
}

.dark .text-gray-800 {
    color: #f3f4f6;
}

.dark .text-gray-700 {
    color: #e5e7eb;
}

.dark .text-gray-600 {
    color: #d1d5db;
}

.dark .text-gray-500 {
    color: #9ca3af;
}

.dark .text-gray-400 {
    color: #6b7280;
}

.dark .border-gray-200 {
    border-color: #374151;
}

.dark .border-gray-300 {
    border-color: #4b5563;
}

/* Code editor dark theme */
.dark .code-editor {
    background-color: #0d1117;
    color: #e6edf3;
    border-color: #30363d;
}

.dark .code-editor:focus {
    border-color: #58a6ff;
    box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.3);
}

/* JSON syntax highlighting for dark theme */
.dark .json-key {
    color: #79c0ff;
}

.dark .json-string {
    color: #a5d6ff;
}

.dark .json-number {
    color: #79c0ff;
}

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

.dark .json-null {
    color: #8b949e;
}

/* Form elements dark theme */
.dark input[type="text"],
.dark input[type="email"],
.dark input[type="password"],
.dark textarea,
.dark select {
    background-color: #21262d;
    border-color: #30363d;
    color: #e6edf3;
}

.dark input[type="text"]:focus,
.dark input[type="email"]:focus,
.dark input[type="password"]:focus,
.dark textarea:focus,
.dark select:focus {
    border-color: #58a6ff;
    box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.3);
}

.dark input[type="text"]::placeholder,
.dark input[type="email"]::placeholder,
.dark input[type="password"]::placeholder,
.dark textarea::placeholder {
    color: #7d8590;
}

/* Button dark theme adjustments */
.dark .btn-secondary {
    background-color: #21262d;
    border-color: #30363d;
    color: #e6edf3;
}

.dark .btn-secondary:hover {
    background-color: #30363d;
    border-color: #484f58;
}

/* Dropdown dark theme */
.dark .dropdown-menu {
    background-color: #21262d;
    border-color: #30363d;
    box-shadow: 0 16px 70px rgba(1, 4, 9, 0.3);
}

.dark .dropdown-item:hover {
    background-color: #30363d;
}

/* Toast notifications dark theme */
.dark .toast {
    background-color: #21262d;
    border-color: #30363d;
    color: #e6edf3;
}

.dark .toast.success {
    border-left-color: #238636;
}

.dark .toast.error {
    border-left-color: #da3633;
}

.dark .toast.warning {
    border-left-color: #9e6a03;
}

.dark .toast.info {
    border-left-color: #1f6feb;
}

/* Loading overlay dark theme */
.dark .loading-overlay {
    background-color: rgba(1, 4, 9, 0.8);
}

.dark .loading-content {
    background-color: #21262d;
    border-color: #30363d;
    color: #e6edf3;
}

/* File upload zone dark theme */
.dark .file-drop-zone {
    background-color: #0d1117;
    border-color: #30363d;
    color: #e6edf3;
}

.dark .file-drop-zone.dragover {
    background-color: rgba(31, 111, 235, 0.1);
    border-color: #1f6feb;
}

/* Progress bar dark theme */
.dark .progress-bar-bg {
    background-color: #21262d;
}

/* Scrollbar dark theme (webkit browsers) */
.dark ::-webkit-scrollbar-track {
    background-color: #0d1117;
}

.dark ::-webkit-scrollbar-thumb {
    background-color: #30363d;
}

.dark ::-webkit-scrollbar-thumb:hover {
    background-color: #484f58;
}

/* Selection colors */
::selection {
    background-color: rgba(59, 130, 246, 0.3);
    color: inherit;
}

.dark ::selection {
    background-color: rgba(88, 166, 255, 0.3);
    color: inherit;
}

/* Focus ring colors for dark theme */
.dark *:focus {
    outline-color: #58a6ff;
}

/* High contrast mode adjustments */
@media (prefers-contrast: high) {
    :root {
        --text-primary: #000000;
        --text-secondary: #333333;
        --border-primary: #000000;
    }
    
    .dark {
        --text-primary: #ffffff;
        --text-secondary: #cccccc;
        --border-primary: #ffffff;
    }
}

/* System theme preference detection */
@media (prefers-color-scheme: dark) {
    :root:not(.light) {
        --bg-primary: #111827;
        --bg-secondary: #1f2937;
        --bg-tertiary: #374151;
        --text-primary: #f9fafb;
        --text-secondary: #d1d5db;
        --text-tertiary: #9ca3af;
        --border-primary: #374151;
        --border-secondary: #4b5563;
    }
}

/* Theme transition animations */
.theme-transition {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Smooth theme switching */
.theme-switching * {
    transition: none !important;
}

/* Theme-specific gradients */
.gradient-light {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.gradient-dark {
    background: linear-gradient(135deg, #2d3748 0%, #4a5568 100%);
}

/* Auto theme class */
.auto-theme {
    color-scheme: light dark;
}

.auto-theme.dark {
    color-scheme: dark;
}

.auto-theme.light {
    color-scheme: light;
}
