/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: #0d0d1a;
    color: #e0e0e0;
    line-height: 1.6;
    overflow-x: hidden;
    cursor: none; /* Hides default cursor */
}

/* Custom Cursor */
body::after {
    content: '';
    position: fixed;
    width: 20px;
    height: 20px;
    background: radial-gradient(circle, #00abf0, transparent);
    border-radius: 50%;
    pointer-events: none;
    z-index: 10000; /* High z-index to stay on top */
    transform: translate(-50%, -50%);
    left: var(--x, 0px); /* Fallback if JS fails */
    top: var(--y, 0px);
    transition: width 0.2s ease, height 0.2s ease;
}

body::before {
    content: '';
    position: fixed;
    width: 10px;
    height: 10px;
    background: rgba(0, 171, 240, 0.5);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    left: var(--x, 0px);
    top: var(--y, 0px);
    animation: fadeTrail 0.5s ease forwards;
}

@keyframes fadeTrail {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

a:hover ~ body::after,
.btn:hover ~ body::after {
    width: 30px;
    height: 30px;
    background: radial-gradient(circle, #ff00ff, transparent);
}

/* Header */
.header {
    background: rgba(26, 26, 46, 0.9);
    backdrop-filter: blur(10px);
    padding: 20px 10%;
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.3s ease;
}

.header.scrolled {
    background: rgba(26, 26, 46, 1);
}

.logo {
    font-family: 'Orbitron', sans-serif;
    font-size: 2rem;
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(0, 171, 240, 0.5);
    position: relative;
    animation: flicker 2s infinite alternate;
}

@keyframes flicker {
    0% { transform: translate(0, 0); }
    10% { transform: translate(-2px, 2px); }
    20% { transform: translate(2px, -2px); }
    30% { transform: translate(-1px, 1px); }
    100% { transform: translate(0, 0); }
}

.logo:hover {
    color: #00abf0;
}

.nav-bar a {
    color: #fff;
    text-decoration: none;
    font-size: 1.1rem;
    margin-left: 30px;
    padding: 5px 10px;
    transition: all 0.3s ease;
}

.nav-bar a:hover,
.nav-bar a.active {
    color: #00abf0;
    border-bottom: 2px solid #00abf0;
    text-shadow: 0 0 5px #00abf0;
    animation: bounceTwist 0.3s ease;
}

@keyframes bounceTwist {
    0% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.2) rotate(5deg); }
    100% { transform: scale(1) rotate(0deg); }
}

.theme-toggle {
    cursor: pointer;
    color: #fff;
    font-size: 1.5rem;
    transition: transform 0.3s ease;
}

.theme-toggle:hover {
    transform: rotate(180deg);
    color: #00abf0;
}

/* Home */
.home {
    min-height: 100vh;
    position: relative;
    display: flex;
    align-items: center;
    padding: 100px 10% 0;
    overflow: hidden;
}

.parallax-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('https://images.unsplash.com/photo-1557683316-973673baf926') no-repeat center/cover;
    opacity: 0.2;
    z-index: -1;
    transform: translateZ(-1px) scale(1.5);
}

.parallax-shapes {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.shape {
    position: absolute;
    background: rgba(0, 171, 240, 0.5);
    border-radius: 50%;
    animation: float 10s infinite ease-in-out;
}

.shape1 { width: 50px; height: 50px; top: 20%; left: 10%; }
.shape2 { width: 80px; height: 80px; top: 50%; left: 70%; animation-delay: 2s; }
.shape3 { width: 30px; height: 30px; top: 80%; left: 40%; animation-delay: 4s; }

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-50px); }
}

.home-content {
    max-width: 700px;
    position: relative;
    z-index: 1;
}

.home-content h1 {
    font-family: 'Orbitron', sans-serif;
    font-size: 4rem;
    color: #fff;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 0 0 20px rgba(0, 171, 240, 0.7);
}

.home-content h1 span {
    color: #00abf0;
}

.home-content h3 {
    font-size: 2.5rem;
    color: #00abf0;
    font-weight: 600;
    margin-bottom: 20px;
}

.home-content p {
    font-size: 1.2rem;
    color: #e0e0e0;
    margin-bottom: 30px;
}

.btn-box {
    display: flex;
    gap: 20px;
}

.btn {
    padding: 12px 28px;
    background: #00abf0;
    color: #fff;
    border-radius: 30px;
    font-size: 1.1rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 0 10px rgba(0, 171, 240, 0.5);
    position: relative;
    z-index: 10; /* Ensure clickable */
}

.btn:hover {
    background: #0088cc;
    transform: translateY(-5px);
    box-shadow: 0 0 20px rgba(0, 171, 240, 0.8);
}

.home-sci a {
    color: #fff;
    font-size: 2rem;
    margin-right: 20px;
    transition: all 0.3s ease;
}

.home-sci a:hover {
    color: #00abf0;
    transform: scale(1.2);
    text-shadow: 0 0 10px #00abf0;
}

/* About */
.about {
    padding: 80px 10%;
    background: #16213e;
    text-align: center;
}

.about h2 {
    font-family: 'Orbitron', sans-serif;
    font-size: 2.5rem;
    color: #00abf0;
    margin-bottom: 40px;
}

.about-content p {
    font-size: 1.2rem;
    max-width: 800px;
    margin: 0 auto 30px;
}

.skills {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
}

.skills span {
    background: #00abf0;
    color: #fff;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 1rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.skills span::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background: radial-gradient(circle, rgba(0, 171, 240, 0.8), transparent);
    opacity: 0;
    transform: scale(0);
    transition: all 0.4s ease;
}

.skills span:hover::after {
    opacity: 1;
    transform: scale(2);
}

.skills span:hover {
    background: #0088cc;
    transform: scale(1.1);
}

/* Services */
.services {
    padding: 80px 10%;
    background: #0d0d1a;
    text-align: center;
}

.services h2 {
    font-family: 'Orbitron', sans-serif;
    font-size: 2.5rem;
    color: #00abf0;
    margin-bottom: 40px;
}

.services-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

.service-box {
    background: #1a1a2e;
    padding: 30px;
    border-radius: 10px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    border: 2px solid transparent;
    animation: glowPulse 3s infinite alternate;
}

@keyframes glowPulse {
    0% { border-color: rgba(0, 171, 240, 0.2); }
    100% { border-color: rgba(0, 171, 240, 0.8); box-shadow: 0 0 20px rgba(0, 171, 240, 0.5); }
}

.service-box:hover {
    transform: translateY(-10px) rotate(calc(2deg * var(--random, 1)));
    box-shadow: 0 10px 20px rgba(0, 171, 240, 0.3);
}

.service-box i {
    font-size: 3rem;
    color: #00abf0;
    margin-bottom: 15px;
}

.service-box h3 {
    font-size: 1.5rem;
    color: #fff;
    margin-bottom: 15px;
}

.service-box p {
    font-size: 1rem;
    color: #e0e0e0;
}

/* Portfolio */
.portfolio {
    padding: 80px 10%;
    background: #16213e;
    text-align: center;
}

.portfolio h2 {
    font-family: 'Orbitron', sans-serif;
    font-size: 2.5rem;
    color: #00abf0;
    margin-bottom: 40px;
}

.portfolio-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.portfolio-item {
    position: relative;
    perspective: 1000px;
    height: 350px;
}

.portfolio-front, .portfolio-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    transition: transform 0.6s ease;
    border-radius: 10px;
    overflow: hidden;
}

.portfolio-front {
    background: #1a1a2e;
    transform: rotateY(0deg);
}

.portfolio-back {
    background: linear-gradient(135deg, #00abf0, #0088cc);
    color: #fff;
    transform: rotateY(180deg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    position: relative;
}

.portfolio-back::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==') repeat;
    opacity: 0.1;
    animation: glitchShift 1s infinite steps(5);
}

@keyframes glitchShift {
    0% { transform: translate(0, 0); }
    20% { transform: translate(-5px, 5px); }
    40% { transform: translate(5px, -5px); }
    60% { transform: translate(-5px, 0); }
    80% { transform: translate(0, 5px); }
}

.portfolio-item:hover .portfolio-front {
    animation: wobble 0.3s ease forwards;
    transform: rotateY(-180deg);
}

@keyframes wobble {
    0% { transform: rotateY(0deg); }
    33% { transform: rotateY(-10deg); }
    66% { transform: rotateY(10deg); }
}

.portfolio-item:hover .portfolio-back {
    transform: rotateY(0deg);
}

.portfolio-front img {
    width: 100%;
    height: 70%;
    object-fit: cover;
}

.portfolio-front h3 {
    font-size: 1.3rem;
    color: #fff;
    padding: 15px;
}

.portfolio-back h3 {
    font-size: 1.5rem;
    margin-bottom: 15px;
}

.portfolio-back p {
    font-size: 1rem;
    margin-bottom: 10px;
}

.portfolio-back p strong {
    color: #fff;
    font-weight: 600;
}

.portfolio-back .btn {
    background: #fff;
    color: #00abf0;
}

/* Contact */
.contact {
    padding: 80px 10%;
    background: #0d0d1a;
    text-align: center;
}

.contact h2 {
    font-family: 'Orbitron', sans-serif;
    font-size: 2.5rem;
    color: #00abf0;
    margin-bottom: 40px;
}

.contact-container {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
}

.contact-form {
    flex: 1;
    min-width: 300px;
    background: #1a1a2e;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 171, 240, 0.2);
}

.contact-form input,
.contact-form textarea {
    width: 100%;
    padding: 12px;
    margin-bottom: 20px;
    border: none;
    border-radius: 5px;
    background: #2c3e50;
    color: #e0e0e0;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.contact-form input:focus,
.contact-form textarea:focus {
    background: #34495e;
    box-shadow: 0 0 10px #00abf0;
    animation: shakeGlow 0.5s ease;
}

@keyframes shakeGlow {
    0% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    50% { transform: translateX(5px); }
    75% { transform: translateX(-5px); }
    100% { transform: translateX(0); }
}

.contact-form button {
    padding: 12px 28px;
    background: #00abf0;
    color: #fff;
    border: none;
    border-radius: 30px;
    font-size: 1.1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.contact-form button:hover {
    background: #0088cc;
    transform: translateY(-5px);
    box-shadow: 0 0 20px rgba(0, 171, 240, 0.8);
}

.contact-form button:active::after {
    content: '';
    position: absolute;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, #00abf0, transparent);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    animation: blast 0.5s ease forwards;
}

@keyframes blast {
    0% { transform: translate(-50%, -50%) scale(0); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(2); opacity: 0; }
}

.contact-info {
    flex: 1;
    min-width: 300px;
    text-align: left;
}

.contact-info h3 {
    font-size: 1.5rem;
    color: #00abf0;
    margin-bottom: 20px;
}

.contact-info p a {
    color: #00abf0;
    text-decoration: none;
}

.contact-sci a {
    color: #fff;
    font-size: 2rem;
    margin-right: 20px;
    transition: all 0.3s ease;
}

.contact-sci a:hover {
    color: #00abf0;
    transform: scale(1.2);
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        padding: 15px 5%;
        flex-wrap: wrap;
    }
    .nav-bar {
        margin-top: 15px;
        flex-direction: column;
        gap: 10px;
    }
    .home-content h1 {
        font-size: 2.5rem;
    }
    .home-content h3 {
        font-size: 1.5rem;
    }
    .services-container, .portfolio-container {
        grid-template-columns: 1fr;
    }
    .contact-container {
        flex-direction: column;
        align-items: center;
    }
}

/* Light Theme */
body.light-theme {
    background-color: #f0f2f5;
    color: #333;
}

body.light-theme .header {
    background: rgba(255, 255, 255, 0.9);
}

body.light-theme .home {
    background: linear-gradient(135deg, #f0f2f5 0%, #e0e0e0 100%);
}

body.light-theme .about,
body.light-theme .portfolio {
    background: #e0e0e0;
}

body.light-theme .services,
body.light-theme .contact {
    background: #f0f2f5;
}

body.light-theme .service-box,
body.light-theme .portfolio-front,
body.light-theme .contact-form {
    background: #fff;
    color: #333;
}

body.light-theme .btn {
    background: #0088cc;
}

body.light-theme .skills span {
    background: #0088cc;
}