/* Enhanced Responsiveness and Smoothness for All Pages */

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Enhanced Transitions */
* {
    transition-property: color, background-color, border-color, transform, opacity;
    transition-duration: 0.2s;
    transition-timing-function: ease-in-out;
}

/* Responsive Typography */
@media (max-width: 640px) {
    h1 {
        font-size: 2rem !important;
        line-height: 1.2 !important;
    }
    
    h2 {
        font-size: 1.75rem !important;
    }
    
    h3 {
        font-size: 1.5rem !important;
    }
    
    p {
        font-size: 0.9rem !important;
    }
}

/* Touch-friendly Buttons */
button, a.button, .btn {
    min-height: 44px;
    min-width: 44px;
    touch-action: manipulation;
}

/* Improved Form Inputs */
input, textarea, select {
    font-size: 16px; /* Prevents zoom on iOS */
    padding: 0.75rem;
    border-radius: 8px;
    transition: all 0.2s ease;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
    transform: scale(1.02);
}

/* Smooth Hover Effects */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Smooth Image Loading */
img {
    transition: opacity 0.3s ease;
}

img[loading="lazy"] {
    opacity: 0;
}

img[loading="lazy"].loaded {
    opacity: 1;
}

/* Enhanced Card Animations */
.card, .feature-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover, .feature-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

/* Smooth Dropdown Menus */
.dropdown-menu {
    transition: opacity 0.2s ease, transform 0.2s ease;
    transform-origin: top;
}

.dropdown-menu.show {
    opacity: 1;
    transform: scaleY(1);
}

.dropdown-menu.hide {
    opacity: 0;
    transform: scaleY(0.95);
}

/* Mobile Menu Smooth Animation */
#mobileMenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
}

#mobileMenu.show {
    max-height: 1000px;
    opacity: 1;
}

/* Smooth Page Transitions */
.page-transition {
    animation: fadeInUp 0.5s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Grid Improvements */
@media (max-width: 768px) {
    .grid {
        gap: 1rem !important;
    }
    
    .container {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
}

/* Smooth Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 5px;
    transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Dark Mode Scrollbar */
.dark ::-webkit-scrollbar-track {
    background: #1f2937;
}

.dark ::-webkit-scrollbar-thumb {
    background: #4b5563;
}

.dark ::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
}

/* Performance Optimizations */
.gpu-accelerated {
    transform: translateZ(0);
    will-change: transform;
}

/* Reduce Motion for Accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Smooth Focus States */
*:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
    border-radius: 4px;
}

/* Enhanced Button States */
button:active {
    transform: scale(0.98);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Smooth Table Responsiveness */
@media (max-width: 768px) {
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }
}

/* Improved Modal/Dialog Animations */
.modal, .dialog {
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Smooth Number Counters */
.counter {
    transition: all 0.3s ease;
}

/* Enhanced Link Hover */
a {
    transition: color 0.2s ease, text-decoration 0.2s ease;
}

a:hover {
    text-decoration: underline;
}

/* Smooth Section Transitions */
section {
    scroll-margin-top: 80px;
}

/* Improved Form Validation */
input:invalid:not(:placeholder-shown) {
    border-color: #ef4444;
    animation: shake 0.3s ease;
}

input:valid:not(:placeholder-shown) {
    border-color: #10b981;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Smooth Loading Skeleton */
.skeleton {
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e0e0e0 50%,
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Enhanced Responsive Images */
img {
    max-width: 100%;
    height: auto;
    object-fit: cover;
}

/* Smooth Dark Mode Transition */
body {
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Improved Touch Targets */
@media (max-width: 768px) {
    button, a, input, select, textarea {
        min-height: 48px;
    }
}

/* Smooth Accordion/Collapse */
.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
}

.accordion-content.open {
    max-height: 1000px;
    opacity: 1;
}

/* Enhanced Tooltip Animations */
.tooltip {
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    transform: translateY(-5px);
}

.tooltip.show {
    opacity: 1;
    transform: translateY(0);
}

