/*
 * File: style.css
 * Versi: 2.4 - Penambahan Author di Chat & Revisi Urutan
 */

/* Variabel CSS */
:root {
    --bg-color: #f4f5f7;
    --text-color: #111827;
    --card-bg: #ffffff;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --accent-color: #4f46e5;
    --accent-color-rgb: 79, 70, 229;
    --accent-glow: rgba(79, 70, 229, 0.5);
    --secondary-text: #4b5563;
    --border-color: #e5e7eb;
    --preloader-bg: #111827;
    --danger-color: #ef4444;
}

.dark-mode {
    --bg-color: #111827;
    --text-color: #f9fafb;
    --card-bg: #1f2937;
    --shadow-color: rgba(0, 0, 0, 0.4);
    --accent-color: #818cf8;
    --accent-color-rgb: 129, 140, 248;
    --accent-glow: rgba(129, 140, 248, 0.5);
    --secondary-text: #9ca3af;
    --border-color: #374151;
}

/* Gaya Umum & Preloader */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0s 0.5s, opacity 0.5s linear;
}
body.loaded { visibility: visible; opacity: 1; transition-delay: 0s; }

#preloader {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: var(--preloader-bg);
    z-index: 9999; display: flex; align-items: center; justify-content: center;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}
#preloader.hidden { opacity: 0; visibility: hidden; }
.loader-spinner {
    width: 50px; height: 50px;
    border: 5px solid var(--border-color);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.container { width: 100%; max-width: 900px; margin: 0 auto; padding: 0 1rem; position: relative; z-index: 2; }

/* Tombol Ganti Tema */
.theme-switcher {
    position: fixed; top: 15px; right: 15px; background-color: var(--card-bg);
    color: var(--text-color); border: 1px solid var(--border-color);
    width: 45px; height: 45px; border-radius: 50%; display: flex;
    align-items: center; justify-content: center; cursor: pointer;
    box-shadow: 0 4px 8px var(--shadow-color); transition: all 0.3s ease; z-index: 1000;
}
.theme-switcher:hover { transform: translateY(-2px); }
.theme-switcher .fa-sun { display: none; }
.dark-mode .theme-switcher .fa-sun { display: block; }
.dark-mode .theme-switcher .fa-moon { display: none; }

/* Header & Efek Nama */
.header { text-align: center; padding: 80px 0 4rem 0; position: relative; }
.profile-photo {
    width: 150px; height: 150px; object-fit: cover; margin-bottom: 1.5rem;
    border-radius: 50%; border: 4px solid var(--accent-color);
    box-shadow: 0 5px 20px var(--shadow-color), 0 0 25px var(--accent-glow);
}
.header h1 { font-size: 1.8rem; font-weight: 700; margin-bottom: 0.5rem; }
.name-animated {
    background: linear-gradient(90deg, var(--accent-color), var(--text-color), var(--accent-color));
    background-size: 200% auto;
    color: #000;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: text-gradient-anim 5s linear infinite;
}
@keyframes text-gradient-anim { to { background-position: -200% center; } }
.header .subtitle { font-family: 'JetBrains Mono', monospace; font-size: 0.9rem; color: var(--secondary-text); margin-bottom: 1rem; }
.header .quote-container { display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.header .quote { font-size: 1rem; max-width: 90%; margin: 0 auto; font-style: italic; color: var(--accent-color); min-height: 40px; }

/* Efek Latar Belakang (Bintang & Ikon) */
.background-effects { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 0; }
#shooting-stars-canvas { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
.floating-icons-background { position: absolute; top: 0; left: 0; width: 100%; height: 100%; overflow: hidden; }
.floating-icon {
    position: absolute; color: var(--accent-color); opacity: 0.08;
    animation: float-anim 25s infinite ease-in-out;
}
.floating-icon:nth-child(1) { font-size: 3rem; top: 10%; left: 10%; animation-duration: 22s; }
.floating-icon:nth-child(2) { font-size: 4rem; top: 20%; right: 15%; animation-duration: 28s; animation-delay: 5s; }
.floating-icon:nth-child(3) { font-size: 2.5rem; bottom: 15%; left: 20%; animation-duration: 26s; animation-delay: 2s; }
.floating-icon:nth-child(4) { font-size: 3.5rem; top: 60%; right: 25%; animation-duration: 24s; animation-delay: 8s; }
.floating-icon:nth-child(5) { font-size: 2rem; top: 80%; left: 15%; animation-duration: 30s; animation-delay: 12s; }
.floating-icon:nth-child(6) { font-size: 3rem; top: 40%; left: 50%; animation-duration: 20s; animation-delay: 15s; }
@keyframes float-anim {
    0% { transform: translateY(0) rotate(0deg) scale(1); }
    50% { transform: translateY(-30px) rotate(180deg) scale(1.1); }
    100% { transform: translateY(0) rotate(360deg) scale(1); }
}

/* Gaya Section Umum */
.section { padding: 3rem 0; border-top: 1px solid var(--border-color); }
.section:first-of-type { border-top: none; }
.section-title { text-align: center; font-size: 1.8rem; font-weight: 700; margin-bottom: 2.5rem; position: relative; }
.section-title::after { content: ''; position: absolute; bottom: -10px; left: 50%; transform: translateX(-50%); width: 50px; height: 4px; background-color: var(--accent-color); border-radius: 2px; }

/* Desain Timeline Pendidikan dengan SVG */
.education-timeline {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
    padding: 1rem 0;
}
.timeline-svg {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 30px;
}
.timeline-path {
    stroke: var(--border-color);
}
.timeline-item {
    position: relative;
    margin-bottom: 2rem;
    padding-left: 40px;
}
.timeline-item:last-child { margin-bottom: 0; }
.timeline-dot {
    position: absolute;
    left: 3px;
    top: 5px;
    width: 24px;
    height: 24px;
    background-color: var(--accent-color);
    border-radius: 50%;
    border: 4px solid var(--bg-color);
}
.timeline-content h3 { font-size: 1.2rem; color: var(--text-color); font-weight: 600; margin-bottom: 0.1rem; }
.timeline-year { font-size: 0.9rem; color: var(--secondary-text); font-family: 'JetBrains Mono', monospace; }

/* Desain Skill Bars */
.skills-container { display: flex; flex-direction: column; gap: 1.5rem; max-width: 600px; margin: 0 auto; }
.skill-item { position: relative; }
.skill-info { display: flex; justify-content: space-between; margin-bottom: 0.5rem; font-weight: 600; }
.skill-bar-container { width: 100%; height: 12px; background-color: var(--border-color); border-radius: 6px; overflow: hidden; }
.skill-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent-color) 0%, var(--accent-glow) 100%); border-radius: 6px; }

/* Desain Pengalaman */
.experience-container { display: grid; gap: 1.5rem; max-width: 600px; margin: 0 auto; }
.experience-card { background-color: var(--card-bg); padding: 1.5rem; border-left: 5px solid var(--accent-color); border-radius: 8px; box-shadow: 0 4px 15px var(--shadow-color); }
.experience-title { font-size: 1.2rem; font-weight: 600; }
.experience-provider { font-weight: 500; color: var(--accent-color); margin-bottom: 0.25rem; }
.experience-date { font-size: 0.9rem; color: var(--secondary-text); margin-bottom: 0.75rem; font-family: 'JetBrains Mono', monospace; }
.experience-desc { font-size: 0.95rem; color: var(--secondary-text); }

/* Bagian Hasil Project & Tombol Link */
.portfolio-grid { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
.portfolio-card { background-color: var(--card-bg); border-radius: 12px; box-shadow: 0 4px 15px var(--shadow-color); width: 100%; max-width: 400px; transition: transform 0.3s ease, box-shadow 0.3s ease; text-align: left; margin: 0 auto; display: flex; flex-direction: column; overflow: hidden; }
.portfolio-card:hover { transform: translateY(-5px); }
.project-image { width: 100%; height: 200px; object-fit: cover; }
.card-content { padding: 1.5rem; display: flex; flex-direction: column; flex-grow: 1; }
.card-content h3 { font-size: 1.2rem; margin-bottom: 0.5rem; }
.card-content p { font-size: 0.9rem; flex-grow: 1; margin-bottom: 1.5rem; }
.project-links { display: flex; gap: 1rem; justify-content: flex-start; }
.project-link { text-decoration: none; color: var(--accent-color); background-color: transparent; border: 1px solid var(--accent-color); padding: 0.5rem 1rem; border-radius: 8px; font-size: 0.9rem; font-weight: 600; display: inline-flex; align-items: center; gap: 0.5rem; transition: all 0.2s ease; }
.project-link:hover { background-color: var(--accent-color); color: white; }
.project-link.disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

/* Gaya Fitur AI */
.ai-button { background-color: var(--accent-color); color: white; border: none; padding: 0.6rem 1rem; border-radius: 8px; font-family: 'Inter', sans-serif; font-weight: 600; cursor: pointer; transition: all 0.3s ease; align-self: center; }
.ai-button:disabled { cursor: not-allowed; opacity: 0.5; }
.spinner { display: inline-block; width: 1em; height: 1em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spinner-border .75s linear infinite; vertical-align: text-bottom; margin-left: 5px; }
@keyframes spinner-border { to { transform: rotate(360deg); } }

/* Gaya Chat Pop-up AI */
#chat-fab { position: fixed; bottom: 25px; right: 25px; width: 60px; height: 60px; background-color: var(--accent-color); color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.8rem; cursor: pointer; box-shadow: 0 5px 15px var(--shadow-color); transition: transform 0.3s ease; z-index: 1001; }
#chat-fab:hover { transform: scale(1.1); }
#chat-popup { position: fixed; bottom: 100px; right: 25px; width: 90%; max-width: 400px; height: 70%; max-height: 600px; background-color: var(--card-bg); border-radius: 15px; box-shadow: 0 10px 30px var(--shadow-color); display: flex; flex-direction: column; z-index: 1000; opacity: 0; visibility: hidden; transform-origin: bottom right; transform: scale(0.5); transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s ease; }
#chat-popup.visible { opacity: 1; visibility: visible; transform: scale(1); }
.chat-header {
    padding: 1rem; border-bottom: 1px solid var(--border-color);
    display: flex; justify-content: space-between; align-items: center;
}
.chat-title-container h3 { font-size: 1.1rem; margin: 0; line-height: 1.2; }
.chat-author {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--secondary-text);
    opacity: 0.8;
    margin: 0;
    line-height: 1;
}
.chat-header #close-chat { font-size: 1.2rem; cursor: pointer; color: var(--secondary-text); }
.chat-messages { flex-grow: 1; padding: 1rem; overflow-y: auto; display: flex; flex-direction: column; gap: 0.75rem; }
.chat-message { max-width: 80%; padding: 0.6rem 1rem; border-radius: 18px; line-height: 1.5; word-wrap: break-word; }
.user-message { align-self: flex-end; background-color: var(--accent-color); color: white; border-bottom-right-radius: 4px; }
.ai-message { align-self: flex-start; background-color: var(--border-color); color: var(--text-color); border-bottom-left-radius: 4px; }
.ai-message.error { background-color: var(--danger-color); color: white; }
.typing-indicator { align-self: flex-start; color: var(--secondary-text); }
.typing-indicator span { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background-color: var(--secondary-text); margin: 0 2px; animation: typing-anim 1.2s infinite ease-in-out; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing-anim { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } }
.chat-suggestions { padding: 0.5rem 1rem; display: flex; flex-wrap: wrap; gap: 0.5rem; border-top: 1px solid var(--border-color); }
.suggestion-chip { background-color: transparent; border: 1px solid var(--accent-color); color: var(--accent-color); padding: 0.3rem 0.8rem; border-radius: 20px; font-size: 0.8rem; cursor: pointer; transition: all 0.2s ease; }
.suggestion-chip:hover { background-color: var(--accent-color); color: white; }
.chat-form { display: flex; padding: 1rem; border-top: 1px solid var(--border-color); }
#chat-input { flex-grow: 1; border: 1px solid var(--border-color); background-color: var(--bg-color); color: var(--text-color); padding: 0.75rem; border-radius: 20px 0 0 20px; outline: none; transition: border-color 0.2s; }
#chat-input:focus { border-color: var(--accent-color); }
#send-btn { border: none; background-color: var(--accent-color); color: white; padding: 0.75rem 1.2rem; border-radius: 0 20px 20px 0; cursor: pointer; font-size: 1.1rem; }
.chat-tooltip {
    position: fixed;
    bottom: 95px; /* Di atas tombol chat */
    right: 25px;
    background-color: var(--accent-color);
    color: white;
    padding: 0.75rem 1.25rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    box-shadow: 0 5px 15px var(--shadow-color);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px) scale(0.95);
    transition: all 0.3s ease;
    z-index: 1001;
    animation: pulse-anim 2.5s infinite;
}
@keyframes pulse-anim {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}
.chat-tooltip.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}
.close-tooltip-btn {
    position: absolute;
    top: 2px;
    right: 5px;
    background: none;
    border: none;
    color: white;
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0 5px;
    line-height: 1;
    opacity: 0.7;
}
.close-tooltip-btn:hover { opacity: 1; }
.ai-message pre {
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 0.5rem;
    overflow-x: auto;
    position: relative;
    white-space: pre-wrap;
    word-wrap: break-word;
}
.ai-message code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    color: var(--text-color);
}
.copy-code-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background-color: var(--border-color);
    color: var(--secondary-text);
    border: none;
    padding: 0.25rem 0.5rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.8rem;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}
.copy-code-btn:hover { opacity: 1; }

/* Footer */
footer { text-align: center; padding: 2rem 1rem; margin-top: 2rem; }
.social-icons { display: flex; justify-content: center; gap: 1.5rem; margin-bottom: 1rem; }
.social-icons a { color: var(--secondary-text); font-size: 1.5rem; transition: color 0.3s ease, transform 0.3s ease; }
.social-icons a:hover { color: var(--accent-color); transform: translateY(-3px); }
footer p { font-family: 'JetBrains Mono', monospace; font-size: 0.8rem; color: var(--secondary-text); }

/* Media Queries untuk Desktop */
@media (min-width: 768px) {
    .header h1 { font-size: 2.5rem; }
    .header .subtitle { font-size: 1.1rem; }
    .portfolio-grid { grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); }
}