/* Custom CSS for enhanced styling and animations */

/* Root variables for consistent theming */
:root {
    --primary-color: #3B82F6;
    --secondary-color: #1E40AF;
    --accent-color: #F59E0B;
    --dark-color: #0F172A;
    --dark-secondary: #1E293B;
    --text-color: #111827;
    --text-light: #374151;
    --text-muted: #6B7280;
    --border-color: #E5E7EB;
    --background-light: #F9FAFB;
    --shadow-light: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-medium: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-large: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* Dark theme variables */
.dark {
    --text-color: #F9FAFB;
    --text-light: #D1D5DB;
    --text-muted: #9CA3AF;
    --border-color: #374151;
    --background-light: #1F2937;
    --shadow-light: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 1px 2px 0 rgba(0, 0, 0, 0.2);
    --shadow-medium: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-large: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 10px 10px -5px rgba(0, 0, 0, 0.3);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: white;
    overflow-x: hidden;
}

.dark body {
    background-color: var(--dark-color);
}

/* Mobile viewport fix */
.min-h-screen {
    min-height: 100vh;
    min-height: calc(var(--vh, 1vh) * 100);
}

/* Enhanced typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 0.5em;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

@media (max-width: 768px) {
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.25rem; }
}

p {
    margin-bottom: 1em;
    color: var(--text-light);
}

/* Light theme text contrast fixes */
.text-gray-600 {
    color: #374151 !important; /* Darker gray for better contrast */
}

.text-gray-700 {
    color: #1F2937 !important; /* Even darker for headings */
}

.dark .text-gray-600 {
    color: #D1D5DB !important; /* Light gray for dark mode */
}

.dark .text-gray-700 {
    color: #F3F4F6 !important; /* Very light for dark mode */
}

/* Section text improvements */
.section-text {
    color: var(--text-light);
    line-height: 1.7;
}

.section-description {
    color: var(--text-muted);
    line-height: 1.6;
}

/* Ensure proper contrast for all text elements */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-color);
}

/* Project card text fixes */
.project-card p {
    color: #374151;
}

.dark .project-card p {
    color: #D1D5DB;
}

/* Contact section text */
.contact-text {
    color: #374151;
}

.dark .contact-text {
    color: #D1D5DB;
}

/* Custom animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

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

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(59, 130, 246, 0.4);
    }
    50% {
        box-shadow: 0 0 20px rgba(59, 130, 246, 0.6);
    }
}

/* Enhanced button styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    border-radius: 0.5rem;
    transition: var(--transition-normal);
    cursor: pointer;
    border: none;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

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

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-large);
}

.btn-outline {
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    background-color: transparent;
}

.btn-outline:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

/* Enhanced card styles */
.card {
    background: white;
    border-radius: 1rem;
    box-shadow: var(--shadow-light);
    transition: var(--transition-normal);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.dark .card {
    background: var(--dark-secondary);
    border-color: #374151;
}

.card:hover {
    box-shadow: var(--shadow-large);
    transform: translateY(-4px);
}

.card-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.dark .card-header {
    border-bottom-color: #374151;
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    background-color: #F9FAFB;
    border-top: 1px solid var(--border-color);
}

.dark .card-footer {
    background-color: #111827;
    border-top-color: #374151;
}

/* Enhanced form styles */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-color);
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    background-color: white;
    color: var(--text-color);
    transition: var(--transition-normal);
}

/* Light theme form improvements */
.form-input::placeholder {
    color: #9CA3AF;
}

.dark .form-input {
    background-color: var(--dark-secondary);
    border-color: #374151;
    color: white;
}

.dark .form-input::placeholder {
    color: #6B7280;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 120px;
}

/* Navigation enhancements */
.navbar {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-link {
    position: relative;
    transition: var(--transition-normal);
    color: #374151; /* Darker text for better contrast in light mode */
}

.dark .nav-link {
    color: #D1D5DB; /* Light text for dark mode */
}

.nav-link:hover {
    color: var(--primary-color);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--primary-color);
    transition: width var(--transition-normal);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

/* Enhanced project cards */
.project-card {
    position: relative;
    overflow: hidden;
}

.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(59, 130, 246, 0.1), rgba(147, 51, 234, 0.1));
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.project-card:hover::before {
    opacity: 1;
}

.project-image {
    position: relative;
    overflow: hidden;
}

.project-image::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.project-card:hover .project-image::after {
    opacity: 1;
}

/* Enhanced skill badges */
.skill-badge {
    position: relative;
    overflow: hidden;
    border: 1px solid transparent;
}

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

.skill-badge:hover::before {
    left: 100%;
}

/* Loading animations */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

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

/* Scroll animations */
.scroll-animate {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease;
}

.scroll-animate.in-view {
    opacity: 1;
    transform: translateY(0);
}

/* Enhanced gradients */
.gradient-text {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.gradient-border {
    position: relative;
    background: white;
    border-radius: 0.5rem;
}

.dark .gradient-border {
    background: var(--dark-secondary);
}

.gradient-border::before {
    content: '';
    position: absolute;
    inset: 0;
    padding: 2px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    border-radius: inherit;
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: subtract;
    -webkit-mask-composite: xor;
}

/* Responsive enhancements */
@media (max-width: 768px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .hero-title {
        font-size: 2rem;
        line-height: 1.1;
    }
    
    .hero-subtitle {
        font-size: 1rem;
        line-height: 1.4;
        padding: 0 1rem;
    }
    
    .hero-description {
        font-size: 0.9rem;
        line-height: 1.5;
        padding: 0 1rem;
    }
    
    .section-padding {
        padding-top: 3rem;
        padding-bottom: 3rem;
    }
    
    /* Ensure text doesn't overflow on mobile */
    .typing-animation {
        word-wrap: break-word;
        hyphens: auto;
        line-height: 1.4;
    }
}

@media (max-width: 640px) {
    .hero-title {
        font-size: 1.75rem;
        line-height: 1.2;
        margin-bottom: 1rem;
    }
    
    .hero-subtitle {
        font-size: 0.875rem;
        line-height: 1.3;
        margin-bottom: 1rem;
    }
    
    .hero-description {
        font-size: 0.875rem;
        line-height: 1.4;
        margin-bottom: 2rem;
    }
    
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
        margin: 0.25rem;
    }
    
    .card {
        margin-bottom: 1rem;
    }
    
    /* Mobile-specific typography fixes */
    h1 {
        font-size: 1.75rem;
        line-height: 1.2;
    }
    
    h2 {
        font-size: 1.5rem;
        line-height: 1.3;
    }
    
    .text-xl {
        font-size: 1rem !important;
    }
    
    .text-lg {
        font-size: 0.875rem !important;
    }
}

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

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus indicators for keyboard navigation */
.focus-visible:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid #ccc !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .btn-primary {
        border: 2px solid;
    }
    
    .card {
        border: 2px solid var(--border-color);
    }
    
    .form-input {
        border-width: 2px;
    }
}

/* Accessibility and contrast improvements */
.text-contrast-fix {
    color: #1F2937 !important;
}

.dark .text-contrast-fix {
    color: #F3F4F6 !important;
}

/* Override Tailwind text colors for better accessibility */
.text-gray-500 {
    color: #4B5563 !important; /* Darker for better contrast */
}

.text-gray-400 {
    color: #6B7280 !important; /* Darker for better contrast */
}

.dark .text-gray-500 {
    color: #9CA3AF !important;
}

.dark .text-gray-400 {
    color: #D1D5DB !important;
}

/* Ensure sufficient contrast for all text elements */
.light-text-fix {
    color: #374151;
}

.dark .light-text-fix {
    color: #E5E7EB;
}

/* Section heading contrast */
.section-heading {
    color: #111827;
}

.dark .section-heading {
    color: #F9FAFB;
}

/* Improve readability for statistics and highlights */
.stat-text {
    color: #1F2937;
}

.dark .stat-text {
    color: #F3F4F6;
}

/* Custom utilities */
.text-shadow {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.backdrop-blur {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.glass-effect {
    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);
}

.dark .glass-effect {
    background: rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.1);
}

/* Performance optimizations */
.gpu-accelerated {
    transform: translateZ(0);
    will-change: transform;
}

.contain-layout {
    contain: layout;
}

.contain-paint {
    contain: paint;
}

/* Custom scrollbar styling */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: var(--border-color);
    border-radius: 3px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* Enhanced tooltips */
.tooltip {
    position: relative;
    cursor: pointer;
}

.tooltip::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-normal);
    z-index: 1000;
}

.tooltip::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.9);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-normal);
    z-index: 1000;
}

.tooltip:hover::before,
.tooltip:hover::after {
    opacity: 1;
}
