/* Hero Grid Animation - Light Theme */
body {
    position: relative;
    overflow-x: hidden;
}

main {
    position: relative;
    z-index: 1;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        linear-gradient(rgba(120, 113, 108, 0.055) 1px, transparent 1px),
        linear-gradient(90deg, rgba(120, 113, 108, 0.055) 1px, transparent 1px),
        radial-gradient(circle at 25% 25%, rgba(37, 99, 235, 0.03) 0%, transparent 42%),
        radial-gradient(circle at 75% 75%, rgba(168, 85, 247, 0.022) 0%, transparent 42%),
        radial-gradient(circle at 50% 50%, rgba(37, 99, 235, 0.014) 0%, transparent 60%);
    background-size: 50px 50px, 50px 50px, 100% 100%, 100% 100%, 100% 100%;
    animation: gridMove 24s linear infinite, ambientPulse 12s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

/* Floating particles layer */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 20% 30%, rgba(37, 99, 235, 0.1) 0%, transparent 8%),
        radial-gradient(circle at 80% 20%, rgba(168, 85, 247, 0.08) 0%, transparent 6%),
        radial-gradient(circle at 40% 70%, rgba(37, 99, 235, 0.07) 0%, transparent 5%),
        radial-gradient(circle at 70% 60%, rgba(168, 85, 247, 0.06) 0%, transparent 7%),
        radial-gradient(circle at 10% 80%, rgba(37, 99, 235, 0.08) 0%, transparent 4%),
        radial-gradient(circle at 90% 90%, rgba(168, 85, 247, 0.07) 0%, transparent 5%);
    animation: floatParticles 20s ease-in-out infinite, ambientPulse 12s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes gridMove {
    0% {
        background-position: 0 0, 0 0, 0 0, 0 0, 0 0;
    }
    100% {
        background-position: 50px 50px, 50px 50px, 0 0, 0 0, 0 0;
    }
}

@keyframes floatParticles {
    0%, 100% {
        transform: translate(0, 0) scale(1);
        opacity: 0.6;
    }
    25% {
        transform: translate(10px, -15px) scale(1.05);
        opacity: 0.8;
    }
    50% {
        transform: translate(-5px, 10px) scale(0.95);
        opacity: 0.5;
    }
    75% {
        transform: translate(15px, 5px) scale(1.02);
        opacity: 0.7;
    }
}

@keyframes ambientPulse {
    0%, 100% {
        opacity: 0.85;
    }
    50% {
        opacity: 1;
    }
}

/* Dark mode styles */
body.dark-mode {
    --page-bg: #000000;
    --text: #ffffff;
    background-color: #000000;
    color: #ffffff;
    transition: background-color 0.3s ease, color 0.3s ease;
    position: relative;
}

/* Hero Grid Animation - Dark Theme */
body.dark-mode::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.065) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.065) 1px, transparent 1px),
        radial-gradient(circle at 25% 25%, rgba(96, 165, 250, 0.045) 0%, transparent 42%),
        radial-gradient(circle at 75% 75%, rgba(168, 85, 247, 0.035) 0%, transparent 42%),
        radial-gradient(circle at 50% 50%, rgba(96, 165, 250, 0.02) 0%, transparent 60%);
    background-size: 50px 50px, 50px 50px, 100% 100%, 100% 100%, 100% 100%;
    animation: gridMove 24s linear infinite, ambientPulse 12s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}



/* Floating particles layer - Dark Theme */
body.dark-mode::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 20% 30%, rgba(96, 165, 250, 0.15) 0%, transparent 8%),
        radial-gradient(circle at 80% 20%, rgba(168, 85, 247, 0.12) 0%, transparent 6%),
        radial-gradient(circle at 40% 70%, rgba(96, 165, 250, 0.1) 0%, transparent 5%),
        radial-gradient(circle at 70% 60%, rgba(168, 85, 247, 0.09) 0%, transparent 7%),
        radial-gradient(circle at 10% 80%, rgba(96, 165, 250, 0.1) 0%, transparent 4%),
        radial-gradient(circle at 90% 90%, rgba(168, 85, 247, 0.09) 0%, transparent 5%);
    animation: floatParticles 20s ease-in-out infinite, ambientPulse 12s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

body.dark-mode .border-stone-200 { 
    border-color: #374151; 
    transition: border-color 0.3s ease;
}

body.dark-mode .bg-white { 
    background-color: #111827; 
    transition: background-color 0.3s ease;
    position: relative;
}

body.dark-mode .bg-white::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.02);
    pointer-events: none;
}

body.dark-mode .text-stone-700 { 
    color: #ffffff; 
    transition: color 0.3s ease;
}

body.dark-mode .text-stone-800 { 
    color: #ffffff; 
    transition: color 0.3s ease;
}

body.dark-mode .text-stone-500 { 
    color: #ffffff; 
    transition: color 0.3s ease;
}

body.dark-mode .border-stone-300 { 
    border-color: #4b5563; 
    transition: border-color 0.3s ease;
}

body.dark-mode .bg-stone-50 { 
    background-color: #111827; 
    transition: background-color 0.3s ease;
    position: relative;
}

body.dark-mode .bg-stone-50::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.015);
    pointer-events: none;
}

body.dark-mode .border-stone-300-50 { 
    border-color: rgba(75, 85, 99, 0.5); 
    transition: border-color 0.3s ease;
}

body.dark-mode .bg-white-30 { 
    background-color: rgba(17, 17, 17, 0.3); 
    transition: background-color 0.3s ease;
}

body.dark-mode .hover-bg-white-50:hover { 
    background-color: rgba(17, 17, 17, 0.5); 
    transition: background-color 0.3s ease;
}

body.dark-mode .bg-stone-100 { 
    background-color: #111827;
    position: relative;
}

body.dark-mode .bg-stone-100::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.025);
    pointer-events: none;
}

body.dark-mode .hover-bg-stone-200:hover { 
    background-color: #4b5563; 
    transition: background-color 0.3s ease;
}

body.dark-mode .hover-bg-stone-50:hover { 
    background-color: #111111; 
    transition: background-color 0.3s ease;
}

/* Enhanced theme toggle styles */
.theme-toggle-knob {
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.5s ease;
}

.theme-toggle-knob svg {
    transition: color 0.5s ease, opacity 0.3s ease;
}

body.dark-mode .theme-toggle-knob svg {
    color: #fbbf24;
}

/* Enhanced toggle button in dark mode with smooth transitions */
button[aria-label="Toggle theme"] {
    transition: border-color 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease;
}

body.dark-mode button[aria-label="Toggle theme"] {
    border-color: #4b5563;
    background-color: #1f2937;
}

body.dark-mode button[aria-label="Toggle theme"]:hover {
    border-color: #6b7280;
    background-color: #374151;
}

/* Experience section - Dark mode */
body.dark-mode .dark-dot-current {
    background-color: #ffffff;
}

body.dark-mode .dark-dot-hollow {
    background-color: #111827;
    border-color: #6b7280;
}

body.dark-mode .group:hover .dark-dot-hollow {
    background-color: #374151;
    border-color: #9ca3af;
}

body.dark-mode .dark-line {
    background-color: #4b5563;
}

body.dark-mode .text-stone-400 {
    color: #9ca3af;
}

body.dark-mode .text-stone-300 {
    color: #6b7280;
}

body.dark-mode .text-stone-500 {
    color: #d1d5db;
}

/* Experience section - minimalist timeline redesign */
.xp-timeline {
    position: relative;
    padding-bottom: 0.25rem;
}

.xp-timeline::before {
    content: '';
    position: absolute;
    left: 0.4375rem;
    top: 0.4rem;
    bottom: 0.4rem;
    width: 1px;
    background-color: #e7e5e4;
}

.xp-item {
    position: relative;
    padding-left: 1.75rem;
    margin-bottom: 0.6rem;
}

.xp-dot {
    position: absolute;
    left: 0.125rem;
    top: 0.32rem;
    width: 0.625rem;
    height: 0.625rem;
    border: 1px solid #d6d3d1;
    background-color: #ffffff;
    transition: background-color 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}

.xp-item-current .xp-dot {
    background-color: #0c0a09;
    border-color: #0c0a09;
}

.xp-item-toggle:hover .xp-dot {
    transform: scale(1.08);
    border-color: #78716c;
}

.xp-content {
    border: 1px solid transparent;
    padding: 0.1rem 0.3rem 0.2rem 0;
    transition: border-color 0.25s ease, background-color 0.25s ease;
}

.xp-item-toggle:hover .xp-content {
    border-color: transparent;
}

.xp-details {
    margin: 0 0 0.9rem 1.75rem;
    border: 1px solid #e7e5e4;
    background-color: rgba(250, 250, 249, 0.7);
}

body.dark-mode .xp-timeline::before {
    background-color: #4b5563;
}

body.dark-mode .xp-dot {
    border-color: #6b7280;
    background-color: #111827 !important;
}

body.dark-mode .xp-item-current .xp-dot {
    border-color: #ffffff;
    background-color: #ffffff !important;
}

body.dark-mode .xp-item-toggle:hover .xp-dot {
    border-color: #9ca3af;
    background-color: #374151 !important;
}

body.dark-mode .xp-item-toggle:hover .xp-content {
    border-color: transparent;
}

body.dark-mode .xp-details {
    border-color: #374151 !important;
    background-color: rgba(17, 24, 39, 0.5) !important;
}

/* Fix company name backgrounds in experience section */
body.dark-mode .text-xs.text-stone-500,
body.dark-mode p.text-xs.text-stone-500 {
    color: #9ca3af !important;
    background-color: transparent !important;
    background: none !important;
}

/* Remove any background from experience section text */
body.dark-mode .flex-1 p,
body.dark-mode .flex-1 .text-xs {
    background-color: transparent !important;
    background: none !important;
}

/* Force all experience section elements to have transparent backgrounds */
body.dark-mode section .flex-1 *,
body.dark-mode section .text-xs,
body.dark-mode section p {
    background-color: transparent !important;
    background: none !important;
}

/* Specific fix for company names and positions */
body.dark-mode .text-xs.text-stone-500,
body.dark-mode .text-xs.text-stone-400,
body.dark-mode .text-xs.text-stone-300 {
    color: #9ca3af !important;
    background-color: transparent !important;
    background: none !important;
}

body.dark-mode .text-stone-600 {
    color: #e5e7eb;
}

body.dark-mode .text-stone-900 {
    color: #ffffff;
}

body.dark-mode .text-stone-100 {
    color: #f3f4f6;
}

body.dark-mode .text-stone-200 {
    color: #e5e7eb;
}

/* Section headings and titles in dark mode */
body.dark-mode h1, 
body.dark-mode h2, 
body.dark-mode h3,
body.dark-mode .text-xl,
body.dark-mode .text-base,
body.dark-mode .text-sm {
    color: #ffffff !important;
}

/* Specific fixes for buttons and links */
body.dark-mode .text-stone-700,
body.dark-mode .text-stone-800 {
    color: #ffffff !important;
}

body.dark-mode .font-bold {
    color: #ffffff !important;
}

/* Service section and other card fixes */
body.dark-mode section.border.border-stone-200.bg-white h3,
body.dark-mode section.border.border-stone-200.bg-white p,
body.dark-mode .border.border-stone-200.bg-white p,
body.dark-mode .border.border-stone-200.bg-white span {
    color: #ffffff !important;
}

/* Fix for tech stack items text */
body.dark-mode .border.border-stone-100.bg-stone-50 span {
    color: #e5e7eb !important;
}

/* Fix for experience timeline text */
body.dark-mode .text-stone-300,
body.dark-mode .text-stone-400 {
    color: #9ca3af !important;
}

/* Universal transparent borders for all sections in dark mode */
body.dark-mode .border-stone-200 {
    border-color: #374151;
}

body.dark-mode .bg-white {
    background-color: #111827 !important;
}

body.dark-mode .border-stone-300 {
    border-color: #4b5563;
}

/* Force all sections with white backgrounds to dark in dark mode */
body.dark-mode section.bg-white,
body.dark-mode .border.border-stone-200.bg-white,
body.dark-mode div.bg-white {
    background-color: #111827 !important;
    border-color: #374151 !important;
}

/* Project cards specific fix */
body.dark-mode .border.border-stone-200.bg-white.p-6 {
    background-color: #111827 !important;
    border-color: #374151 !important;
}

/* Comprehensive fix for any remaining white elements 
body.dark-mode * {
    background-color: inherit !important;
}
*/


body.dark-mode .bg-white,
body.dark-mode [class*="bg-white"] {
    background-color: #111827 !important;
}

/* Ensure all borders are properly colored in dark mode */
body.dark-mode [class*="border-stone"] {
    border-color: #374151 !important;
}

body.dark-mode [class*="border-stone-300"] {
    border-color: #4b5563 !important;
}

/* Tech Stack section - Dark mode - completely hidden containers */
body.dark-mode .border-stone-100 {
    border-color: #374151;
    transition: none;
}

body.dark-mode .bg-stone-50 {
    background-color: #111827;
    transition: background-color 0.3s ease;
}

body.dark-mode .text-stone-600 {
    color: #e5e7eb;
    transition: none;
}

/* Tech stack items - completely hidden in dark mode */
body.dark-mode .border.border-stone-100.bg-stone-50 {
    border-color: #374151;
    background-color: #111827;
    transition: none;
    cursor: default;
}

body.dark-mode .border.border-stone-100.bg-stone-50:hover {
    border-color: #4b5563;
    background-color: #1f2937;
    cursor: default;
}

/* Experience descriptions - Dark mode transitions */
body.dark-mode #desc3,
body.dark-mode #desc4,
body.dark-mode #desc5 {
    background-color: #111827;
    border-color: #374151;
    transition: background-color 0.5s cubic-bezier(0.4, 0, 0.2, 1), 
                border-color 0.5s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1),
                max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1),
                padding 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

body.dark-mode #desc3 p,
body.dark-mode #desc4 p,
body.dark-mode #desc5 p {
    color: #e5e7eb;
    transition: color 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Timeline dots - Enhanced transitions */
body.dark-mode .dark-dot-hollow {
    transition: background-color 0.5s cubic-bezier(0.4, 0, 0.2, 1), 
                border-color 0.5s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

body.dark-mode .group:hover .dark-dot-hollow {
    transition: background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark theme - blended borders and floating hover effects */
body.dark-mode .border-stone-200.bg-white {
    border-color: rgba(37, 41, 46, 0.8);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body.dark-mode .border-stone-200.bg-white:hover {
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.05);
    transform: translateY(-1px);
}

/* Enhanced floating animation for sections in dark theme */
body.dark-mode section.border.border-stone-200.bg-white {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
/*
body.dark-mode section.border.border-stone-200.bg-white:hover {
     transform: translateY(1px) scale(1.01);
    box-shadow: 0 8px 24px rgba(255, 255, 255, 0.08);
}*/

/* Light theme - blended borders and floating hover effects */
.border-stone-200.bg-white {
    border-color: #e7e5e4;
    background-color: #ffffff;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.border-stone-200.bg-white:hover {
   
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transform: translateY(-1px);
}

/* Enhanced floating animation for sections */
section.border.border-stone-200.bg-white {
    background-color: #ffffff;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.bg-stone-50 {
    background-color: #fafaf9;
}
/*
section.border.border-stone-200.bg-white:hover {
    transform: translateY(1px) scale(1.01);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}*/

/* Base body transition */
body {
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Get in Touch buttons - Enhanced hover effects */
.inline-flex.items-center.gap-2.border.border-stone-300 {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: auto;
    min-width: auto;
    height: auto;
    justify-content: center;
    align-items: center;
    font-size: 12px;
    padding: 0 8px;
}

@media (min-width: 640px) {
    .inline-flex.items-center.gap-2.border.border-stone-300 {
        width: 140px;
        height: 31px;
    }
}

.inline-flex.items-center.gap-2.border.border-stone-300:hover {
    background-color: #f8fafc;
    border-color: #cbd5e1;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* Dark mode - Get in Touch buttons */
body.dark-mode .inline-flex.items-center.gap-2.border.border-stone-300:hover {
    background-color: #1f2937;
    border-color: #374151;
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.05);
}

/* Modal - Dark mode styles */
body.dark-mode #projectModal .bg-white {
    background-color: #111827;
    border-color: #374151;
}

body.dark-mode #projectModal .text-stone-800 {
    color: #ffffff;
}

body.dark-mode #projectModal .text-stone-400 {
    color: #9ca3af;
}

body.dark-mode #projectModal .border-stone-200 {
    border-color: #374151;
}

/* Modal slider buttons - Dark mode */
body.dark-mode #projectModal button[aria-label="Previous slide"],
body.dark-mode #projectModal button[aria-label="Next slide"] {
    background-color: rgba(31, 41, 55, 0.95) !important;
    border-color: #4b5563 !important;
    color: #e5e7eb !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

body.dark-mode #projectModal button[aria-label="Previous slide"]:hover,
body.dark-mode #projectModal button[aria-label="Next slide"]:hover {
    background-color: rgba(55, 65, 81, 1) !important;
    border-color: #6b7280 !important;
    color: #ffffff !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

body.dark-mode #projectModal button[aria-label="Previous slide"] svg,
body.dark-mode #projectModal button[aria-label="Next slide"] svg {
    stroke: #e5e7eb !important;
}

body.dark-mode #projectModal button[aria-label="Previous slide"]:hover svg,
body.dark-mode #projectModal button[aria-label="Next slide"]:hover svg {
    stroke: #ffffff !important;
}

/* Modal indicators - Dark mode */
body.dark-mode #projectModal .bg-stone-300 {
    background-color: #4b5563;
}

body.dark-mode #projectModal .bg-stone-600 {
    background-color: #9ca3af;
}

/* View buttons - Dark mode hover fix */
body.dark-mode button.text-stone-600:hover.text-stone-800 {
    color: #ffffff !important;
}

body.dark-mode button.border-stone-300:hover.border-stone-400 {
    border-color: #6b7280 !important;
}

body.dark-mode button.hover\:bg-stone-100:hover {
    background-color: #374151 !important;
}

/* Recent Projects Demo buttons - Dark mode specific fix */
body.dark-mode button[onclick*="openModal"]:hover {
    color: #ffffff !important;
    background-color: #374151 !important;
    border-color: #6b7280 !important;
}

/* Certificate view buttons - minimalist styling */
button[onclick*="openCertificateModal"] {
    transition: all 0.2s ease;
}

button[onclick*="openCertificateModal"]:hover {
    color: #57534e !important;
    background-color: #f5f5f4 !important;
    border-color: #e7e5e4 !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Dark mode certificate view buttons - minimalist */
body.dark-mode button[onclick*="openCertificateModal"]:hover {
    color: #d1d5db !important;
    background-color: #374151 !important;
    border-color: #4b5563 !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Modal animation consistency - Force smooth transitions */
#projectModal {
    pointer-events: none;
}

#projectModal:not(.hidden) {
    pointer-events: auto;
}

#modalContent {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    will-change: transform, opacity;
    backface-visibility: hidden;
    transform: translateZ(0);
}

/* Dark mode transition fix */
body.dark-mode #modalContent {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* Prevent backdrop transition conflicts */
#projectModal > div:first-child {
    transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* Prevent layout shifts during modal transitions */
body {
    overflow-x: hidden;
}

body.modal-open {
    overflow: hidden;
    padding-right: var(--scrollbar-compensation, 0px);
}

/* Certificate Modal - Dark mode styles */
body.dark-mode #certificateModal .bg-white {
    background-color: #111827;
    border-color: #374151;
}

body.dark-mode #certificateModal .text-stone-900 {
    color: #ffffff;
}

body.dark-mode #certificateModal .text-stone-400 {
    color: #9ca3af;
}

body.dark-mode #certificateModal .border-stone-200 {
    border-color: #374151;
}

/* Certificate Modal animation */
#certificateModal {
    pointer-events: none;
}

#certificateModal:not(.hidden) {
    pointer-events: auto;
}

#certModalContent {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    will-change: transform, opacity;
    backface-visibility: hidden;
    transform: translateZ(0);
}

/* Dark mode transition fix for certificate modal */
body.dark-mode #certModalContent {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* Prevent backdrop transition conflicts for certificate modal */
#certificateModal > div:first-child {
    transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* Small screen hero section fixes */
@media (max-width: 374px) {
    .flex.flex-row.items-start.gap-4 {
        gap: 0.75rem;
    }
}

/* Very small screen fixes (below 320px) */
@media (max-width: 319px) {
    .flex.flex-row.items-start.gap-3,
    .flex.flex-row.items-start.gap-4 {
        gap: 0.5rem;
    }
    
    /* Allow buttons to wrap on tiny screens */
    .mt-3.sm\:mt-4.md\:mt-9.flex.flex-row {
        flex-wrap: wrap;
    }
    
    /* Reduce image further */
    .relative.h-24.w-20 {
        height: 80px;
        width: 64px;
    }
}

/* Mobile Responsiveness Improvements */
@media (max-width: 640px) {
    /* Center gallery heading on mobile */
    section.mt-6 .mb-8.flex.items-center.justify-between {
        justify-content: center;
    }

    /* Hero section improvements */
    .h-24.w-24 {
        height: 96px;
        width: 96px;
    }
    
    /* Better touch targets for buttons */
    button, a.inline-flex {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Services grid - single column on mobile */
    .md\:grid-cols-3 {
        grid-template-columns: 1fr;
    }
    
    /* Projects grid - single column on very small screens */
    .sm\:grid-cols-2 {
        grid-template-columns: 1fr;
    }
    
    /* Modal improvements for mobile */
    #modalContent, #certModalContent {
        max-width: calc(100vw - 32px);
        max-height: 90vh;
        margin: 16px;
    }
    
    /* Chat button position on mobile */
    .fixed.bottom-6.right-6 {
        bottom: 16px;
        right: 16px;
    }
    
    /* Better font sizes for mobile */
    .text-xl {
        font-size: 1.25rem;
    }
    
    /* Ensure proper spacing on mobile */
    section.border.border-stone-200.bg-white {
        padding: 1rem;
    }
    
    /* Certificates view button styling */
    .py-3\.5 {
        padding-top: 0.875rem;
        padding-bottom: 0.875rem;
    }
}

@media (max-width: 768px) {
    /* Main container adjustments */
    main {
        padding-left: 16px;
        padding-right: 16px;
    }
    
    /* Grid layout for mobile - stack columns */
    .md\:grid-cols-12 {
        grid-template-columns: 1fr;
    }
    
    .md\:col-span-7, .md\:col-span-5 {
        grid-column: span 1;
    }
    
    /* Theme toggle button size for mobile */
    button[aria-label="Toggle theme"] {
        height: 28px;
        width: 48px;
    }
    
    button[aria-label="Toggle theme"] span {
        height: 20px;
        width: 20px;
    }
}

/* Smooth transitions for all interactive elements on mobile */
@media (hover: none) and (pointer: coarse) {
    /* Remove hover effects that don't work well on touch */
    .hover\:border-stone-300:hover,
    .hover\:bg-stone-50:hover,
    .hover\:bg-stone-100:hover {
        border-color: inherit;
        background-color: inherit;
    }
    
    /* Add active states instead */
    .border-stone-200:active {
        border-color: #3b82f6;
    }
    
    /* Better tap highlight */
    button, a {
        -webkit-tap-highlight-color: rgba(59, 130, 246, 0.2);
    }
}

/* Ensure modals are properly centered on all devices */
#projectModal > div.relative,
#certificateModal > div.relative {
    min-height: 100vh;
    min-height: 100dvh; /* Dynamic viewport height for mobile */
}

/* Fix for iOS Safari modal issues */
@supports (-webkit-touch-callout: none) {
    #projectModal,
    #certificateModal {
        -webkit-overflow-scrolling: touch;
    }
    
    #modalContent,
    #certModalContent {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
}

/* Enhanced Chat Widget Styles */
.chat-message {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: fit-content;
    max-width: 88%;
    animation: messageSlide 0.3s ease-out;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.user-message {
    margin-left: auto;
    margin-right: 0;
    align-items: flex-end;
    max-width: 94%;
}

.bot-message {
    margin-right: auto;
    align-items: flex-start;
}

#chatMessages {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px 6px 12px 10px;
}

.message-content {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 13px;
    line-height: 1.45;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    white-space: pre-wrap;
    font-weight: 400;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
    width: 100%;
    max-width: 100%;
}

.user-message .message-content {
    background: linear-gradient(135deg, #1e293b, #334155);
    color: white;
    border-bottom-right-radius: 4px;
    border: none;
}

.bot-message .message-content {
    background-color: #ffffff;
    color: #1e293b;
    border-bottom-left-radius: 4px;
    border: 1px solid #e2e8f0;
}

.message-time {
    font-size: 10px;
    color: #94a3b8;
    margin: 0 6px;
    font-weight: 500;
}

/* Chat widget entrance animation */
#chatWidget {
    animation: widgetSlideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes widgetSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Chat button hover effects */
#chatButton {
    backdrop-filter: blur(10px);
}

#chatButton:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

/* Scrollbar styling for chat messages */
#chatMessages::-webkit-scrollbar {
    width: 4px;
}

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

#chatMessages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 2px;
}

#chatMessages::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Typing indicator animation */
.typing-dots {
    display: inline-flex;
    gap: 3px;
    align-items: center;
}

.typing-dots span {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: #94a3b8;
    animation: typingDot 1.2s infinite ease-in-out;
}

.typing-dots span:nth-child(1) {
    animation-delay: 0s;
}

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

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

@keyframes typingDot {
    0%, 60%, 100% {
        opacity: 0.4;
        transform: scale(0.8);
    }
    30% {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* Dark theme typing indicator */
#chatWidget.dark-theme .typing-dots span {
    background-color: #6b7280;
}

/* Typing indicator smaller padding */
.typing-indicator .message-content {
    padding: 6px 10px;
    min-width: 40px;
    min-height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Enhanced Chat Widget Dark Theme */
#chatWidget.dark-theme {
    background-color: rgba(17, 24, 39, 0.95) !important;
    border-color: rgba(55, 65, 81, 0.8) !important;
    backdrop-filter: blur(12px);
}

#chatWidget.dark-theme .bg-white {
    background-color: rgba(17, 24, 39, 0.9) !important;
}

#chatWidget.dark-theme .border-stone-100 {
    border-color: rgba(55, 65, 81, 0.6) !important;
}

#chatWidget.dark-theme .border-stone-200 {
    border-color: rgba(55, 65, 81, 0.8) !important;
}

#chatWidget.dark-theme .bg-stone-50 {
    background-color: rgba(31, 41, 55, 0.5) !important;
}

#chatWidget.dark-theme .text-stone-900 {
    color: #ffffff !important;
}

#chatWidget.dark-theme .text-stone-500 {
    color: #9ca3af !important;
}

#chatWidget.dark-theme .text-stone-400 {
    color: #6b7280 !important;
}

/* Service Icons - Dark Theme Enhancement */
body.dark-mode .grid.gap-6 .inline-flex.h-10.w-10 {
    background-color: #1f2937 !important;
    border-color: #374151 !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body.dark-mode .grid.gap-6 .inline-flex.h-10.w-10 svg {
    stroke: #60a5fa !important;
    transition: stroke 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Service Icon Hover Effects - Dark Theme */
body.dark-mode .group:hover .inline-flex.h-10.w-10 {
    background-color: #374151 !important;
    border-color: #4b5563 !important;
    transform: scale(1.02);
}

body.dark-mode .group:hover .inline-flex.h-10.w-10 svg {
    stroke: #d1d5db !important;
}

/* Service Icons - Light Theme Enhancement (for consistency) */
.grid.gap-6 .inline-flex.h-10.w-10 {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.grid.gap-6 .inline-flex.h-10.w-10 svg {
    transition: stroke 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Service Icon Hover Effects - Light Theme */
body:not(.dark-mode) .group:hover .inline-flex.h-10.w-10 {
    background-color: #f5f5f4 !important;
    border-color: #e7e5e4 !important;
    transform: scale(1.02);
}

body:not(.dark-mode) .group:hover .inline-flex.h-10.w-10 svg {
    stroke: #57534e !important;
}

#chatWidget.dark-theme .hover\:bg-stone-50:hover {
    background-color: rgba(55, 65, 81, 0.8) !important;
}

#chatWidget.dark-theme .bot-message .message-content {
    background-color: rgba(31, 41, 55, 0.9) !important;
    color: #e5e7eb !important;
    border-color: rgba(55, 65, 81, 0.8) !important;
}

#chatWidget.dark-theme .user-message .message-content {
    background: linear-gradient(135deg, #374151, #4b5563) !important;
}

#chatWidget.dark-theme .message-time {
    color: #9ca3af !important;
}

#chatWidget.dark-theme input {
    background-color: rgba(31, 41, 55, 0.9) !important;
    border-color: rgba(55, 65, 81, 0.8) !important;
    color: #e5e7eb !important;
}

#chatWidget.dark-theme input::placeholder {
    color: #6b7280 !important;
}

#chatWidget.dark-theme input:focus {
    border-color: #3b82f6 !important;
    background-color: rgba(31, 41, 55, 1) !important;
}

#chatWidget.dark-theme #chatButton {
    background-color: rgba(17, 24, 39, 0.9) !important;
    border-color: rgba(55, 65, 81, 0.8) !important;
    color: #e5e7eb !important;
}

#chatWidget.dark-theme #chatButton:hover {
    background-color: rgba(31, 41, 55, 0.9) !important;
    border-color: rgba(75, 85, 99, 0.8) !important;
}

/* Fix chat widget positioning in dark theme */

/* Gallery Section - Dark mode */
body.dark-mode #prevBtn {
    background-color: rgba(31, 41, 55, 0.95) !important;
    border-color: #4b5563 !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

body.dark-mode #nextBtn {
    background-color: rgba(31, 41, 55, 0.95) !important;
    border-color: #4b5563 !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

body.dark-mode #prevBtn:hover {
    background-color: rgba(55, 65, 81, 1) !important;
    border-color: #6b7280 !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

body.dark-mode #nextBtn:hover {
    background-color: rgba(55, 65, 81, 1) !important;
    border-color: #6b7280 !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

body.dark-mode #prevBtn svg,
body.dark-mode #nextBtn svg {
    color: #e5e7eb !important;
    stroke: #e5e7eb;
}

body.dark-mode .gallery-dot.bg-stone-800 {
    background-color: #ffffff !important;
}

body.dark-mode .gallery-dot.bg-stone-300 {
    background-color: #4b5563 !important;
}

body.dark-mode .gallery-dot:hover {
    background-color: #6b7280 !important;
}

/* Theme Transition Video */
#themeTransitionVideoDark,
#themeTransitionVideoLight {
    transition: opacity 0.5s ease-in-out;
    background-color: #000 !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

#themeTransitionVideoDark.opacity-1,
#themeTransitionVideoLight.opacity-1 {
    opacity: 1 !important;
}

#themeTransitionVideoDark.opacity-0,
#themeTransitionVideoLight.opacity-0 {
    opacity: 0 !important;
}
body.dark-mode #chatWidget {
    position: fixed !important;
    bottom: 2rem !important;
    right: 2rem !important;
    z-index: 40 !important;
}

body.dark-mode #chatButton {
    position: fixed !important;
    bottom: 2rem !important;
    right: 2rem !important;
    z-index: 40 !important;
}

/* Enhanced Chat Mobile responsiveness */
@media (max-width: 640px) {
    #chatWidget {
        width: calc(100vw - 24px) !important;
        height: 75vh !important;
        right: 12px !important;
        bottom: 12px !important;
        max-height: 600px;
    }
    
    #chatButton {
        bottom: 12px !important;
        right: 12px !important;
    }
    
    /* Dark theme mobile positioning fixes */
    body.dark-mode #chatWidget {
        width: calc(100vw - 24px) !important;
        height: 75vh !important;
        right: 12px !important;
        bottom: 12px !important;
        max-height: 600px;
    }
    
    body.dark-mode #chatButton {
        bottom: 12px !important;
        right: 12px !important;
    }
    
    .message-content {
        font-size: 12px;
        padding: 8px 12px;
    }

    .chat-message {
        max-width: 92%;
    }

    .user-message {
        max-width: 96%;
    }
    
    .message-time {
        font-size: 9px;
    }
}
