/* BAM Intelligence - Style Guide Implementation */

:root {
    /* Brand Colors */
    --color-bg: #2d333b;
    --color-text-primary: #FFFFFF;
    --color-text-secondary: #B0B0B0;
    --color-accent: #3B82F6;
    --color-accent-hover: #1E40AF;

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 2rem;
    --spacing-lg: 4rem;
    --spacing-xl: 6rem;

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

body {
    font-family: var(--font-family);
    background-color: var(--color-bg) !important;
    color: var(--color-text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
}

/* ============================================
   GLOBAL TAILWIND OVERRIDES
   These rules override Tailwind's default classes
   to apply the dark theme globally
   ============================================ */

/* Override white backgrounds - but NOT dropdowns */
.bg-white:not(.dropdown-menu):not(.origin-top-right) {
    background-color: #3d444d !important;
    border: none !important;
}

/* Override gray backgrounds */
.bg-gray-50 {
    background-color: rgba(15, 15, 15, 0.4) !important;
}

/* Gray badges - special styling for status badges */
.bg-gray-100.rounded-full,
span.bg-gray-100 {
    background-color: #374151 !important;
    border-color: rgba(156, 163, 175, 0.5) !important;
}

/* Regular gray-100 for non-badge elements */
.bg-gray-100:not(.rounded-full):not(span) {
    background-color: rgba(15, 15, 15, 0.4) !important;
}

.bg-gray-200 {
    background-color: rgba(255, 255, 255, 0.05) !important;
}

/* Override text colors */
.text-black {
    color: var(--color-text-primary) !important;
}

.text-gray-900 {
    color: var(--color-text-primary) !important;
}

/* Gray badge text - lighter for visibility */
.text-gray-800.rounded-full,
span.text-gray-800 {
    color: #d1d5db !important;
}

/* Regular gray-800 for non-badge elements */
.text-gray-800:not(.rounded-full):not(span) {
    color: var(--color-text-primary) !important;
}

.text-gray-700 {
    color: var(--color-text-secondary) !important;
}

.text-gray-600,
.text-gray-500 {
    color: var(--color-text-secondary) !important;
}

.text-gray-400 {
    color: rgba(176, 176, 176, 0.7) !important;
}

/* Override any remaining black text */
h1, h2, h3, h4, h5, h6, p, span, a, button, label, td, th, div {
    color: inherit;
}

/* Ensure headings are visible */
h1, h2, h3 {
    color: var(--color-text-primary);
}

h4, h5, h6 {
    color: var(--color-text-secondary);
}

/* Override border colors */
.border-gray-200,
.border-gray-300 {
    border-color: rgba(59, 130, 246, 0.2) !important;
}

.border-gray-100 {
    border-color: rgba(255, 255, 255, 0.1) !important;
}

/* Override divide colors */
.divide-gray-200 > :not([hidden]) ~ :not([hidden]) {
    border-color: rgba(255, 255, 255, 0.05) !important;
}

/* Override blue colors to use accent */
.text-blue-600,
.text-blue-700 {
    color: var(--color-accent) !important;
}

.text-blue-800 {
    color: #93c5fd !important;
}

.text-blue-900 {
    color: var(--color-text-primary) !important;
}

.bg-blue-50,
.bg-blue-100 {
    background-color: #1e3a8a !important;
    border-color: rgba(59, 130, 246, 0.5) !important;
}

.bg-blue-600 {
    background-color: var(--color-accent) !important;
}

.bg-blue-700,
.hover\:bg-blue-700:hover {
    background-color: var(--color-accent-hover) !important;
}

/* Override hover states */
.hover\:bg-gray-50:hover,
.hover\:bg-gray-100:hover {
    background-color: rgba(59, 130, 246, 0.1) !important;
}

.hover\:text-gray-700:hover,
.hover\:text-gray-900:hover {
    color: var(--color-text-primary) !important;
}

.hover\:text-blue-900:hover {
    color: var(--color-text-primary) !important;
}

/* Override ring colors */
.ring-black {
    --tw-ring-color: rgba(59, 130, 246, 0.3) !important;
}

.focus\:ring-blue-500:focus {
    --tw-ring-color: rgba(59, 130, 246, 0.5) !important;
}

.focus\:border-blue-500:focus {
    border-color: var(--color-accent) !important;
}

/* Override placeholder colors */
.placeholder-gray-500::placeholder {
    color: rgba(176, 176, 176, 0.5) !important;
}

/* Override status colors - Success/Green */
.text-green-600,
.text-green-700,
.text-green-800 {
    color: #86efac !important;
}

.bg-green-50,
.bg-green-100 {
    background-color: #166534 !important;
    border-color: rgba(34, 197, 94, 0.5) !important;
}

.border-green-200 {
    border-color: rgba(34, 197, 94, 0.5) !important;
}

/* Override status colors - Error/Red */
.text-red-400,
.text-red-600,
.text-red-700,
.text-red-800 {
    color: #fca5a5 !important;
}

.bg-red-50,
.bg-red-100 {
    background-color: #991b1b !important;
    border-color: rgba(239, 68, 68, 0.5) !important;
}

.border-red-200 {
    border-color: rgba(239, 68, 68, 0.5) !important;
}

/* Override status colors - Warning/Yellow */
.text-yellow-600,
.text-yellow-700,
.text-yellow-800 {
    color: #fde047 !important;
}

.bg-yellow-50,
.bg-yellow-100 {
    background-color: #854d0e !important;
    border-color: rgba(251, 191, 36, 0.5) !important;
}

.border-yellow-200 {
    border-color: rgba(251, 191, 36, 0.5) !important;
}

/* Override status colors - Purple */
.text-purple-600,
.text-purple-700 {
    color: #a855f7 !important;
}

.text-purple-800 {
    color: #d8b4fe !important;
}

.bg-purple-50,
.bg-purple-100 {
    background-color: #581c87 !important;
    border-color: rgba(168, 85, 247, 0.5) !important;
}

.hover\:text-purple-900:hover {
    color: var(--color-text-primary) !important;
}

/* Override shadow classes to add glow */
.shadow,
.shadow-sm,
.shadow-lg {
    box-shadow:
        0 4px 6px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(59, 130, 246, 0.1) !important;
}

/* Override rounded corners to match style guide */
.rounded-lg {
    border-radius: 0.75rem !important;
}

.rounded-md {
    border-radius: 0.5rem !important;
}

/* Container Fix - Ensure Tailwind container works properly */
.container {
    width: 100% !important;
    max-width: 1280px !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* Grid Layout Fix - Ensure grid columns use full width */
.grid {
    width: 100% !important;
}

.grid > * {
    min-width: 0 !important;
}

/* Fix for grid-cols responsive classes not working */
@media (min-width: 768px) {
    .grid-cols-1.md\:grid-cols-4 {
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    }

    .grid-cols-1.md\:grid-cols-3 {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }

    .grid-cols-1.md\:grid-cols-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

/* Grid Overlay Effect */
.grid-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(var(--color-accent) 1px, transparent 1px),
        linear-gradient(90deg, var(--color-accent) 1px, transparent 1px);
    background-size: 50px 50px;
    opacity: 0.02;
    pointer-events: none;
    z-index: 0;
    animation: gridMove 20s linear infinite;
}

@keyframes gridMove {
    0% { transform: translate(0, 0); }
    100% { transform: translate(50px, 50px); }
}

/* Navigation Styling */
nav {
    background: rgba(35, 40, 48, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

nav a {
    color: var(--color-text-secondary);
    transition: all 0.3s ease;
}

nav a:hover {
    color: var(--color-text-primary);
}

nav a.active {
    color: var(--color-accent);
    border-color: var(--color-accent);
}

/* Button Styling */
.btn-primary {
    background: var(--color-accent);
    color: var(--color-text-primary);
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    border-radius: 0.5rem;
    border: none;
    transition: all 0.3s ease;
    cursor: pointer;
}

.btn-primary:hover {
    background: var(--color-accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(59, 130, 246, 0.3);
}

.btn-secondary {
    background: transparent;
    color: var(--color-text-primary);
    border: 1px solid var(--color-text-secondary);
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
    cursor: pointer;
}

.btn-secondary:hover {
    border-color: var(--color-text-primary);
    transform: translateY(-2px);
}

/* Card Styling */
.card {
    background: #3d444d;
    border: none;
    border-radius: 0.75rem;
    padding: var(--spacing-md);
    transition: all 0.3s ease;
    box-shadow:
        0 4px 6px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(59, 130, 246, 0.1);
}

/* Form Styling */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
textarea,
select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.5rem;
    color: var(--color-text-primary);
    font-family: var(--font-family);
    font-size: 1rem;
    line-height: 1.5;
    height: 2.5rem;
    transition: all 0.3s ease;
}

/* Textarea should not have fixed height */
textarea {
    height: auto;
    min-height: 5rem;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--color-accent);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Table Styling */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: rgba(15, 15, 15, 0.6);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 0.75rem;
    overflow: hidden;
}

thead {
    background: rgba(59, 130, 246, 0.1);
}

th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--color-text-primary);
    border-bottom: 1px solid rgba(59, 130, 246, 0.2);
}

td {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--color-text-secondary);
}

tr:hover {
    background: rgba(59, 130, 246, 0.05);
}

tr:last-child td {
    border-bottom: none;
}

/* Badge Styling */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 0.375rem;
    background: #1e3a8a;
    color: #93c5fd;
    border: none;
}

.badge-success {
    background: #166534;
    color: #86efac;
    border: none;
}

.badge-danger {
    background: #991b1b;
    color: #fca5a5;
    border: none;
}

.badge-warning {
    background: #854d0e;
    color: #fde047;
    border: none;
}

/* Alert/Flash Message Styling */
.alert {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    border: 1px solid;
}

.alert-info {
    background: rgba(59, 130, 246, 0.95);
    border-color: rgba(59, 130, 246, 1);
    color: #ffffff;
    backdrop-filter: blur(10px);
}

.alert-success {
    background: rgba(34, 197, 94, 0.95);
    border-color: rgba(34, 197, 94, 1);
    color: #ffffff;
    backdrop-filter: blur(10px);
}

.alert-error {
    background: rgba(239, 68, 68, 0.95);
    border-color: rgba(239, 68, 68, 1);
    color: #ffffff;
    backdrop-filter: blur(10px);
}

/* Footer Styling */
footer {
    background: rgba(35, 40, 48, 0.95);
    border-top: none;
    box-shadow: 0 -4px 6px rgba(0, 0, 0, 0.3);
    color: var(--color-text-secondary);
}

/* Dropdown Menu Styling - Unified style for all dropdowns */
.dropdown-menu,
.shadow-lg.bg-white,
.shadow-lg[class*="bg-white"],
[x-show].bg-white,
.absolute.bg-white.shadow-lg,
.origin-top-right.bg-white {
    background-color: rgba(35, 40, 48, 0.98) !important;
    backdrop-filter: blur(10px) !important;
    border: none !important;
    border-radius: 0.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8) !important;
}

.dropdown-menu a,
.dropdown-menu button {
    color: var(--color-text-secondary) !important;
    transition: all 0.2s ease;
}

.dropdown-menu a:hover,
.dropdown-menu button:hover {
    background: rgba(59, 130, 246, 0.1) !important;
    color: var(--color-text-primary) !important;
}

/* Dropdown menu items - ensure text is visible */
.shadow-lg a,
.shadow-lg button,
[x-show] a,
[x-show] button {
    color: var(--color-text-primary) !important;
}

.shadow-lg a:hover,
.shadow-lg button:hover,
[x-show] a:hover,
[x-show] button:hover {
    background-color: rgba(59, 130, 246, 0.15) !important;
    color: var(--color-accent) !important;
}

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

::-webkit-scrollbar-track {
    background: rgba(15, 15, 15, 0.5);
}

::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.3);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(59, 130, 246, 0.5);
}

/* Utility Classes */
.text-primary {
    color: var(--color-text-primary);
}

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

.text-accent {
    color: var(--color-accent);
}

.bg-dark {
    background: rgba(15, 15, 15, 0.6);
}

.border-accent {
    border-color: rgba(59, 130, 246, 0.3);
}

