/* =========================================
   BASE RESET & VARIABLES
   ========================================= */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #050510;
    --bg-secondary: #0a0a1a;
    --bg-card: #0d0d20;
    --cyan: #00e5ff;
    --magenta: #ff007f;
    --green: #4ade80;
    --purple: #e879f9;
    --orange: #fb923c;
    --text-primary: #e2e8f0;
    --text-secondary: #a0aec0;
    --border: rgba(0, 229, 255, 0.15);
    --gradient-border: linear-gradient(135deg, #ff007f, #7f00ff, #00ffff);
    --nav-height: 64px;
    --transition: 0.3s ease;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    background-color: var(--bg-primary);
    background-image:
        radial-gradient(circle at 15% 30%, rgba(76, 29, 149, 0.12) 0%, transparent 50%),
        radial-gradient(circle at 85% 70%, rgba(0, 229, 255, 0.08) 0%, transparent 50%);
    color: var(--text-primary);
    font-family: 'Fira Code', monospace;
    line-height: 1.6;
    overflow-x: hidden;
}

/* =========================================
   UTILITY CLASSES
   ========================================= */
.text-cyan    { color: var(--cyan); }
.text-magenta { color: var(--magenta); }
.text-green   { color: var(--green); }
.text-purple  { color: var(--purple); }
.text-orange  { color: var(--orange); }
.text-glow    { text-shadow: 0 0 8px rgba(0, 229, 255, 0.5); }

/* =========================================
   ANIMATIONS
   ========================================= */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

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

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

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

@keyframes glowPulse {
    0%, 100% { box-shadow: 0 0 10px rgba(0, 229, 255, 0.3); }
    50%       { box-shadow: 0 0 25px rgba(0, 229, 255, 0.7); }
}

@keyframes slideInChatbot {
    from { transform: translateY(80px) scale(0.92); opacity: 0; }
    to   { transform: translateY(0) scale(1); opacity: 1; }
}

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

@keyframes typingPulse {
    0%, 60%, 100% { opacity: 0.3; }
    30%            { opacity: 1; }
}

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

/* Scroll-driven animation classes */
.fade-in {
    opacity: 0;
    animation: fadeIn 0.8s ease forwards;
}

.fade-in-delay {
    opacity: 0;
    animation: fadeIn 0.8s ease 0.3s forwards;
}

.slide-in {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.slide-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* =========================================
   NAVIGATION
   ========================================= */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    z-index: 1000;
    background: rgba(5, 5, 16, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    transition: background var(--transition), box-shadow var(--transition);
}

.navbar.scrolled {
    background: rgba(5, 5, 16, 0.97);
    box-shadow: 0 2px 20px rgba(0, 229, 255, 0.1);
}

.nav-container {
    max-width: 1100px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}

.nav-logo {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    letter-spacing: 1px;
    transition: color var(--transition);
}

.nav-logo:hover { color: var(--cyan); }

.nav-links {
    list-style: none;
    display: flex;
    gap: 32px;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
    position: relative;
    transition: color var(--transition);
}

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

.nav-link:hover,
.nav-link.active {
    color: var(--cyan);
}

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

/* Hamburger */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    z-index: 1100;
}

.hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--cyan);
    border-radius: 2px;
    transition: transform var(--transition), opacity var(--transition), background var(--transition);
}

.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* =========================================
   SECTION SHARED STYLES
   ========================================= */
.section {
    padding: 100px 24px 80px;
}

.section-container {
    max-width: 1100px;
    margin: 0 auto;
}

.section-title {
    font-size: clamp(1.6rem, 4vw, 2.2rem);
    color: var(--purple);
    margin-bottom: 48px;
    letter-spacing: 2px;
}

/* =========================================
   HERO SECTION
   ========================================= */
.hero-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 60px;
    padding: calc(var(--nav-height) + 60px) 24px 80px;
    max-width: 1100px;
    margin: 0 auto;
}

.hero-content {
    flex: 1;
    min-width: 0;
}

.hero-greeting {
    font-size: 1rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.hero-name {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 16px;
    background: linear-gradient(135deg, var(--cyan), var(--purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-role {
    font-size: clamp(1rem, 2.5vw, 1.25rem);
    margin-bottom: 20px;
    min-height: 2em;
}

.cursor-blink {
    animation: cursorBlink 1s step-end infinite;
    color: var(--cyan);
}

.hero-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
    max-width: 480px;
    margin-bottom: 32px;
    line-height: 1.8;
}

.hero-actions {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 28px;
    border-radius: 4px;
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition);
    letter-spacing: 1px;
    display: inline-block;
}

.btn-primary {
    background: linear-gradient(135deg, var(--magenta), #7f00ff);
    color: #fff;
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #ff4da6, #9b30ff);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 0, 127, 0.4);
}

.btn-secondary {
    background: transparent;
    color: var(--cyan);
    border: 1px solid var(--cyan);
}

.btn-secondary:hover {
    background: rgba(0, 229, 255, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 229, 255, 0.2);
}

/* Hero Avatar */
.hero-visual {
    flex-shrink: 0;
}

.avatar-wrapper {
    position: relative;
    width: 220px;
    height: 220px;
}

.avatar-wrapper::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: var(--gradient-border);
    z-index: 0;
    animation: glowPulse 3s ease-in-out infinite;
}

.hero-avatar {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--bg-primary);
}

/* =========================================
   ABOUT SECTION
   ========================================= */
.about-section-full {
    background: rgba(13, 13, 32, 0.5);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.about-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 48px;
    align-items: start;
}

.about-lead {
    font-size: 1.05rem;
    margin-bottom: 20px;
    line-height: 1.8;
}

.about-card p {
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.8;
}

.about-card p strong { color: var(--text-primary); }

.about-stats {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.stat-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: border-color var(--transition), transform var(--transition);
}

.stat-item:hover {
    border-color: var(--cyan);
    transform: translateX(6px);
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* =========================================
   PROJECTS SECTION
   ========================================= */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

.project-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 28px;
    transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
    cursor: default;
}

.project-card:hover {
    border-color: var(--cyan);
    transform: translateY(-6px);
    box-shadow: 0 12px 30px rgba(0, 229, 255, 0.12);
}

.project-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.project-icon { font-size: 1.5rem; }

.project-tag {
    font-size: 0.75rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    opacity: 0.8;
}

.project-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.project-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 20px;
}

.project-tech {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tech-tag {
    font-size: 0.75rem;
    padding: 3px 10px;
    border-radius: 20px;
    background: rgba(0, 229, 255, 0.08);
    border: 1px solid rgba(0, 229, 255, 0.25);
    color: var(--cyan);
}

/* =========================================
   SKILLS SECTION
   ========================================= */
.skills-section {
    background: rgba(13, 13, 32, 0.5);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 24px;
}

.skill-group {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 24px;
    transition: border-color var(--transition), transform var(--transition);
}

.skill-group:hover {
    border-color: rgba(0, 229, 255, 0.4);
    transform: translateY(-4px);
}

.skill-group-title {
    font-size: 0.85rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 16px;
}

.skill-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.skill-tag {
    font-size: 0.8rem;
    padding: 4px 12px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    transition: all var(--transition);
}

.skill-tag:hover {
    background: rgba(0, 229, 255, 0.1);
    border-color: var(--cyan);
    color: var(--cyan);
}

/* =========================================
   CONTACT SECTION
   ========================================= */
.contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px 24px;
    transition: border-color var(--transition), transform var(--transition);
}

.contact-item:hover {
    border-color: var(--cyan);
    transform: translateY(-4px);
}

.contact-icon {
    font-size: 1.6rem;
    flex-shrink: 0;
}

.contact-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.contact-value {
    font-size: 0.9rem;
    color: var(--cyan);
    text-decoration: none;
    transition: text-shadow var(--transition);
}

.contact-value:hover {
    text-shadow: 0 0 8px rgba(0, 229, 255, 0.6);
}

.contact-cta {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.inline-chat-btn {
    background: none;
    border: none;
    color: var(--cyan);
    font-family: 'Fira Code', monospace;
    font-size: 0.95rem;
    cursor: pointer;
    text-decoration: underline;
    transition: text-shadow var(--transition);
    padding: 0;
}

.inline-chat-btn:hover {
    text-shadow: 0 0 8px rgba(0, 229, 255, 0.6);
}

/* =========================================
   FOOTER
   ========================================= */
.footer {
    text-align: center;
    padding: 32px 24px;
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* =========================================
   FLOATING CHAT BUTTON
   ========================================= */
.chat-fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 800;
    background: linear-gradient(135deg, var(--magenta), #7f00ff);
    border: none;
    border-radius: 50px;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: 0 4px 20px rgba(255, 0, 127, 0.4);
    animation: fabPulse 3s ease-in-out infinite;
}

.chat-fab:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(255, 0, 127, 0.55);
    animation: none;
}

.chat-fab-icon { font-size: 1.1rem; }
.chat-fab-label { letter-spacing: 0.5px; }

/* =========================================
   CHATBOT MODAL
   ========================================= */
.chatbot-modal {
    position: fixed;
    bottom: 96px;
    right: 30px;
    width: 420px;
    height: 560px;
    background: linear-gradient(135deg, #0a0a16, #150a2a);
    border: 2px solid var(--cyan);
    border-radius: 10px;
    box-shadow: 0 0 30px rgba(0, 229, 255, 0.35), inset 0 0 20px rgba(0, 229, 255, 0.05);
    display: flex;
    flex-direction: column;
    z-index: 900;
    font-family: 'Fira Code', monospace;
    transition: opacity var(--transition), transform var(--transition);
}

.chatbot-modal.hidden {
    display: none !important;
}

.chatbot-modal.active {
    animation: slideInChatbot 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.chatbot-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    border-radius: 8px;
    overflow: hidden;
}

.chatbot-header {
    padding: 14px 18px;
    border-bottom: 2px solid var(--magenta);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 0, 127, 0.06);
    flex-shrink: 0;
}

.chatbot-header .text-cyan {
    color: var(--cyan);
    text-shadow: 0 0 8px rgba(0, 229, 255, 0.5);
    font-weight: 700;
    font-size: 0.95rem;
}

.close-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 26px;
    color: var(--magenta);
    transition: all 0.2s;
    line-height: 1;
    padding: 0 4px;
}

.close-btn:hover {
    color: #ff69b4;
    text-shadow: 0 0 10px rgba(255, 0, 127, 0.8);
}

.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scrollbar-width: thin;
    scrollbar-color: var(--magenta) #0a0a16;
}

.chatbot-messages::-webkit-scrollbar { width: 5px; }
.chatbot-messages::-webkit-scrollbar-track { background: #0a0a16; }
.chatbot-messages::-webkit-scrollbar-thumb { background: var(--magenta); border-radius: 3px; }

.chatbot-message {
    padding: 10px 12px;
    border-radius: 4px;
    word-wrap: break-word;
    line-height: 1.55;
    font-size: 0.85rem;
    animation: slideInMessage 0.3s ease-out;
    white-space: pre-wrap;
}

.bot-message {
    color: var(--green);
    background: rgba(74, 222, 128, 0.05);
    border-left: 3px solid var(--green);
}

.user-message {
    color: var(--cyan);
    background: rgba(0, 229, 255, 0.05);
    border-left: 3px solid var(--cyan);
    margin-left: auto;
    max-width: 88%;
}

.loading-message {
    color: #facc15;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    font-size: 0.85rem;
}

.typing-indicator {
    display: flex;
    gap: 4px;
    align-items: center;
}

.typing-indicator span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #facc15;
    animation: typingPulse 1.4s infinite;
}

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

.chatbot-input-area {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 2px solid var(--magenta);
    background: rgba(255, 0, 127, 0.04);
    flex-shrink: 0;
}

.chatbot-input {
    flex: 1;
    background: rgba(0, 229, 255, 0.05);
    border: 1px solid var(--cyan);
    color: var(--cyan);
    padding: 10px 12px;
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    border-radius: 4px;
    outline: none;
    transition: all 0.2s;
    caret-color: var(--cyan);
}

.chatbot-input:focus {
    border-color: var(--magenta);
    box-shadow: 0 0 10px rgba(255, 0, 127, 0.3);
    background: rgba(255, 0, 127, 0.04);
}

.chatbot-input::placeholder { color: rgba(0, 229, 255, 0.4); }

.send-btn {
    padding: 10px 18px;
    background: linear-gradient(135deg, var(--magenta), #7f00ff);
    border: 1px solid var(--magenta);
    color: #fff;
    font-family: 'Fira Code', monospace;
    font-weight: 700;
    font-size: 0.8rem;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    white-space: nowrap;
    letter-spacing: 0.5px;
}

.send-btn:hover {
    background: linear-gradient(135deg, #ff4da6, #9b30ff);
    box-shadow: 0 0 15px rgba(255, 0, 127, 0.5);
    transform: translateY(-1px);
}

.send-btn:active { transform: translateY(0); }

.send-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

/* =========================================
   RESPONSIVE — TABLET (≤ 900px)
   ========================================= */
@media (max-width: 900px) {
    .hero-section {
        flex-direction: column-reverse;
        text-align: center;
        gap: 40px;
        padding-top: calc(var(--nav-height) + 40px);
    }

    .hero-content { align-items: center; }

    .hero-description { margin: 0 auto 32px; }

    .hero-actions { justify-content: center; }

    .about-grid { grid-template-columns: 1fr; gap: 32px; }

    .about-stats { flex-direction: row; flex-wrap: wrap; }

    .stat-item { flex: 1 1 140px; }

    .avatar-wrapper { width: 180px; height: 180px; }
}

/* =========================================
   RESPONSIVE — MOBILE (≤ 640px)
   ========================================= */
@media (max-width: 640px) {
    :root { --nav-height: 56px; }

    .section { padding: 80px 16px 60px; }

    /* Mobile nav */
    .hamburger { display: flex; }

    .nav-links {
        position: fixed;
        top: var(--nav-height);
        left: 0;
        right: 0;
        background: rgba(5, 5, 16, 0.98);
        border-bottom: 1px solid var(--border);
        flex-direction: column;
        gap: 0;
        padding: 8px 0;
        transform: translateY(-110%);
        transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .nav-links.open { transform: translateY(0); }

    .nav-links li { padding: 0; }

    .nav-link {
        display: block;
        padding: 14px 24px;
        font-size: 1rem;
    }

    .nav-link::after { display: none; }

    /* Hero */
    .hero-name { font-size: 1.9rem; }

    .avatar-wrapper { width: 140px; height: 140px; }

    /* Chatbot */
    .chatbot-modal {
        width: calc(100vw - 20px);
        height: 70vh;
        bottom: 80px;
        right: 10px;
        left: 10px;
    }

    .chat-fab { right: 16px; bottom: 16px; padding: 12px 16px; }

    .chat-fab-label { display: none; }

    .chat-fab { border-radius: 50%; padding: 14px; }

    .user-message { max-width: 100%; }

    /* Projects stack */
    .projects-grid { grid-template-columns: 1fr; }

    /* Skills stack */
    .skills-grid { grid-template-columns: 1fr 1fr; }

    /* Contact stack */
    .contact-grid { grid-template-columns: 1fr; }
}

/* =========================================
   RESPONSIVE — SMALL MOBILE (≤ 380px)
   ========================================= */
@media (max-width: 380px) {
    .skills-grid { grid-template-columns: 1fr; }
    .about-stats { flex-direction: column; }
}