/* Glassmorphism Design System */

:root {
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
}

/* Glass Card Effect */
.glass-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    transition: all 0.3s ease;
}

.glass-card:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-4px);
    box-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.5);
}

/* Glass Navigation */
.glass-nav {
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.1);
}

/* Glass Stat Card */
.glass-stat-card {
    background: linear-gradient(135deg, rgba(147, 51, 234, 0.3), rgba(59, 130, 246, 0.3));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.glass-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px 0 rgba(147, 51, 234, 0.4);
}

.glass-stat-card * {
    position: relative;
    z-index: 1;
}

/* Glass Button */
.glass-btn {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Company Card */
.company-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    min-height: 160px;
    display: flex;
    flex-direction: column;
}

.company-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s;
}

.company-card:hover::before {
    left: 100%;
}

.company-card:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 16px 48px 0 rgba(147, 51, 234, 0.4);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Badge */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Link Icon */
.link-icon {
    transition: all 0.3s ease;
}

.link-icon:hover {
    transform: scale(1.2) rotate(-45deg);
    color: rgba(147, 51, 234, 1);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

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

.pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

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

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Gradient Text */
.gradient-text {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Number Counter Animation */
.number-counter {
    font-variant-numeric: tabular-nums;
}

/* Dashboard specific styles */
.dashboard-stat {
    transition: all 0.3s ease;
}

.dashboard-stat:hover {
    transform: translateY(-2px);
}

/* Ensure proper text wrapping and overflow */
.glass-card,
.glass-stat-card,
.company-card {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Mobile optimizations */
@media (max-width: 640px) {
    .glass-card {
        padding: 1rem;
    }
    
    .company-card {
        padding: 1rem;
        min-height: auto;
    }
    
    /* Smaller text on mobile */
    .glass-stat-card {
        padding: 1rem;
    }
    
    /* Stack filters vertically on very small screens */
    .filter-bar {
        flex-direction: column;
    }
    
    .filter-bar > * {
        width: 100%;
    }
    
    /* Ensure stats don't overflow on mobile */
    .glass-stat-card .text-3xl {
        font-size: 1.5rem;
    }
}

/* Tablet optimizations */
@media (min-width: 641px) and (max-width: 1024px) {
    .glass-card {
        padding: 1.25rem;
    }
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Better touch targets on mobile */
@media (max-width: 768px) {
    button, select, a {
        min-height: 44px;
        min-width: 44px;
    }
}

/* Ensure charts don't overflow */
canvas {
    max-width: 100%;
    display: block;
}

/* Table styles */
table {
    border-collapse: collapse;
    width: 100%;
}

table thead th {
    font-weight: 600;
}

table tbody tr {
    transition: background-color 0.2s ease;
}

table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

table td, table th {
    padding: 0.75rem 1rem;
}

/* Responsive table */
@media (max-width: 768px) {
    table {
        font-size: 0.875rem;
    }
    
    table td, table th {
        padding: 0.5rem 0.75rem;
    }
}

/* Prevent layout shifts */
#companyGrid,
#companyList {
    min-height: 100px;
}

/* Fix for select dropdowns on mobile */
select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='white' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
}

/* Ensure proper container width */
.container {
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}

/* Fix for any floating elements */
section {
    clear: both;
    position: relative;
}

/* Ensure proper grid behavior */
.grid {
    display: grid;
    width: 100%;
}

/* Fix truncation issues */
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.min-w-0 {
    min-width: 0;
}

