/* Reset & Base Styles */
*, *::before, *::after {
    box-sizing: border-box;
}

/* Preloader */
#preloader {
    transition: opacity 0.5s ease-in-out, visibility 0.5s ease-in-out;
}

#preloader.hidden {
    opacity: 0;
    visibility: hidden;
}

/* Animations */
@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

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

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

.animate-fade-in-up {
    animation: fade-in-up 0.8s ease-out both;
}

.animate-fade-in-down {
    animation: fade-in-down 0.8s ease-out both;
}

.animate-slide-in-left {
    animation: slide-in-left 0.8s ease-out both;
}

.animate-slide-in-right {
    animation: slide-in-right 0.8s ease-out both;
}

.animate-float {
    animation: float 3s ease-in-out infinite;
}

/* Header Styles */
#header {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

#header.scrolled {
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
}

.dark #header.scrolled {
    background: rgba(17, 24, 39, 0.98);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
}

/* Navigation */
.nav-link {
    position: relative;
    transition: all 0.3s ease;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background: #3b82f6;
    transition: width 0.3s ease;
}

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

/* Mobile Menu */
#mobile-menu {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

#mobile-menu.open {
    transform: translateX(0);
}

.mobile-nav-link {
    transition: all 0.3s ease;
}

.mobile-nav-link:hover {
    transform: translateX(5px);
}

/* Theme Toggle */
#theme-toggle {
    transition: all 0.3s ease;
}

.dark .light-icon {
    display: none;
}

.dark .dark-icon {
    display: block !important;
}

/* Hero Section */
.hero-slider {
    position: relative;
}

.hero-slide {
    opacity: 0;
    visibility: hidden;
}

.hero-slide.active {
    opacity: 1;
    visibility: visible;
}

.hero-content-item {
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
}

.hero-content-item.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Particles */
.particles-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 1;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    animation: particle-float linear infinite;
}

@keyframes particle-float {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-10vh) rotate(360deg);
        opacity: 0;
    }
}

/* Hero Navigation Dots */
.hero-nav-dot {
    cursor: pointer;
    transition: all 0.3s ease;
}

.hero-nav-dot:hover,
.hero-nav-dot.active {
    background: white;
    transform: scale(1.2);
}

/* Buttons */
.btn-primary, .btn-secondary {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.btn-primary::before, .btn-secondary::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 ease;
}

.btn-primary:hover::before, .btn-secondary:hover::before {
    left: 100%;
}

/* Sections */
section {
    position: relative;
    overflow: hidden;
}

/* Skills Progress */
.skill-progress {
    transition: width 1.5s ease-in-out;
}

/* Portfolio Filter */
.portfolio-filter {
    transition: all 0.3s ease;
}

.portfolio-filter.active {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

/* Portfolio Items */
.portfolio-item {
    transition: all 0.5s ease;
}

.portfolio-item.hidden {
    opacity: 0;
    transform: scale(0.8);
    visibility: hidden;
}

/* Back to Top */
#back-to-top {
    transition: all 0.3s ease;
}

#back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

/* Form Styles */
.form-input, .form-textarea, .form-select {
    transition: all 0.3s ease;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.15);
}

/* Loading States */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: loading-shimmer 1.5s infinite;
}

@keyframes loading-shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* Scroll Behavior */
html {
    scroll-behavior: smooth;
}

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

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.dark ::-webkit-scrollbar-track {
    background: #1e293b;
}

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

.dark ::-webkit-scrollbar-thumb {
    background: #475569;
}

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

.dark ::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* Utility Classes */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Responsive */
@media (max-width: 768px) {
    .hero-slide {
        background-attachment: scroll !important;
    }
    
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* Print Styles */
@media print {
    #header, #back-to-top, .no-print {
        display: none !important;
    }
    
    * {
        background: white !important;
        color: black !important;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .bg-primary-500 {
        background-color: #000 !important;
    }
    
    .text-primary-500 {
        color: #000 !important;
    }
    
    .border-primary-500 {
        border-color: #000 !important;
    }
}

/* Reduce Motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    html {
        scroll-behavior: auto;
    }
}

/* Focus Styles for Accessibility */
*:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

button:focus, a:focus, input:focus, textarea:focus, select:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Image Loading */
img {
    transition: opacity 0.3s ease;
}

img[data-loading="true"] {
    opacity: 0.5;
}

/* Dark Mode Transitions */
* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}