/* URS Theme System - Tenant-based CSS Variables */

:root {
    /* Brand Colors */
    --brand-primary: #4f46e5;
    --brand-primary-hover: #4338ca;
    --brand-primary-light: #eef2ff;
    --brand-secondary: #7c3aed;
    --brand-accent: #06b6d4;
    
    /* Neutral Colors */
    --color-gray-50: #f9fafb;
    --color-gray-100: #f3f4f6;
    --color-gray-200: #e5e7eb;
    --color-gray-300: #d1d5db;
    --color-gray-400: #9ca3af;
    --color-gray-500: #6b7280;
    --color-gray-600: #4b5563;
    --color-gray-700: #374151;
    --color-gray-800: #1f2937;
    --color-gray-900: #111827;
    
    /* Status Colors */
    --color-success: #10b981;
    --color-success-light: #d1fae5;
    --color-warning: #f59e0b;
    --color-warning-light: #fef3c7;
    --color-error: #ef4444;
    --color-error-light: #fee2e2;
    --color-info: #3b82f6;
    --color-info-light: #dbeafe;
    
    /* Layout */
    --sidebar-width: 256px;
    --header-height: 64px;
    --border-radius: 0.5rem;
    --border-radius-lg: 0.75rem;
    --border-radius-xl: 1rem;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    
    /* Transitions */
    --transition-fast: 150ms;
    --transition-normal: 200ms;
    --transition-slow: 300ms;
}

/* Tenant: utaksis */
[data-tenant="utaksis"] {
    --brand-primary: #7c3aed;
    --brand-primary-hover: #6d28d9;
    --brand-primary-light: #f5f3ff;
    --brand-secondary: #8b5cf6;
}

/* Tenant: demo */
[data-tenant="demo"] {
    --brand-primary: #4f46e5;
    --brand-primary-hover: #4338ca;
    --brand-primary-light: #eef2ff;
    --brand-secondary: #6366f1;
}

/* Tenant: poloptech */
[data-tenant="poloptech"] {
    --brand-primary: #0d9488;
    --brand-primary-hover: #0f766e;
    --brand-primary-light: #f0fdfa;
    --brand-secondary: #14b8a6;
}

/* Global Styles */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--color-gray-100);
}

::-webkit-scrollbar-thumb {
    background: var(--color-gray-300);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-gray-400);
}

/* Focus States */
*:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: 2px;
}

/* Custom Utilities */
.bg-brand-primary {
    background-color: var(--brand-primary);
}

.bg-brand-primary-hover:hover {
    background-color: var(--brand-primary-hover);
}

.bg-brand-light {
    background-color: var(--brand-primary-light);
}

.text-brand-primary {
    color: var(--brand-primary);
}

.border-brand-primary {
    border-color: var(--brand-primary);
}

.ring-brand-primary {
    --tw-ring-color: var(--brand-primary);
}

/* Gradient backgrounds */
.bg-brand-gradient {
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-secondary) 100%);
}

/* Card Styles */
.card {
    background: white;
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--color-gray-200);
    box-shadow: var(--shadow-sm);
}

.card-hover:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--color-gray-300);
}

/* Button Base */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--border-radius);
    transition: all var(--transition-fast) ease-in-out;
    cursor: pointer;
}

.btn-primary {
    background-color: var(--brand-primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--brand-primary-hover);
}

.btn-secondary {
    background-color: white;
    color: var(--color-gray-700);
    border: 1px solid var(--color-gray-300);
}

.btn-secondary:hover {
    background-color: var(--color-gray-50);
    border-color: var(--color-gray-400);
}

/* Badge Styles */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
}

.badge-success {
    background-color: var(--color-success-light);
    color: #065f46;
}

.badge-warning {
    background-color: var(--color-warning-light);
    color: #92400e;
}

.badge-error {
    background-color: var(--color-error-light);
    color: #991b1b;
}

.badge-info {
    background-color: var(--color-info-light);
    color: #1e40af;
}

.badge-brand {
    background-color: var(--brand-primary-light);
    color: var(--brand-primary);
}

/* Sidebar Styles */
.sidebar-wrapper {
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--border-radius-lg);
    color: #94a3b8;
    transition: all var(--transition-fast) ease-in-out;
}

.sidebar-item:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: #f1f5f9;
}

.sidebar-item:hover svg {
    color: #f1f5f9;
}

.sidebar-item.active {
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-secondary) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

.sidebar-item.active svg {
    color: white;
}

.sidebar-item svg {
    color: #64748b;
    flex-shrink: 0;
}

/* Sidebar Section Titles */
.sidebar-section-title {
    color: #64748b;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 0 0.5rem;
    margin-bottom: 0.5rem;
}

/* Table Styles */
.table-container {
    overflow-x: auto;
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--color-gray-200);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background-color: var(--color-gray-50);
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-gray-500);
    border-bottom: 1px solid var(--color-gray-200);
}

.data-table td {
    padding: 0.875rem 1rem;
    font-size: 0.875rem;
    color: var(--color-gray-700);
    border-bottom: 1px solid var(--color-gray-100);
}

.data-table tbody tr:hover {
    background-color: var(--color-gray-50);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* Stat Card */
.stat-card {
    background: white;
    border-radius: var(--border-radius-xl);
    padding: 1.5rem;
    border: 1px solid var(--color-gray-200);
    box-shadow: var(--shadow-sm);
}

.stat-card-icon {
    width: 3rem;
    height: 3rem;
    border-radius: var(--border-radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-card-value {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--color-gray-900);
    line-height: 1;
}

.stat-card-label {
    font-size: 0.875rem;
    color: var(--color-gray-500);
    margin-top: 0.25rem;
}

/* Loading States */
.skeleton {
    background: linear-gradient(90deg, var(--color-gray-200) 25%, var(--color-gray-100) 50%, var(--color-gray-200) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--border-radius);
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Dropdown Animation */
.dropdown-enter {
    opacity: 0;
    transform: scale(0.95) translateY(-0.5rem);
}

.dropdown-enter-active {
    opacity: 1;
    transform: scale(1) translateY(0);
    transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.dropdown-leave {
    opacity: 1;
    transform: scale(1) translateY(0);
}

.dropdown-leave-active {
    opacity: 0;
    transform: scale(0.95) translateY(-0.5rem);
    transition: opacity var(--transition-fast), transform var(--transition-fast);
}

/* Tabulator Custom Styles */
.tabulator {
    border: none !important;
    background: transparent !important;
}

.tabulator .tabulator-header {
    background: var(--color-gray-50) !important;
    border-bottom: 1px solid var(--color-gray-200) !important;
}

.tabulator .tabulator-header .tabulator-col {
    background: transparent !important;
    border-right: none !important;
}

.tabulator .tabulator-header .tabulator-col-content {
    padding: 0.75rem 1rem !important;
}

.tabulator .tabulator-header .tabulator-col-title {
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    color: var(--color-gray-500) !important;
}

.tabulator .tabulator-tableholder .tabulator-table .tabulator-row {
    border-bottom: 1px solid var(--color-gray-100) !important;
}

.tabulator .tabulator-tableholder .tabulator-table .tabulator-row:hover {
    background: var(--color-gray-50) !important;
}

.tabulator .tabulator-tableholder .tabulator-table .tabulator-row .tabulator-cell {
    padding: 0.875rem 1rem !important;
    border-right: none !important;
    font-size: 0.875rem !important;
    color: var(--color-gray-700) !important;
}

.tabulator .tabulator-footer {
    background: var(--color-gray-50) !important;
    border-top: 1px solid var(--color-gray-200) !important;
}

/* ApexCharts Custom */
.apexcharts-tooltip {
    border-radius: var(--border-radius) !important;
    box-shadow: var(--shadow-lg) !important;
}

.apexcharts-legend-text {
    color: var(--color-gray-600) !important;
}

/* Sidebar Collapsed State */
.sidebar-collapsed .sidebar-content .sidebar-search,
.sidebar-collapsed .sidebar-content .sidebar-label,
.sidebar-collapsed .sidebar-content .sidebar-section-title,
.sidebar-collapsed .sidebar-content .sidebar-item span.flex-1,
.sidebar-collapsed .sidebar-content .sidebar-item button {
    display: none !important;
}

.sidebar-collapsed .sidebar-content .sidebar-logo {
    height: 2rem !important;
    width: 2rem !important;
    object-fit: contain;
}

.sidebar-collapsed .sidebar-content nav {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.sidebar-collapsed .sidebar-content .sidebar-item {
    justify-content: center;
    padding: 0.75rem;
}

.sidebar-collapsed .sidebar-content .sidebar-item svg {
    margin-right: 0;
}
