/* Custom Styles for Health.AI Theme */

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
}

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

/* Custom Scrollbar for Webkit browsers */
::-webkit-scrollbar {
    width: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    transition: background 0.2s ease;
}

.dark ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
}

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

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

/* Sidebar scrollbar - even more subtle */
#sidebar::-webkit-scrollbar {
    width: 4px;
}

#sidebar::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
}

.dark #sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
}

#sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
}

.dark #sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

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

@keyframes slideIn {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

.animate-fadeIn {
    animation: fadeIn 0.3s ease-in-out;
}

.animate-slideIn {
    animation: slideIn 0.3s ease-in-out;
}

/* Google-style focus ring */
*:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Prevent text selection on buttons */
button {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Google-style ripple effect on buttons (optional enhancement) */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.ripple:active::after {
    width: 200px;
    height: 200px;
}

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

/* Ensure images and media work well in dark mode */
.dark img {
    opacity: 0.9;
}

/* Smooth transitions for theme changes */
* {
    transition-property: background-color, border-color, color;
    transition-duration: 200ms;
    transition-timing-function: ease-in-out;
}

/* Override transition for specific elements that shouldn't animate */
input,
textarea,
select {
    transition: none;
}

/* Google-style link hover effect */
a {
    text-decoration: none;
    position: relative;
}

a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 1px;
    bottom: -2px;
    left: 0;
    background-color: currentColor;
    transition: width 0.3s ease-in-out;
}

a:hover::after {
    width: 100%;
}

/* Remove underline animation for specific links */
.no-underline-animation::after {
    display: none;
}

/* Google Search button hover effect */
button:hover {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.dark button:hover {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Sidebar overlay backdrop blur effect */
#overlay {
    backdrop-filter: blur(2px);
    transition: opacity 0.3s ease, backdrop-filter 0.3s ease;
}

/* Main content area smooth transition */
.md\:ml-72 {
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Sidebar smooth transition */
#sidebar {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Custom grid for apps menu */
.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 1rem;
}

/* Responsive breakpoints matching Google's design */
@media (max-width: 640px) {
    /* Mobile adjustments */
    h1 {
        font-size: 3rem !important;
    }
}

@media (max-width: 768px) {
    /* Tablet adjustments */
}

@media (min-width: 1024px) {
    /* Desktop adjustments */
}

/* Print styles */
@media print {
    header,
    footer,
    aside {
        display: none;
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    button,
    a {
        border: 1px solid currentColor;
    }
}

/* Loading state styles */
.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #3b82f6;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Elevation shadows */
.shadow-google-sm {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
}

.shadow-google-md {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
}

.shadow-google-lg {
    box-shadow: 0 10px 25px -3px rgba(0, 0, 0, 0.08), 0 4px 10px -2px rgba(0, 0, 0, 0.04);
}

.dark .shadow-google-sm {
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.4), 0 1px 3px 1px rgba(0, 0, 0, 0.3);
}

.dark .shadow-google-md {
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.4), 0 4px 8px 3px rgba(0, 0, 0, 0.3);
}

.dark .shadow-google-lg {
    box-shadow: 0 2px 6px 2px rgba(0, 0, 0, 0.3), 0 8px 24px 4px rgba(0, 0, 0, 0.3);
}

/* ============================================
   Professional Enhancements
   ============================================ */

/* Improved card hover effects */
.bg-white.rounded-lg.shadow,
.dark .dark\:bg-\[\#292a2d\].rounded-lg.shadow {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.bg-white.rounded-lg.shadow:hover,
.dark .dark\:bg-\[\#1a1a1d\].rounded-lg.shadow:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
}

.dark .bg-white.rounded-lg.shadow:hover,
.dark .dark\:bg-\[\#1a1a1d\].rounded-lg.shadow:hover {
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
}

/* Navigation links improved hover state */
nav a {
    position: relative;
    overflow: hidden;
}

nav a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background: #3b82f6;
    transform: scaleY(0);
    transition: transform 0.2s ease;
}

nav a:hover::before {
    transform: scaleY(1);
}

/* Better focus states for accessibility */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

/* Google-style search input - remove outline, use parent shadow */
input[type="text"][placeholder*="Search"]:focus {
    outline: none !important;
    box-shadow: none !important;
}

input[type="text"][placeholder*="Search"]:focus-visible {
    outline: none !important;
    box-shadow: none !important;
}

/* Smooth theme transition */
html.light,
html.dark {
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Table row hover effect */
tbody tr {
    transition: background-color 0.15s ease;
}

/* Better button states */
button:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
}

/* Input field enhancements */
input:not([type="checkbox"]):not([type="radio"]),
textarea,
select {
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:not([type="checkbox"]):not([type="radio"]):hover,
textarea:hover,
select:hover {
    border-color: #9aa0a6 !important;
}

/* Badge and tag subtle animations */
.px-2.py-1.text-xs.rounded-full,
.px-3.py-1.rounded-full {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.px-2.py-1.text-xs.rounded-full:hover,
.px-3.py-1.rounded-full:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Sidebar navigation item active indicator animation */
nav a .ml-auto {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

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

/* Remove animations from non-active items */
nav a:not([class*="bg-blue"]) .ml-auto {
    animation: none;
}

/* Better header shadow on scroll */
header {
    transition: box-shadow 0.3s ease;
}

header.scrolled {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.dark header.scrolled {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* User profile section in sidebar */
#sidebar .px-4.py-4 {
    transition: background-color 0.2s ease;
}

/* Progress bar animation */
.bg-google-blue.h-2.rounded-full,
.bg-google-green.h-2.rounded-full,
.bg-google-yellow.h-2.rounded-full {
    transition: width 0.5s ease;
    position: relative;
    overflow: hidden;
}

.bg-google-blue.h-2.rounded-full::after,
.bg-google-green.h-2.rounded-full::after,
.bg-google-yellow.h-2.rounded-full::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Alert icons animation on load */
.flex.items-start svg {
    animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
    from {
        transform: scale(0);
    }
    to {
        transform: scale(1);
    }
}
