/* Custom V2 Styles for Company Data Application */

/* Tailwind @layer directives */
@layer base {
    /* Base styles */
    body {
        font-family: 'Inter', sans-serif;
    }
}

@layer components {
    /* Custom component styles */
    .btn-primary {
        @apply px-5 py-3 text-base font-medium text-center text-white bg-primary-700 rounded-lg hover:bg-primary-800 focus:ring-4 focus:ring-primary-300 dark:bg-primary-600 dark:hover:bg-primary-700 dark:focus:ring-primary-800;
    }

    .card {
        @apply bg-white rounded-lg shadow dark:bg-gray-800;
    }
}

@layer utilities {
    /* Custom utility classes */
    .text-balance {
        text-wrap: balance;
    }
}

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

/* Smooth transitions */
* {
    transition-property: color, background-color, border-color;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

/* Dark mode improvements */
.dark {
    color-scheme: dark;
}

/* Sidebar animation */
#sidebar {
    transition: transform 0.3s ease-in-out;
}

/* Mobile sidebar hidden state */
@media (max-width: 1024px) {
    #sidebar.hidden {
        transform: translateX(-100%);
    }
}

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

::-webkit-scrollbar-track {
    background: transparent;
}

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

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

::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

.dark ::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
}

/* ag-Grid dark mode enhancements */
.ag-theme-alpine-dark {
    --ag-background-color: #1f2937;
    --ag-header-background-color: #111827;
    --ag-odd-row-background-color: #1f2937;
    --ag-row-hover-color: #374151;
    --ag-border-color: #374151;
    --ag-foreground-color: #f9fafb;
    --ag-secondary-foreground-color: #d1d5db;
}

/* Cytoscape container styling */
#cytoscape-container {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.dark #cytoscape-container {
    border-color: #374151;
}

/* Toast notifications */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    min-width: 300px;
    padding: 16px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideIn 0.3s ease-out;
    z-index: 9999;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.success {
    background-color: #10b981;
    color: white;
}

.toast.error {
    background-color: #ef4444;
    color: white;
}

/* Search autocomplete dropdown */
.search-autocomplete {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e5e7eb;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-height: 300px;
    overflow-y: auto;
    z-index: 50;
}

.dark .search-autocomplete {
    background: #1f2937;
    border-color: #374151;
}

.search-autocomplete-item {
    padding: 12px 16px;
    cursor: pointer;
    transition: background-color 0.15s;
}

.search-autocomplete-item:hover {
    background-color: #f3f4f6;
}

.dark .search-autocomplete-item:hover {
    background-color: #374151;
}

/* Loading spinner */
.spinner {
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-top-color: #3b82f6;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

.dark .spinner {
    border-color: rgba(255, 255, 255, 0.1);
    border-top-color: #60a5fa;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Skeleton loading */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

.dark .skeleton {
    background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
    background-size: 200% 100%;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Print styles */
@media print {
    #sidebar,
    #navbar,
    .no-print {
        display: none !important;
    }

    #main-content {
        margin-left: 0 !important;
    }
}
