/* Enhanced GrantScope AI - Powered by Tunaas.ai */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@300;400;500;600;700&display=swap');

:root {
    /* Tunaas.ai Brand Colors */
    --primary: #6C2BD9;
    --primary-light: #8B5CF6;
    --primary-dark: #5B21B6;
    --secondary: #1FB6A2;
    --secondary-light: #34D399;
    --accent: #FF8C00;
    --accent-light: #FB923C;
    --success: #059669;
    --warning: #D97706;
    --danger: #DC2626;
    
    /* Enhanced Backgrounds */
    --background: #F8FAFC;
    --surface: #FFFFFF;
    --surface-light: #F9FAFB;
    --surface-dark: #F3F4F6;
    --text: #0F172A;
    --text-secondary: #334155;
    --text-light: #64748B;
    --text-muted: #94A3B8;
    
    /* Typography */
    --font-heading: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', Monaco, monospace;
    
    /* Shadows */
    --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-sm: 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);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    
    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    
    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark mode variables */
@media (prefers-color-scheme: dark) {
    :root {
        --background: #0F172A;
        --surface: #A9C2D6;
        --surface-light: #334155;
        --surface-dark: #0F172A;
        --text: #F8FAFC;
        --text-secondary: #CBD5E1;
        --text-light: #94A3B8;
        --text-muted: #64748B;
    }
}

/* Purple Slider Styles */
.slider-purple {
    -webkit-appearance: none;
    appearance: none;
    outline: none;
    opacity: 0.9;
    transition: opacity 0.2s;
}

.slider-purple:hover {
    opacity: 1;
}

.slider-purple::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: #6C2BD9;
    cursor: pointer;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.slider-purple::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #6C2BD9;
    cursor: pointer;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Base styles with improved mobile support */
* {
    box-sizing: border-box;
}

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

body {
    font-family: var(--font-body);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
    width: 100%;
    position: relative;
}

/* Enhanced mobile-first approach */
@media (max-width: 768px) {
    body {
        font-size: 14px;
    }
    
    /* Prevent horizontal overflow on mobile */
    .mobile-header {
        max-width: 100vw;
    }
    
    #app {
        max-width: 100vw;
        overflow-x: hidden;
    }
    
    main {
        max-width: 100vw;
        overflow-x: hidden;
    }
}

/* Improved scrollbar for all browsers */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--text-muted) var(--surface-light);
}

*::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

*::-webkit-scrollbar-track {
    background: var(--surface-light);
    border-radius: 3px;
}

*::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 3px;
    transition: var(--transition-fast);
}

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

/* Enhanced focus states for accessibility */
*:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

button:focus,
input:focus,
textarea:focus,
select:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Modern glass morphism effect */
.glass {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Gradient backgrounds */
.gradient-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
}

.gradient-secondary {
    background: linear-gradient(135deg, var(--secondary) 0%, var(--secondary-light) 100%);
}

.gradient-accent {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%);
}

/* Enhanced animations */
@keyframes slideInUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

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

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

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(108, 43, 217, 0.4);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(108, 43, 217, 0);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

.animate-slide-up {
    animation: slideInUp var(--transition-normal) ease-out;
}

.animate-slide-right {
    animation: slideInRight var(--transition-normal) ease-out;
}

.animate-fade-in {
    animation: fadeIn var(--transition-normal) ease-out;
}

.animate-pulse-glow {
    animation: pulse-glow 2s infinite;
}

/* Loading skeleton */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200px 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
}

/* Enhanced mobile responsiveness */
.mobile-hidden {
    display: block;
}

.mobile-only {
    display: none;
}

@media (max-width: 768px) {
    .mobile-hidden {
        display: none;
    }
    
    .mobile-only {
        display: block;
    }
    
    .mobile-stack {
        flex-direction: column;
    }
    
    .mobile-full {
        width: 100%;
    }
    
    .mobile-text-center {
        text-align: center;
    }
    
    .mobile-p-4 {
        padding: 1rem;
    }
    
    .mobile-mt-4 {
        margin-top: 1rem;
    }
}

/* Enhanced Navigation styles */
.nav-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: var(--radius-lg);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.875rem;
    transition: var(--transition-fast);
    text-decoration: none;
    overflow: hidden;
    z-index: 10;
    pointer-events: auto;
}

.nav-link:hover {
    background: var(--surface-light);
    color: var(--text);
    transform: translateY(-1px);
}

.nav-link.active {
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow-md);
}

.nav-link.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 100%);
    pointer-events: none;
}

.nav-link i,
.nav-link svg {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
}

.nav-link .nav-badge {
    margin-left: auto;
    background: var(--accent);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.125rem 0.375rem;
    border-radius: 9999px;
    min-width: 1.25rem;
    text-align: center;
}

/* Mobile navigation improvements */
@media (max-width: 768px) {
    .nav-link {
        padding: 1rem;
        font-size: 1rem;
    }
    
    .nav-link i,
    .nav-link svg {
        width: 1.5rem;
        height: 1.5rem;
    }
}

/* Mobile navigation removed - no longer needed */

/* Fix horizontal scrollbar on mobile */
@media (max-width: 1023px) {
    /* Prevent horizontal overflow */
    html, body {
        overflow-x: hidden;
        max-width: 100vw;
        position: relative;
    }
    
    /* Ensure all containers respect viewport width */
    #app, main, .mobile-header {
        max-width: 100vw;
        overflow-x: hidden;
    }
    
    /* Fix sidebar width on mobile */
    #sidebar {
        width: 85%;
        max-width: 320px;
    }
    
    /* Ensure content doesn't overflow */
    .tunaas-logo, .nav-link, .p-4, .p-6 {
        max-width: 100%;
        word-wrap: break-word;
        box-sizing: border-box;
    }
    
    /* Fix any fixed positioned elements */
    .fixed {
        max-width: 100vw;
    }
    
    /* Footer specific fixes */
    .bg-gray-50 {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    /* Prevent padding-induced overflow */
    .p-4 {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* Main content adjustments */
    main {
        width: 100%;
        padding-bottom: 60px; /* Space for mobile nav if any */
    }
}

/* Enhanced sidebar */
.sidebar {
    background: var(--surface);
    border-right: 1px solid var(--surface-dark);
    transition: var(--transition-normal);
    z-index: 100;
    pointer-events: auto;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--surface-dark);
    background: var(--surface-light);
}

.tunaas-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: var(--primary);
    border-radius: var(--radius-lg);
    color: white;
    font-weight: 700;
    font-size: 0.875rem;
    letter-spacing: 0.05em;
}

.tunaas-logo .icon {
    font-size: 1.25rem;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-3px);
    }
}

/* Mobile sidebar toggle */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1000;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    padding: 0.75rem;
    box-shadow: var(--shadow-lg);
    transition: var(--transition-fast);
}

.sidebar-toggle:hover {
    transform: scale(1.05);
}

@media (max-width: 768px) {
    .sidebar-toggle {
        display: block;
    }
    
    .sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        height: 100vh;
        width: 280px;
        z-index: 999;
        transform: translateX(-100%);
        transition: transform var(--transition-normal);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 998;
        transition: var(--transition-normal);
    }
    
    .sidebar-overlay.active {
        display: block;
    }
}

/* Enhanced Grant card styles */
.grant-card {
    position: relative;
    background: var(--surface);
    border-radius: var(--radius-xl);
    border: 1px solid var(--surface-dark);
    padding: 1.5rem;
    transition: var(--transition-normal);
    cursor: pointer;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.grant-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 50%, var(--accent) 100%);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--transition-normal);
}

.grant-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.grant-card:hover::before {
    transform: scaleX(1);
}

.grant-card:active {
    transform: translateY(0);
}

.grant-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    gap: 1rem;
}

.grant-card-title {
    color: var(--surface-light);
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.4;
    margin: 0 0 0.5rem 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.grant-card-agency {
    color: var(--surface-light);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.75rem;
}

.grant-card-description {
    color: var(--surface-light);
    font-size: 0.875rem;
    line-height: 1.5;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.grant-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.grant-card-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid var(--surface-dark);
}

.grant-card-funding {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--success);
    font-weight: 600;
    font-size: 0.875rem;
}

.grant-card-deadline {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.grant-card-deadline.urgent {
    color: var(--danger);
}

.grant-card-deadline.soon {
    color: var(--warning);
}

.grant-card-deadline.normal {
    color: var(--text-light);
}

/* Enhanced badge styles */
.grant-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.375rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    transition: var(--transition-fast);
}

.grant-badge:hover {
    transform: scale(1.05);
}

.grant-badge.agency {
    background: rgba(108, 43, 217, 0.1);
    color: var(--primary);
    border: 1px solid rgba(108, 43, 217, 0.2);
}

.grant-badge.category {
    background: rgba(255, 140, 0, 0.1);
    color: var(--accent);
    border: 1px solid rgba(255, 140, 0, 0.2);
}

.grant-badge.funding {
    background: rgba(5, 150, 105, 0.1);
    color: var(--success);
    border: 1px solid rgba(5, 150, 105, 0.2);
}

.grant-badge.deadline {
    background: rgba(220, 38, 38, 0.1);
    color: var(--danger);
    border: 1px solid rgba(220, 38, 38, 0.2);
}

.grant-badge.deadline.soon {
    background: var(--warning);
    color: white;
    animation: pulse-glow 2s infinite;
}

.grant-badge.deadline.urgent {
    background: var(--danger);
    color: white;
    animation: pulse-glow 1s infinite;
}

.grant-badge.status {
    background: rgba(31, 182, 162, 0.1);
    color: var(--secondary);
    border: 1px solid rgba(31, 182, 162, 0.2);
}

/* Icon enhancements */
.grant-card-icon {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}

/* Mobile grant card optimizations */
@media (max-width: 768px) {
    .grant-card {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .grant-card-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    
    .grant-card-title {
        font-size: 1rem;
        -webkit-line-clamp: 3;
    }
    
    .grant-card-meta {
        justify-content: flex-start;
    }
    
    .grant-card-actions {
        flex-direction: column;
        gap: 0.75rem;
        align-items: stretch;
    }
    
    .grant-badge {
        font-size: 0.65rem;
        padding: 0.25rem 0.5rem;
    }
}

/* Loading state for grant cards */
.grant-card.loading {
    pointer-events: none;
}

.grant-card.loading .grant-card-title,
.grant-card.loading .grant-card-description,
.grant-card.loading .grant-card-agency {
    background: var(--surface-dark);
    color: transparent;
    border-radius: var(--radius-sm);
    animation: shimmer 1.5s infinite;
}

/* Grid layout for grant cards */
.grants-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
    padding: 1rem;
}

@media (max-width: 768px) {
    .grants-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 0.5rem;
    }
}

/* Enhanced Chat interface styles */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--surface);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.chat-header {
    padding: 1rem 1.5rem;
    background: var(--primary);
    color: white;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chat-header .icon {
    width: 1.5rem;
    height: 1.5rem;
}

.chat-messages {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    max-height: 400px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chat-message {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    animation: slideInUp var(--transition-normal) ease-out;
}

.chat-message.user {
    flex-direction: row-reverse;
}

.chat-message-avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.chat-message.user .chat-message-avatar {
    background: var(--primary);
    color: white;
}

.chat-message.assistant .chat-message-avatar {
    background: var(--secondary);
    color: white;
}

.chat-message-content {
    max-width: 75%;
    padding: 0.875rem 1.125rem;
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    line-height: 1.5;
    position: relative;
}

.chat-message.user .chat-message-content {
    background: var(--primary);
    color: white;
    border-bottom-right-radius: var(--radius-sm);
}

.chat-message.assistant .chat-message-content {
    background: var(--surface-light);
    color: var(--text);
    border-bottom-left-radius: var(--radius-sm);
    border: 1px solid var(--surface-dark);
}

.chat-message-time {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    text-align: right;
}

.chat-message.assistant .chat-message-time {
    text-align: left;
}

.chat-input-container {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--surface-dark);
    background: var(--surface-light);
}

.chat-input-wrapper {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    min-height: 2.5rem;
    max-height: 8rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--surface-dark);
    border-radius: var(--radius-lg);
    background: var(--surface);
    color: var(--text);
    resize: none;
    font-size: 0.875rem;
    line-height: 1.4;
    transition: var(--transition-fast);
}

.chat-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(108, 43, 217, 0.1);
}

.chat-send-button {
    width: 2.5rem;
    height: 2.5rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    flex-shrink: 0;
}

.chat-send-button:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: scale(1.05);
}

.chat-send-button:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    transform: none;
}

.chat-typing-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-light);
    font-size: 0.875rem;
    font-style: italic;
}

.chat-typing-dots {
    display: flex;
    gap: 0.25rem;
}

.chat-typing-dot {
    width: 0.375rem;
    height: 0.375rem;
    background: var(--text-light);
    border-radius: 50%;
    animation: typing-pulse 1.4s infinite ease-in-out;
}

.chat-typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.chat-typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing-pulse {
    0%, 60%, 100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    30% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Mobile chat optimizations */
@media (max-width: 768px) {
    .chat-container {
        border-radius: 0;
        height: 100vh;
    }
    
    .chat-messages {
        max-height: none;
        flex: 1;
        padding: 0.75rem;
    }
    
    .chat-message-content {
        max-width: 85%;
        font-size: 0.875rem;
    }
    
    .chat-input-container {
        padding: 1rem;
    }
    
    .chat-input {
        font-size: 1rem;
    }
}

/* Loading animations */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

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

/* Custom scrollbar */
.overflow-auto::-webkit-scrollbar {
    width: 6px;
}

.overflow-auto::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.overflow-auto::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.overflow-auto::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* Form styles */
.form-input {
    @apply w-full border border-gray-300 rounded-md px-3 py-2 text-sm focus:ring-2 focus:ring-primary focus:border-transparent;
    color: #000000 !important;
    background-color: #FFFFFF !important;
}

/* Ensure all form elements have black text */
input, textarea, select, option {
    color: #000000 !important;
    background-color: #FFFFFF !important;
}

/* Specific select/dropdown styles */
select {
    color: #000000 !important;
    background-color: #FFFFFF !important;
}

select option {
    color: #000000 !important;
    background-color: #FFFFFF !important;
}

/* Filter panel specific styles */
.filter-select {
    color: #000000 !important;
    background-color: #FFFFFF !important;
}

.filter-input {
    color: #000000 !important;
    background-color: #FFFFFF !important;
}

/* Ensure all text elements are black for visibility */
p, span, div, label, h1, h2, h3, h4, h5, h6, a, li, td, th {
    color: #000000 !important;
}

/* Exception for specific elements that should keep their colors */
.nav-link.active {
    color: white !important;
}

.btn-primary, .bg-primary button {
    color: white !important;
}

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

.text-white {
    color: white !important;
}

/* Navigation links default to black */
.nav-link:not(.active) {
    color: #000000 !important;
}

.nav-link:not(.active):hover {
    color: var(--primary) !important;
}

/* Ensure badges and special elements maintain their styling */
.grant-badge, .nav-badge {
    color: inherit !important;
}

/* Chat messages maintain their styling */
.chat-message.user .chat-message-content,
.chat-message.assistant .chat-message-content {
    color: inherit !important;
}

/* Maintain button text colors */
button.btn-primary,
button.bg-primary {
    color: white !important;
}

/* Ensure placeholders are visible */
::placeholder {
    color: #6B7280 !important;
    opacity: 1;
}

/* Fix text in gray containers */
.text-gray-500, .text-gray-600, .text-gray-700 {
    color: #374151 !important;
}

/* Ensure dropdown options are black on white */
select option {
    color: #000000 !important;
    background-color: #FFFFFF !important;
    padding: 8px;
}

/* Fix any potential contrast issues */
.bg-gray-100, .bg-gray-200 {
    color: #000000 !important;
}

.btn-primary {
    @apply px-4 py-2 bg-primary text-white rounded-lg hover:bg-primary-600 focus:ring-2 focus:ring-primary focus:ring-offset-2 transition-colors;
}

.btn-secondary {
    @apply px-4 py-2 bg-gray-200 text-gray-800 rounded-lg hover:bg-gray-300 focus:ring-2 focus:ring-gray-500 focus:ring-offset-2 transition-colors;
}

/* Responsive design */
@media (max-width: 768px) {
    .nav-link span {
        @apply sr-only;
    }
    
    .nav-link {
        @apply justify-center;
    }
}

/* Print styles */
@media print {
    .nav-link, #ai-panel, header {
        display: none !important;
    }
    
    #main-content {
        margin: 0 !important;
        padding: 0 !important;
    }
}

/* Tunaas.ai Brand Styles */
body {
    font-family: var(--font-body);
    color: var(--text);
    background-color: var(--background);
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    color: var(--text);
    font-weight: 600;
}

.tunaas-logo {
    font-family: var(--font-mono);
    color: var(--primary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.tunaas-logo .icon {
    font-size: 1.2em;
}

/* Updated button styles */
.btn-primary {
    background-color: var(--primary);
    color: white;
    font-weight: 600;
    padding: 12px 20px;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background-color: #5721B5;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(108, 43, 217, 0.3);
}

.btn-secondary {
    background-color: var(--secondary);
    color: white;
    font-weight: 600;
    padding: 12px 20px;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background-color: #178B7C;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(31, 182, 162, 0.3);
}

/* Card styles with new design */
.card {
    background: var(--surface);
    border-radius: 1rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    padding: 24px;
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

/* Input styles */
input, textarea, select {
    border: 1px solid #CBD5E1;
    border-radius: 0.375rem;
    padding: 10px 14px;
    font-family: var(--font-body);
    transition: all 0.3s ease;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(108, 43, 217, 0.1);
}

/* Team section styles */
.team-member {
    background: var(--surface);
    border-radius: 1rem;
    padding: 2rem;
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.team-member:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.team-member h3 {
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.team-member .role {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 1rem;
}

.team-member .bio {
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 0.875rem;
}

/* Footer styles */
.footer {
    background: #F9FAFB;
    color: var(--text-light);
    padding: 2rem 0;
    text-align: center;
    border-top: 1px solid #E5E7EB;
    margin-top: 4rem;
}

.footer .powered-by {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

/* Navigation section headers */
.nav-section-header {
    font-size: 0.75rem;
    font-weight: 600;
    color: #6B7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.25rem 0.75rem;
    margin: 0.5rem 0;
    opacity: 0.8;
}

/* Mobile-first optimizations */
@media (max-width: 768px) {
    /* Touch-friendly buttons */
    .btn, button {
        min-height: 44px;
        min-width: 44px;
        padding: 12px 20px;
    }
    
    /* Better spacing for mobile */
    .p-6 {
        padding: 1rem;
    }
    
    .p-4 {
        padding: 0.75rem;
    }
    
    /* Responsive text sizes */
    h1 {
        font-size: 1.5rem;
    }
    
    h2 {
        font-size: 1.25rem;
    }
    
    h3 {
        font-size: 1.1rem;
    }
    
    /* Mobile-friendly cards */
    .grant-card {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    /* Touch-friendly navigation */
    .nav-link {
        padding: 1rem 1.25rem;
        min-height: 56px;
        border-radius: 8px;
        margin: 2px 0;
    }
    
    /* Mobile sidebar adjustments */
    #sidebar {
        width: 85%;
        max-width: 320px;
    }
    
    /* Mobile search bar */
    .search-bar {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    input[type="text"], input[type="search"] {
        font-size: 16px !important;
        -webkit-appearance: none;
    }
    
    /* Responsive grid adjustments */
    .grid-cols-2 {
        grid-template-columns: 1fr;
    }
    
    .grid-cols-3 {
        grid-template-columns: 1fr;
    }
    
    /* Mobile modal optimization */
    .modal {
        margin: 0;
        max-height: 100vh;
        width: 100%;
        border-radius: 0;
    }
    
    /* Sticky mobile header */
    .mobile-header {
        position: sticky;
        top: 0;
        z-index: 100;
    }
    
    /* Mobile table scrolling */
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
    
    /* Touch-friendly form elements */
    input, select, textarea {
        font-size: 16px;
        padding: 12px;
        min-height: 44px;
    }
    
    /* Mobile filter panel */
    .filter-panel {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        border-radius: 16px 16px 0 0;
        max-height: 70vh;
        overflow-y: auto;
    }
    
    /* Mobile-friendly grant display */
    .grant-list {
        padding-bottom: 60px; /* Space for bottom nav */
    }
    
    /* Mobile AI assistant */
    .ai-assistant {
        bottom: 75px; /* Above bottom nav */
        right: 10px;
        max-width: calc(100% - 20px);
    }
    
    /* Swipeable grant cards */
    .grant-card:active {
        transform: scale(0.98);
        transition: transform 0.1s;
    }
    
    /* Mobile bottom navigation active state */
    .mobile-nav-item.active {
        color: #6C2BD9;
    }
    
    /* Mobile-friendly modals */
    .grant-modal-content {
        height: 100vh;
        max-height: none;
        overflow-y: auto;
        padding-bottom: 60px;
    }
    
    /* Improve readability on mobile */
    .grant-description {
        line-height: 1.6;
        font-size: 0.95rem;
    }
    
    /* Mobile filters toggle button */
    .mobile-filter-toggle {
        position: fixed;
        bottom: 70px;
        right: 20px;
        width: 56px;
        height: 56px;
        background: #6C2BD9;
        color: white;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 4px 12px rgba(108, 43, 217, 0.3);
        z-index: 40;
    }
}

/* Additional mobile horizontal overflow fix */
@media (max-width: 768px) {
    /* Prevent all horizontal overflow on mobile */
    html, body {
        overflow-x: hidden !important;
        max-width: 100vw !important;
        position: relative;
    }
    
    /* Fix all containers */
    #app, main, nav, .mobile-header, .bg-gray-50, .border-t {
        max-width: 100vw !important;
        overflow-x: hidden !important;
        box-sizing: border-box;
    }
    
    /* Fix sidebar footer specifically */
    .p-4.border-t.border-gray-200,
    div[class*="p-4"][class*="border-t"] {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* Ensure no element can cause overflow */
    * {
        max-width: 100vw !important;
    }
}
