:root {
    --primary: #0f172a;
    --primary-light: #1e293b;
    --accent: #38bdf8;
    --accent-glow: rgba(56, 189, 248, 0.4);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --bg-base: #020617;
    --glass-bg: rgba(15, 23, 42, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);
    --send-btn: #38bdf8;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

body {
    background-color: var(--bg-base);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    background-image: linear-gradient(rgba(2, 6, 23, 0.5), rgba(2, 6, 23, 0.8)),
    url("../background/Pantai-Sulamadaha.jpg");
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
}

/* Navbar */
nav {
    padding: 1.5rem 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(2, 6, 23, 0.7);
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #fff 0%, #7dd3fc 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
}

.btn {
    padding: 0.6rem 1.5rem;
    border-radius: 50px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn-ghost, .btn-primary {
    color: var(--text-main) !important;
    background: transparent;
    border: 1px solid var(--text-main); 
}

.btn-ghost:hover, .btn-primary:hover {
    color: var(--bg-base) !important; 
    background: var(--text-main);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.2);
}

/* Main Content */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 4rem 1rem 2rem 1rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.hero {
    text-align: center;
    max-width: 800px;
    margin-bottom: 3rem;
    animation: fadeInDown 1s ease-out;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.badge {
    display: inline-block;
    padding: 0.4rem 1rem;
    background: rgba(56, 189, 248, 0.1);
    color: var(--accent);
    border: 1px solid rgba(56, 189, 248, 0.2);
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    box-shadow: 0 0 20px var(--accent-glow);
}

h1 {
    font-size: clamp(2.5rem, 5vw, 4rem);
    line-height: 1.1;
    font-weight: 800;
    margin-bottom: 1.5rem;
    letter-spacing: -0.05em;
}

.text-gradient {
    background: linear-gradient(to right, #fff, #7dd3fc, #38bdf8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

p.subtitle {
    font-size: clamp(1rem, 2vw, 1.2rem);
    color: var(--text-muted);
    margin-bottom: 2rem;
    line-height: 1.6;
}

/* Chat Interface */
.chat-container {
    width: 100%;
    max-width: 800px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    height: 600px;
    overflow: hidden;
    animation: fadeInUp 1s ease-out 0.2s both;
    position: relative;
}

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

.chat-header {
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-identity {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.ai-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent), #0ea5e9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 0 15px var(--accent-glow);
}

.ai-info h3 {
    font-size: 1rem;
    font-weight: 600;
}

.ai-info p {
    font-size: 0.8rem;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.ai-info p::before {
    content: '';
    display: block;
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 5px var(--accent);
}

.login-prompt {
    font-size: 0.85rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.login-prompt a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.login-prompt a:hover {
    text-decoration: underline;
}

.chat-messages {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    scroll-behavior: smooth;
}

/* Scrollbar styling */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.message {
    display: flex;
    gap: 1rem;
    max-width: 85%;
    animation: slideIn 0.3s ease-out forwards;
}

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

.message.bot {
    align-self: flex-start;
}

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

.msg-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.9rem;
}

.bot .msg-avatar {
    background: linear-gradient(135deg, var(--accent), #0ea5e9);
}

.user .msg-avatar {
    background: var(--text-main);
    color: var(--bg-base);
}

.msg-bubble {
    padding: 1rem 1.2rem;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.5;
    position: relative;
}

.bot .msg-bubble {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-top-left-radius: 4px;
}

.user .msg-bubble {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-top-right-radius: 4px;
}

.msg-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: 100%;
}

.user .msg-body {
    align-items: flex-end;
}

.bot .msg-body {
    align-items: flex-start;
}

/* ===== MESSAGE ACTIONS (Copy) ===== */
.msg-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.message:hover .msg-actions {
    opacity: 1;
}

.msg-actions button {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    height: 32px;
    padding: 0 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s ease;
    backdrop-filter: blur(4px);
    white-space: nowrap;
}

.msg-actions button:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.3);
}

.copy-btn:hover {
    background: rgba(16, 185, 129, 0.2) !important;
    color: #10b981 !important;
    border-color: rgba(16, 185, 129, 0.3) !important;
}

.suggestion-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-top: 1rem;
}

.chip {
    background: rgba(56, 189, 248, 0.1);
    border: 1px solid rgba(56, 189, 248, 0.2);
    padding: 0.6rem 1.2rem;
    border-radius: 50px;
    font-size: 0.85rem;
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chip:hover {
    background: rgba(56, 189, 248, 0.2);
    transform: translateY(-2px);
}

.chat-input-container {
    padding: 1.5rem;
    border-top: 1px solid var(--glass-border);
    background: rgba(2, 6, 23, 0.5);
    position: relative;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 0.5rem;
    transition: all 0.3s;
}

.input-wrapper:focus-within {
    border-color: rgba(56, 189, 248, 0.5);
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.1);
    background: rgba(255, 255, 255, 0.05);
}

.chat-input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 0.8rem 1rem;
    color: var(--text-main);
    font-size: 1rem;
    resize: none;
    outline: none;
}

.chat-input::placeholder {
    color: var(--text-muted);
}

.send-btn {
    background: var(--send-btn);
    color: var(--bg-base);
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1.2rem;
    margin-left: 0.5rem;
}

.send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px var(--accent-glow);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.typing-indicator {
    display: none;
    padding: 1rem 1.2rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 18px;
    border-top-left-radius: 4px;
    align-self: flex-start;
    margin-bottom: 1rem;
    margin-left: 3.2rem;
}

.typing-indicator.active {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    animation: slideIn 0.3s ease-out forwards;
}

.dot {
    width: 6px;
    height: 6px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}

.dot:nth-child(1) {
    animation-delay: -0.32s;
}

.dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Format Markdown like content */
.msg-bubble strong {
    color: var(--accent);
    font-weight: 600;
}

.msg-bubble br {
    margin-bottom: 0.5rem;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    border-top: 1px solid var(--glass-border);
    margin-top: 4rem;
}

.menu-toggle {
    display: none;
    flex-direction: column;
    cursor: pointer;
    font-size: 1.5rem;
    color: var(--text-main);
}

@media (max-width: 768px) {
    nav {
        padding: 1rem 5%;
    }

    .menu-toggle {
        display: block;
    }

    .nav-links {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: var(--bg-base);
        padding: 2rem;
        gap: 2rem;
        border-bottom: 1px solid var(--glass-border);
        backdrop-filter: blur(20px);
        animation: fadeInDown 0.3s ease-out;
    }

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

    h1 {
        font-size: 2.2rem;
        margin-top: 1rem;
    }

    .chat-container {
        height: calc(100vh - 120px);
        border-radius: 12px;
        margin: 0 10px;
    }

    .chat-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        padding: 1rem;
    }

    .login-prompt {
        width: 100%;
        justify-content: center;
        font-size: 0.75rem;
    }

    main {
        padding: 1rem 0 0 0;
    }

    .hero {
        padding: 0 1.5rem;
        margin-bottom: 2rem;
    }

    .message {
        max-width: 95%;
    }

    .chat-input-container {
        padding: 1rem;
    }
}