/* ============================================================
   PORTFOLIO — Monireach Tang
   Theme: Dark, purple-blue glassmorphism (matches chatbot)
   ============================================================ */

:root {
    --bg: #07070f;
    --surface: rgba(255, 255, 255, 0.04);
    --surface-hover: rgba(255, 255, 255, 0.07);
    --border: rgba(255, 255, 255, 0.1);
    --accent: #7c6ff7;
    --accent-2: #5eadf7;
    --text: #e8e8f0;
    --text-muted: #8888a8;
    --gradient: linear-gradient(135deg, #7c6ff7, #5eadf7);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
}

/* ============================================================
   NAV
   ============================================================ */
nav {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 100;
    background: rgba(7, 7, 15, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 0 2rem;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand {
    font-weight: 700;
    font-size: 1.1rem;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.nav-links a:hover { color: var(--text); }

.nav-hamburger {
    display: none;
    background: none;
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    line-height: 1;
    transition: background 0.2s;
}

.nav-hamburger:hover { background: var(--surface-hover); }

@media (max-width: 768px) {
    .nav-hamburger { display: block; }

    .nav-links {
        display: none;
        position: absolute;
        top: 60px;
        left: 0;
        width: 100%;
        flex-direction: column;
        gap: 0;
        background: rgba(7, 7, 15, 0.97);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border-bottom: 1px solid var(--border);
        padding: 0.5rem 0;
    }

    .nav-links.open { display: flex; }

    .nav-links li { width: 100%; }

    .nav-links a {
        display: block;
        padding: 0.75rem 2rem;
        font-size: 1rem;
    }
}

/* ============================================================
   SECTIONS
   ============================================================ */
section {
    padding: 100px 2rem 60px;
    max-width: 960px;
    margin: 0 auto;
}

section:first-of-type { padding-top: 140px; }

.section-label {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 0.5rem;
}

h2.section-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 2.5rem;
    color: var(--text);
}

/* ============================================================
   HERO
   ============================================================ */
#hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-top: 80px;
}

.hero-inner {
    display: flex;
    align-items: center;
    gap: 4rem;
}

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

.hero-photo-wrap {
    flex-shrink: 0;
}

.hero-photo {
    width: 260px;
    height: 260px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(124, 111, 247, 0.4);
    box-shadow: 0 0 40px rgba(124, 111, 247, 0.2);
}

.hero-tag {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
    border: 1px solid rgba(124, 111, 247, 0.35);
    background: rgba(124, 111, 247, 0.08);
    padding: 0.3rem 0.8rem;
    border-radius: 100px;
    margin-bottom: 1.5rem;
}

.hero-name {
    font-size: clamp(2.4rem, 6vw, 4.2rem);
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 1rem;
}

.hero-name span {
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.15rem;
    color: var(--text-muted);
    max-width: 560px;
    margin-bottom: 1rem;
    line-height: 1.7;
}

.hero-langs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.lang-badge {
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.2rem 0.65rem;
    border-radius: 100px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
}

.hero-cta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1.5rem;
    border-radius: 8px;
    background: var(--gradient);
    color: #fff;
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    transition: opacity 0.2s, transform 0.2s;
}

.btn-primary:hover { opacity: 0.88; transform: translateY(-1px); }

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    transition: background 0.2s, transform 0.2s;
}

.btn-secondary:hover { background: var(--surface-hover); transform: translateY(-1px); }

/* ============================================================
   ABOUT
   ============================================================ */
.about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 640px) { .about-grid { grid-template-columns: 1fr; } }

.about-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    backdrop-filter: blur(8px);
}

.about-card h3 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.75rem;
}

.about-card p {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.65;
}

.about-card.wide {
    grid-column: span 2;
}

@media (max-width: 640px) { .about-card.wide { grid-column: span 1; } }

/* ============================================================
   PROJECTS
   ============================================================ */
.project-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 1.5rem;
    transition: background 0.2s, border-color 0.2s;
}

.project-card:hover {
    background: var(--surface-hover);
    border-color: rgba(124, 111, 247, 0.3);
}

.project-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.project-title {
    font-size: 1.2rem;
    font-weight: 700;
}

.project-links {
    display: flex;
    gap: 0.6rem;
}

.project-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
    border: 1px solid rgba(124, 111, 247, 0.3);
    padding: 0.25rem 0.65rem;
    border-radius: 6px;
    transition: background 0.2s;
}

.project-link:hover { background: rgba(124, 111, 247, 0.12); }

.project-desc {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
    line-height: 1.65;
}

.tech-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
    color: var(--text-muted);
}

/* ============================================================
   SKILLS
   ============================================================ */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.skill-group {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
}

.skill-group h3 {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.75rem;
}

.skill-group ul {
    list-style: none;
}

.skill-group li {
    font-size: 0.9rem;
    color: var(--text-muted);
    padding: 0.2rem 0;
}

.skill-group li::before {
    content: '→ ';
    color: var(--accent-2);
    font-size: 0.75rem;
}

/* ============================================================
   SERVICES
   ============================================================ */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.service-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    transition: background 0.2s, border-color 0.2s;
}

.service-card:hover {
    background: var(--surface-hover);
    border-color: rgba(124, 111, 247, 0.3);
}

.service-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.service-card h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.6rem;
}

.service-card p {
    font-size: 0.92rem;
    color: var(--text-muted);
    line-height: 1.65;
}

.services-cta {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.services-cta p {
    color: var(--text-muted);
    font-size: 1rem;
}

/* ============================================================
   CONTACT
   ============================================================ */
.contact-intro {
    font-size: 1rem;
    color: var(--text-muted);
    line-height: 1.65;
    margin-bottom: 2rem;
    max-width: 560px;
}

.contact-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.contact-card {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    text-decoration: none;
    color: var(--text);
    transition: background 0.2s, border-color 0.2s, transform 0.2s;
}

.contact-card:hover {
    background: var(--surface-hover);
    border-color: rgba(124, 111, 247, 0.35);
    transform: translateY(-2px);
}

.contact-card .icon { font-size: 1.3rem; }

.contact-card .label {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: block;
}

.contact-card .value {
    font-size: 0.95rem;
    font-weight: 600;
}

/* ============================================================
   FOOTER
   ============================================================ */
footer {
    border-top: 1px solid var(--border);
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    max-width: 960px;
    margin: 0 auto;
}

/* ============================================================
   CHATBOT WIDGET
   ============================================================ */
.chat-widget-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    background: rgba(124, 111, 247, 0.3);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(124, 111, 247, 0.5);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    box-shadow: 0 4px 24px rgba(124, 111, 247, 0.3), inset 0 1px 0 rgba(255,255,255,0.2);
    transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
    z-index: 9999;
    user-select: none;
}

.chat-widget-btn:hover {
    transform: scale(1.08);
    background: rgba(124, 111, 247, 0.45);
    box-shadow: 0 6px 32px rgba(124, 111, 247, 0.45), inset 0 1px 0 rgba(255,255,255,0.3);
}

.chat-widget-btn.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.8);
}

.chat-panel {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 370px;
    height: 520px;
    background: rgba(20, 18, 40, 0.85);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(124, 111, 247, 0.3);
    border-radius: 18px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255,255,255,0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9998;
    opacity: 0;
    pointer-events: none;
    transform: scale(0.88) translateY(16px);
    transform-origin: bottom right;
    transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chat-panel.open {
    opacity: 1;
    pointer-events: all;
    transform: scale(1) translateY(0);
}

.chat-header {
    background: rgba(124, 111, 247, 0.35);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(124, 111, 247, 0.25);
    color: white;
    padding: 16px 20px;
    border-radius: 18px 18px 0 0;
    position: relative;
    flex-shrink: 0;
}

.chat-header h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.chat-header p {
    opacity: 0.7;
    font-size: 0.75rem;
}

.chat-close-btn {
    position: absolute;
    top: 12px;
    right: 14px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 14px;
    cursor: pointer;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.chat-close-btn:hover { background: rgba(255, 255, 255, 0.22); }

.chat-messages {
    flex: 1;
    padding: 14px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-messages::before { content: ''; flex: 1; }

.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: rgba(124, 111, 247, 0.4); border-radius: 2px; }

.chat-message {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    max-width: 88%;
    animation: slideIn 0.22s ease-out;
}

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

.chat-message.user { align-self: flex-end; flex-direction: row-reverse; }
.chat-message.bot  { align-self: flex-start; }

.chat-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.chat-message.user .chat-avatar { background: rgba(124, 111, 247, 0.5); }
.chat-message.bot  .chat-avatar { background: rgba(255, 255, 255, 0.08); }

.chat-bubble {
    padding: 9px 13px;
    border-radius: 14px;
    font-size: 13.5px;
    line-height: 1.5;
}

.chat-message.user .chat-bubble {
    background: rgba(124, 111, 247, 0.75);
    border: 1px solid rgba(124, 111, 247, 0.4);
    color: white;
}

.chat-message.bot .chat-bubble {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text);
}

.chat-bubble p { margin-bottom: 4px; }
.chat-bubble p:last-child { margin-bottom: 0; }
.chat-bubble ul, .chat-bubble ol { padding-left: 18px; }

.typing-indicator {
    display: none;
    align-items: center;
    gap: 5px;
    padding: 5px 14px;
    color: var(--text-muted);
    font-size: 12px;
    font-style: italic;
    flex-shrink: 0;
}

.typing-indicator.active { display: flex; }

.typing-dots { display: flex; gap: 3px; }

.typing-dots span {
    width: 5px;
    height: 5px;
    background: rgba(124, 111, 247, 0.7);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite;
}

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

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30%           { transform: translateY(-6px); opacity: 1; }
}

.chat-input-row {
    display: flex;
    padding: 10px 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    gap: 8px;
    align-items: flex-end;
    flex-shrink: 0;
}

.chat-input-row textarea {
    flex: 1;
    padding: 9px 13px;
    height: 38px;
    max-height: 110px;
    border: 1px solid rgba(124, 111, 247, 0.35);
    border-radius: 18px;
    font-size: 13.5px;
    font-family: inherit;
    outline: none;
    resize: none;
    overflow-y: auto;
    scrollbar-width: none;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    line-height: 1.4;
    transition: border-color 0.2s, background 0.2s;
}

.chat-input-row textarea::-webkit-scrollbar { display: none; }
.chat-input-row textarea:focus { border-color: rgba(124, 111, 247, 0.7); background: rgba(255,255,255,0.09); }
.chat-input-row textarea::placeholder { color: var(--text-muted); }

.chat-send-btn {
    width: 38px;
    height: 38px;
    background: var(--gradient);
    border: none;
    color: white;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
    transition: opacity 0.2s, transform 0.1s;
}

.chat-send-btn:hover { opacity: 0.88; transform: scale(1.06); }
.chat-send-btn:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }

@media (max-width: 480px) {
    .chat-panel {
        width: calc(100vw - 20px);
        height: 75vh;
        right: 10px;
        bottom: 16px;
    }
    .chat-widget-btn { bottom: 16px; right: 16px; width: 54px; height: 54px; font-size: 22px; }
    .chat-header p { display: none; }
}

@media (max-width: 768px) {
    .hero-inner {
        flex-direction: column;
        text-align: center;
    }
    .hero-photo {
        width: 160px;
        height: 160px;
    }
    .hero-photo-wrap {
        order: -1;
    }
    .hero-cta,
    .hero-langs {
        justify-content: center;
    }
    .hero-subtitle {
        max-width: 100%;
    }
}
