/**
 * WISE Admin Panel - Main Styles
 * Inspired by aitopvisa.com dark theme with purple/pink gradients
 */

:root {
    /* Dark Theme Colors (Default) */
    --bg-primary: #0a0a0f;
    --bg-secondary: #1a1a2e;
    --bg-card: #16213e;
    --bg-hover: #1f2937;
    --border-color: #2d3748;
    --text-primary: #f7fafc;
    --text-secondary: #a0aec0;
    --text-muted: #718096;
    
    /* Accent colors */
    --accent-purple: #3b82f6;
    --accent-pink: #2563eb;
    --accent-blue: #3b82f6;
    --accent-green: #48bb78;
    --accent-red: #f56565;
    --accent-orange: #f6ad55;
    
    /* Gradients - dark neutral buttons */
    --gradient-primary: #111827;
    --gradient-secondary: #1f2937;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 20px rgba(0, 0, 0, 0.15);
    
    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    
    /* Border radius */
    --radius-sm: 0.25rem;
    --radius-md: 0.375rem;
    --radius-lg: 0.5rem;
    --radius-xl: 0.75rem;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 300ms ease;
}

/* Light Theme - Wise/Stripe inspired, calm and professional */
[data-theme="light"] {
    /* Light Theme Colors - четкая финансовая палитра */
    --bg-primary: #fafafa;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-hover: #f9fafb;
    --border-color: #e5e7eb;
    --text-primary: #111827;
    --text-secondary: #374151;
    --text-muted: #6b7280;
    
    /* Light Theme Shadows - минимальные, четкие */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-xl: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-glow: 0 0 0 1px rgba(0, 0, 0, 0.05);
    
    /* Light Theme Accents - четкий синий */
    --accent-purple: #0066cc;
    --accent-pink: #0066cc;
    --accent-blue: #0066cc;
    --accent-green: #10b981;
    --accent-red: #ef4444;
    --accent-orange: #f59e0b;
    
    /* Light Theme Gradients - спокойный синий */
    --gradient-primary: #0066cc;
    --gradient-secondary: #0052a3;
}

/* Light Theme 2 - Wise/Stripe inspired, ultra-minimal financial design */
[data-theme="light2"] {
    /* Pure white backgrounds */
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-card: #ffffff;
    --bg-hover: #f3f4f6;
    --border-color: #e5e7eb;
    --text-primary: #1f2937;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    
    /* Wise green accent - clean financial look */
    --accent-purple: #00b856;
    --accent-pink: #00a04d;
    --accent-blue: #163300;
    --accent-green: #00b856;
    --accent-red: #dc2626;
    --accent-orange: #f59e0b;
    
    /* No gradients - flat colors only */
    --gradient-primary: #00b856;
    --gradient-secondary: #00a04d;
    
    /* Minimal shadows - almost flat */
    --shadow-sm: none;
    --shadow-md: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-xl: 0 2px 4px rgba(0, 0, 0, 0.08);
    --shadow-glow: none;
    
    /* Tighter radius for cleaner look */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 10px;
}

/* Light Theme 3 - clean financial dashboard */
[data-theme="light3"] {
    --bg-primary: #f5f7fb;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-hover: #f1f4f9;
    --border-color: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    
    --accent-purple: #2563eb;
    --accent-pink: #1d4ed8;
    --accent-blue: #2563eb;
    --accent-green: #16a34a;
    --accent-red: #dc2626;
    --accent-orange: #f97316;
    
    --gradient-primary: #2563eb;
    --gradient-secondary: #1d4ed8;
    
    --shadow-sm: 0 1px 0 rgba(15, 23, 42, 0.06);
    --shadow-md: 0 4px 8px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 8px 16px rgba(15, 23, 42, 0.08);
    --shadow-xl: 0 12px 24px rgba(15, 23, 42, 0.1);
    --shadow-glow: 0 0 0 1px rgba(37, 99, 235, 0.12);
    
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 10px;
}

/* Light Theme Specific Styles */
[data-theme="light"] body {
    background: var(--bg-primary);
}

/* Light Theme 2 Specific Styles */
[data-theme="light2"] body {
    background: var(--bg-secondary);
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
    letter-spacing: -0.01em;
}

/* Light Theme 3 Specific Styles */
[data-theme="light3"] body {
    background: var(--bg-primary);
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
    letter-spacing: -0.01em;
}

[data-theme="light"] .sidebar {
    background: var(--bg-card);
    border-right-color: var(--border-color);
    box-shadow: none;
}

[data-theme="light"] header {
    background: var(--bg-card);
    border-bottom: 1px solid #e5e7eb;
    box-shadow: none;
}

[data-theme="light"] .table {
    background: var(--bg-card);
}

[data-theme="light"] .table thead {
    background: var(--bg-primary);
}

[data-theme="light"] .input,
[data-theme="light"] .textarea,
[data-theme="light"] .select {
    background: var(--bg-card);
    border: 1px solid #d1d5db;
    color: var(--text-primary);
}

[data-theme="light"] .input:hover:not(:focus),
[data-theme="light"] .textarea:hover:not(:focus),
[data-theme="light"] .select:hover:not(:focus) {
    border-color: #9ca3af;
}

[data-theme="light"] .input:focus,
[data-theme="light"] .textarea:focus,
[data-theme="light"] .select:focus {
    border-color: #0066cc;
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
    outline: none;
}

[data-theme="light"] ::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

[data-theme="light"] ::-webkit-scrollbar-thumb {
    background: var(--border-color);
}

[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ===== LIGHT2 THEME - Wise/Stripe Ultra-Minimal ===== */
[data-theme="light2"] .sidebar {
    background: var(--bg-card);
    border-right: 1px solid var(--border-color);
    box-shadow: none;
}

[data-theme="light2"] header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    box-shadow: none;
}

[data-theme="light2"] .table {
    background: var(--bg-card);
}

[data-theme="light2"] .table thead {
    background: var(--bg-secondary);
}

[data-theme="light2"] .input,
[data-theme="light2"] .textarea,
[data-theme="light2"] .select {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 6px;
    transition: border-color 0.15s ease;
}

[data-theme="light2"] .input:hover:not(:focus),
[data-theme="light2"] .textarea:hover:not(:focus),
[data-theme="light2"] .select:hover:not(:focus) {
    border-color: #d1d5db;
}

[data-theme="light2"] .input:focus,
[data-theme="light2"] .textarea:focus,
[data-theme="light2"] .select:focus {
    border-color: #00b856;
    box-shadow: 0 0 0 2px rgba(0, 184, 86, 0.15);
    outline: none;
}

[data-theme="light2"] ::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

[data-theme="light2"] ::-webkit-scrollbar-track {
    background: transparent;
}

[data-theme="light2"] ::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

[data-theme="light2"] ::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* ===== LIGHT3 THEME - Crisp financial clarity ===== */
[data-theme="light3"] .sidebar {
    background: var(--bg-card);
    border-right: 1px solid var(--border-color);
    box-shadow: none;
}

[data-theme="light3"] header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    box-shadow: none;
}

[data-theme="light3"] .table {
    background: var(--bg-card);
}

[data-theme="light3"] .table thead {
    background: #f8fafc;
    border-bottom: 1px solid var(--border-color);
}

[data-theme="light3"] .input,
[data-theme="light3"] .textarea,
[data-theme="light3"] .select {
    background: var(--bg-card);
    border: 1px solid #cbd5e1;
    color: var(--text-primary);
    border-radius: 6px;
    transition: border-color 0.15s ease;
}

[data-theme="light3"] .input:hover:not(:focus),
[data-theme="light3"] .textarea:hover:not(:focus),
[data-theme="light3"] .select:hover:not(:focus) {
    border-color: #94a3b8;
}

[data-theme="light3"] .input:focus,
[data-theme="light3"] .textarea:focus,
[data-theme="light3"] .select:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
    outline: none;
}

[data-theme="light3"] ::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

[data-theme="light3"] ::-webkit-scrollbar-track {
    background: transparent;
}

[data-theme="light3"] ::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

[data-theme="light3"] ::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
    overflow-y: scroll;
    width: 100%;
    max-width: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: var(--spacing-md);
}

h1 { font-size: 2.25rem; }
h2 { font-size: 1.875rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

p {
    margin-bottom: var(--spacing-md);
}

a {
    color: var(--accent-purple);
    text-decoration: none;
    transition: color var(--transition-base);
}

a:hover {
    color: var(--accent-pink);
}

[data-theme="light"] a {
    color: #0066cc;
    text-decoration: none;
}

[data-theme="light"] a:hover {
    color: #0052a3;
    text-decoration: none;
}

[data-theme="light2"] a {
    color: #00b856;
    text-decoration: none;
}

[data-theme="light2"] a:hover {
    color: #00a04d;
    text-decoration: none;
}

[data-theme="light3"] a {
    color: #1d4ed8;
    text-decoration: none;
}

[data-theme="light3"] a:hover {
    color: #1e40af;
    text-decoration: none;
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

.main-content {
    flex: 1;
    margin-left: 260px;
    transition: margin-left 0.3s ease;
    width: calc(100% - 260px);
    max-width: calc(100% - 260px);
    min-width: 0;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 15px;
    width: 100%;
    box-sizing: border-box;
}

.container-fluid {
    padding: 15px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-width: 0;
}

/* Grid */
.grid {
    display: grid;
    gap: var(--spacing-lg);
}

.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

/* Flex utilities */
.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

.gap-sm { gap: var(--spacing-sm); }
.gap-md { gap: var(--spacing-md); }
.gap-lg { gap: var(--spacing-lg); }

/* Spacing utilities */
.mt-sm { margin-top: var(--spacing-sm); }
.mt-md { margin-top: var(--spacing-md); }
.mt-lg { margin-top: var(--spacing-lg); }
.mt-xl { margin-top: var(--spacing-xl); }

.mb-sm { margin-bottom: var(--spacing-sm); }
.mb-md { margin-bottom: var(--spacing-md); }
.mb-lg { margin-bottom: var(--spacing-lg); }
.mb-xl { margin-bottom: var(--spacing-xl); }

.p-sm { padding: var(--spacing-sm); }
.p-md { padding: var(--spacing-md); }
.p-lg { padding: var(--spacing-lg); }
.p-xl { padding: var(--spacing-xl); }

/* Text utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-sm { font-size: 0.875rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }

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

.font-bold { font-weight: 600; }
.font-semibold { font-weight: 500; }

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

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: var(--radius-md);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Theme Toggle Button */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.theme-toggle:hover {
    background: var(--bg-hover);
    border-color: var(--accent-purple);
    transform: scale(1.05);
}

[data-theme="light"] .theme-toggle {
    background: var(--bg-card);
    border: 1px solid #e5e7eb;
    color: #6b7280;
}

[data-theme="light"] .theme-toggle:hover {
    background: #f9fafb;
    border-color: #d1d5db;
    transform: none;
    color: var(--text-primary);
}

[data-theme="light2"] .theme-toggle {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    border-radius: 6px;
}

[data-theme="light2"] .theme-toggle:hover {
    background: var(--bg-hover);
    border-color: #00b856;
    color: #00b856;
    transform: none;
}

[data-theme="light3"] .theme-toggle {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: 6px;
}

[data-theme="light3"] .theme-toggle:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: var(--text-primary);
    transform: none;
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
    transition: transform var(--transition-base), opacity var(--transition-base);
}

.theme-toggle .icon-sun {
    position: absolute;
    opacity: 0;
    transform: rotate(90deg);
}

.theme-toggle .icon-moon {
    opacity: 1;
    transform: rotate(0deg);
}

[data-theme="light"] .theme-toggle .icon-sun {
    opacity: 1;
    transform: rotate(0deg);
}

[data-theme="light"] .theme-toggle .icon-moon {
    opacity: 0;
    transform: rotate(-90deg);
}

[data-theme="light3"] .theme-toggle .icon-sun {
    opacity: 1;
    transform: rotate(0deg);
}

[data-theme="light3"] .theme-toggle .icon-moon {
    opacity: 0;
    transform: rotate(-90deg);
}

/* Light2 uses a special icon (will show Wise-style icon) */
[data-theme="light2"] .theme-toggle .icon-sun {
    opacity: 0;
    transform: rotate(90deg);
}

[data-theme="light2"] .theme-toggle .icon-moon {
    opacity: 0;
    transform: rotate(-90deg);
}

[data-theme="light2"] .theme-toggle .icon-wise {
    opacity: 1;
    transform: rotate(0deg);
}

/* Theme Switcher Tabs */
.theme-tab {
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
}

.theme-tab:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.theme-tab.active {
    background: var(--bg-card);
    color: var(--text-primary);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.fade-in {
    animation: fadeIn var(--transition-base);
}

.slide-in {
    animation: slideIn var(--transition-base);
}

/* Page transition animations */
@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

.page-content {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.container-fluid.page-content {
    margin-top: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.page-content.fade-out {
    animation: fadeOut 0.22s ease-in forwards;
}

/* Suppress all transitions until page is ready — prevents layout shift on load */
html:not(.transitions-ready) *,
html:not(.transitions-ready) *::before,
html:not(.transitions-ready) *::after {
    transition: none !important;
}

/* =====================================================
   MOBILE RESPONSIVE STYLES
   ===================================================== */

/* Prevent horizontal scroll */
html, body {
    overflow-x: hidden;
}

/* Global input/select improvements for mobile */
@media (max-width: 767px) {
    /* Prevent zoom on input focus on iOS */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="date"],
    input[type="tel"],
    input[type="url"],
    select,
    textarea {
        font-size: 16px !important;
    }
    
    /* Ensure inputs don't overflow */
    .input, .select, .textarea {
        max-width: 100%;
        box-sizing: border-box;
    }
    
    /* Better touch targets */
    .btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .btn-sm {
        min-height: 36px;
        padding: 0.5rem 0.75rem;
    }
    
    .btn-icon {
        min-width: 36px;
        min-height: 36px;
    }
    
    /* Cards padding adjustment */
    .card {
        padding: 1rem;
    }
    
    /* Flex containers wrap */
    .flex {
        flex-wrap: wrap;
    }
    
    /* Gap adjustments */
    .gap-md {
        gap: 0.75rem;
    }
    
    /* Date inputs specific fix */
    input[type="date"] {
        -webkit-appearance: none;
        appearance: none;
        min-width: 0;
        width: 100%;
    }
}

@media (max-width: 480px) {
    /* Even smaller padding on very small screens */
    .card {
        padding: 0.75rem;
    }
    
    /* Smaller font sizes */
    .btn {
        font-size: 0.875rem;
    }
    
    /* Page padding */
    .page-content {
        padding: 0.5rem;
    }
    
    /* Hide certain text on very small screens */
    .hide-xs {
        display: none !important;
    }
}
