/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #3b82f6;
    --secondary: #10b981;
    --text: #e5e7eb;
    --light-text: #9ca3af;
    --background: #0f172a;
    --section-bg: #1e293b;
    --accent: #8b5cf6;
    --dark-bg: #020617;
    --card-bg: rgba(30, 41, 59, 0.8);
}

body {
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    color: var(--text);
    background-color: var(--background);
    overflow-x: hidden;
    position: relative;
}

/* 3D Background Animation */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 30%, rgba(59, 130, 246, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(16, 185, 129, 0.1) 0%, transparent 50%);
    z-index: -1;
    pointer-events: none;
}

/* Floating particles animation */
.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

.particle {
    position: absolute;
    background: rgba(59, 130, 246, 0.5);
    border-radius: 50%;
    animation: float 15s infinite linear;
}

@keyframes float {
    0% {
        transform: translateY(0) translateX(0);
    }
    50% {
        transform: translateY(-100px) translateX(50px);
    }
    100% {
        transform: translateY(0) translateX(0);
    }
}

/* Stars animation */
.stars {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

.star {
    position: absolute;
    background: white;
    border-radius: 50%;
    animation: twinkle 3s infinite ease-in-out;
}

@keyframes twinkle {
    0%, 100% {
        opacity: 0.2;
    }
    50% {
        opacity: 1;
    }
}

/* Planets animation */
.planets {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

.planet {
    position: absolute;
    border-radius: 50%;
    animation: orbit 30s infinite linear;
}

@keyframes orbit {
    0% {
        transform: rotate(0deg) translateX(100px) rotate(0deg);
    }
    100% {
        transform: rotate(360deg) translateX(100px) rotate(-360deg);
    }
}

/* Code rain animation */
.code-rain {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}

.code-line {
    position: absolute;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    white-space: nowrap;
    opacity: 0.7;
    animation: code-fall 12s infinite linear;
}

@keyframes code-fall {
    0% {
        transform: translateY(-100%);
        opacity: 0;
    }
    10% {
        opacity: 0.7;
    }
    90% {
        opacity: 0.7;
    }
    100% {
        transform: translateY(100vh);
        opacity: 0;
    }
}

/* Navigation */
header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 1rem 2rem;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(10px);
    z-index: 1000;
    transition: all 0.3s ease;
}

header.scroll-down {
    transform: translateY(-100%);
}

header.scroll-up {
    transform: translateY(0);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
}

.logo::after {
    content: '';
    position: absolute;
    width: 30px;
    height: 30px;
    background: rgba(59, 130, 246, 0.2);
    border-radius: 50%;
    z-index: -1;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.5;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 0.2;
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.5;
    }
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-links a {
    color: var(--text);
    text-decoration: none;
    transition: color 0.3s ease;
}

.nav-links a:hover {
    color: var(--primary);
}

/* Hero Section */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
    position: relative;
    background: linear-gradient(to bottom, var(--dark-bg), var(--background));
}

.hero::before {
    content: '';
    position: absolute;
    width: 200%;
    height: 200%;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><rect width="100" height="100" fill="none" stroke="rgba(59, 130, 246, 0.1)" stroke-width="0.5"/></svg>');
    opacity: 0.5;
    animation: grid-animation 20s linear infinite;
    z-index: -1;
}

@keyframes grid-animation {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }
    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
    padding: 2rem;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transform: translateY(0);
    transition: transform 0.5s ease, box-shadow 0.5s ease;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.hero-content:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.hero h1 {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero h2 {
    font-size: 1.5rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.25rem;
    color: var(--light-text);
    margin-bottom: 2rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--accent);
    transform: translateY(-2px);
}

.btn-secondary {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-secondary:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
}

.cta-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* Sections */
section {
    padding: 5rem 2rem;
    position: relative;
    z-index: 1;
}

section h2 {
    font-size: 2.5rem;
    margin-bottom: 3rem;
    text-align: center;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* About Section */
.about-content {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
    background: rgba(15, 23, 42, 0.7);
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.about-text p {
    margin-bottom: 1.5rem;
    color: var(--light-text);
}

/* Projects Section */
.projects {
    background: var(--section-bg);
    position: relative;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.project-card {
    background: var(--card-bg);
    border-radius: 1rem;
    overflow: hidden;
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.project-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.project-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.project-content {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.project-content h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text);
}

.project-content p {
    color: var(--light-text);
    margin-bottom: 1.5rem;
}

.project-links {
    margin-top: auto;
    padding-top: 1rem;
    display: flex;
    justify-content: center;
}

.project-links .btn {
    width: 100%;
    text-align: center;
}

/* Skills Section */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.skill-category {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 1rem;
    backdrop-filter: blur(10px);
}

.skill-category h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text);
}

.skill-list {
    list-style: none;
}

.skill-list li {
    color: var(--light-text);
    margin-bottom: 0.5rem;
}

/* Contact Section */
.contact {
    background: var(--section-bg);
}

.contact-form {
    max-width: 600px;
    margin: 0 auto;
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 1rem;
    backdrop-filter: blur(10px);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--light-text);
    border-radius: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 2rem;
}

.social-links a {
    color: var(--primary);
    font-size: 1.5rem;
    transition: all 0.3s ease;
    position: relative;
}

.social-links a::before {
    content: '';
    position: absolute;
    width: 40px;
    height: 40px;
    background: rgba(59, 130, 246, 0.2);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: -1;
    transition: all 0.3s ease;
}

.social-links a:hover {
    color: var(--secondary);
    transform: translateY(-5px);
}

.social-links a:hover::before {
    width: 50px;
    height: 50px;
    background: rgba(59, 130, 246, 0.3);
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    background: var(--dark-bg);
    color: var(--light-text);
}

footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
}

/* Animation Classes */
.hidden {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s ease;
}

.fade-in {
    opacity: 1;
    transform: translateY(0);
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-links {
        display: none;
    }
    
    .hero h1 {
        font-size: 2.5rem;
    }
    
    .hero h2 {
        font-size: 1.2rem;
    }
    
    .hero p {
        font-size: 1rem;
    }
    
    section {
        padding: 3rem 1rem;
    }
    
    .projects-grid,
    .skills-grid {
        grid-template-columns: 1fr;
    }
    
    .project-card {
        margin-bottom: 1.5rem;
    }
    
    .project-image {
        height: 180px;
    }
    
    .project-content {
        padding: 1.25rem;
    }
    
    .project-content h3 {
        font-size: 1.3rem;
    }
    
    .project-links {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .project-links .btn {
        width: 100%;
        text-align: center;
    }
    
    .cta-buttons {
        flex-direction: column;
        gap: 1rem;
    }
    
    .cta-buttons .btn {
        width: 100%;
        text-align: center;
    }
    
    .contact-form {
        padding: 1.5rem;
    }
    
    .social-links {
        flex-wrap: wrap;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .hero h1 {
        font-size: 2rem;
    }
    
    .hero h2 {
        font-size: 1rem;
    }
    
    .hero p {
        font-size: 0.9rem;
    }
    
    section h2 {
        font-size: 2rem;
    }
    
    .about-content {
        padding: 1.5rem;
    }
    
    .skill-category {
        padding: 1.5rem;
    }
    
    .skill-category h3 {
        font-size: 1.2rem;
    }
    
    .form-group input,
    .form-group textarea {
        padding: 0.6rem;
    }
    
    .btn {
        padding: 0.6rem 1.2rem;
    }
}

/* Touch-friendly improvements */
@media (hover: none) {
    .btn:hover {
        transform: none;
    }
    
    .project-card:hover {
        transform: none;
    }
    
    .social-links a:hover {
        transform: none;
    }
    
    .nav-links a {
        padding: 0.5rem;
    }
    
    .project-links .btn {
        padding: 0.8rem 1.5rem;
    }
}

/* Ensure tap targets are large enough */
.nav-links a,
.social-links a,
.btn {
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Improve form usability on mobile */
.form-group input,
.form-group textarea {
    font-size: 16px; /* Prevents iOS zoom on focus */
}

/* Add a mobile menu toggle button */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text);
    font-size: 1.5rem;
    cursor: pointer;
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: block;
    }
    
    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 70%;
        height: 100vh;
        background: var(--background);
        flex-direction: column;
        padding: 5rem 2rem;
        transition: right 0.3s ease;
        z-index: 1001;
    }
    
    .nav-links.active {
        right: 0;
    }
    
    .nav-links a {
        font-size: 1.2rem;
        padding: 1rem 0;
    }
}

/* Safari-specific fixes */
@supports (-webkit-touch-callout: none) {
    .hero {
        min-height: -webkit-fill-available;
    }
    
    .project-card {
        -webkit-tap-highlight-color: transparent;
    }
    
    .btn, 
    .nav-links a,
    .social-links a {
        -webkit-tap-highlight-color: transparent;
    }
}

/* Ensure project links are clickable on iOS */
.project-links .btn {
    position: relative;
    z-index: 10;
    cursor: pointer;
}

.project-card {
    position: relative;
    overflow: hidden;
}

.project-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

/* Chatbot Styles */
.chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

.chatbot-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00ff87 0%, #60efff 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease;
}

.chatbot-toggle:hover {
    transform: scale(1.1);
}

.chatbot-toggle i {
    font-size: 24px;
    color: #fff;
}

.chatbot-window {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 350px;
    height: 500px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    backdrop-filter: blur(10px);
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.3s ease;
}

.chatbot-window.active {
    display: flex;
    transform: translateY(0);
    opacity: 1;
}

.chatbot-header {
    padding: 15px 20px;
    background: linear-gradient(135deg, #00ff87 0%, #60efff 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chatbot-header h3 {
    margin: 0;
    font-size: 1.1em;
}

.chatbot-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1.2em;
    padding: 5px;
}

.chatbot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chatbot-message {
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 15px;
    margin: 5px 0;
    line-height: 1.4;
    font-weight: 500;
    color: #1a1a1a;
}

.chatbot-message.user {
    background: #e3f2fd;
    align-self: flex-end;
    border-bottom-right-radius: 5px;
    color: #1a1a1a;
}

.chatbot-message.bot {
    background: #f5f5f5;
    align-self: flex-start;
    border-bottom-left-radius: 5px;
    color: #1a1a1a;
}

.chatbot-input {
    padding: 15px;
    background: white;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
}

.chatbot-input input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 20px;
    outline: none;
    font-size: 0.9em;
}

.chatbot-input button {
    background: linear-gradient(135deg, #00ff87 0%, #60efff 100%);
    border: none;
    border-radius: 20px;
    padding: 10px 20px;
    color: white;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.chatbot-input button:hover {
    transform: scale(1.05);
}

/* Scrollbar Styles for Chatbot */
.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #555;
} 