/* style.css */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

body {
    background: linear-gradient(135deg, #0a0a16, #1a1a2e);
    min-height: 100vh;
    padding: 0;
    overflow-x: hidden;
    color: #fff;
    display: flex;
    flex-direction: column;
    touch-action: manipulation;
    opacity: 0;
    animation: fadeIn 0.8s ease-out forwards;
}

/* Animasi utama */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { 
        opacity: 0;
        transform: translateY(30px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from { 
        opacity: 0;
        transform: scale(0.8);
    }
    to { 
        opacity: 1;
        transform: scale(1);
    }
}

.header {
    padding: 18px 15px 6px;
    text-align: center;
    position: sticky;
    top: 0;
    background: rgba(10, 10, 26, 0.95);
    backdrop-filter: blur(10px);
    z-index: 100;
    border-bottom: 1px solid rgba(255, 0, 0, 0.3);
    opacity: 0;
    animation: slideUp 0.6s ease-out 0.3s forwards;
}

.header h1 {
    font-size: 26px;
    font-weight: 800;
    color: #ff0000;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    text-shadow: 0 0 15px rgba(255, 0, 0, 0.7);
    margin-bottom: 4px;
}

.tagline {
    font-size: 13px;
    color: #d0d0ff;
    font-weight: 400;
    max-width: 500px;
    margin: 0 auto;
    line-height: 1.3;
}

.chat-container {
    flex: 1;
    padding: 8px 8px 100px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    transform: translateZ(0);
    opacity: 0;
    animation: slideUp 0.6s ease-out 0.5s forwards;
}

.message {
    max-width: 90%;
    padding: 10px 13px;
    border-radius: 14px;
    position: relative;
    animation: fadeIn 0.4s ease;
    line-height: 1.4;
    background: rgba(20, 20, 40, 0.7);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 0, 0, 0.2);
    font-size: 14px;
}

.ai-message {
    align-self: flex-start;
    border-left: 4px solid #ff0000;
}

.user-message {
    align-self: flex-end;
    background: rgba(40, 0, 0, 0.7);
    border-right: 4px solid #ff0000;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 5px;
}

.ai-icon {
    width: 22px;
    height: 22px;
    background: #ff0000;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 11px;
}

.message-header strong {
    font-size: 14px;
    color: #ff0000;
    font-weight: 600;
}

.message p {
    font-size: 14px;
    color: #fff;
}

.input-area {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 10px;
    background: rgba(10, 10, 26, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 0, 0, 0.3);
    display: flex;
    gap: 8px;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.8);
    z-index: 100;
    align-items: center;
    height: 80px;
    opacity: 0;
    animation: slideUp 0.6s ease-out 0.7s forwards;
}

#user-input {
    flex: 1;
    padding: 12px 16px;
    border: none;
    background: rgba(30, 30, 50, 0.9);
    border-radius: 30px;
    font-size: 14px;
    outline: none;
    color: #fff;
    transition: all 0.3s;
    border: 1px solid rgba(255, 0, 0, 0.3);
    height: 50px;
    opacity: 0;
    animation: fadeIn 0.5s ease-out 0.9s forwards;
}

#user-input:focus {
    border-color: #ff0000;
    box-shadow: 0 0 0 3px rgba(255, 0, 0, 0.3);
    background: rgba(40, 40, 60, 0.95);
}

#user-input::placeholder {
    color: #ff9999;
    font-weight: 500;
    opacity: 0.9;
    font-size: 14px;
}

/* Tombol kirim dengan animasi khusus */
#send-btn {
    background: linear-gradient(135deg, #ff0000, #c00000);
    color: white;
    border: none;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    font-size: 26px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 25px rgba(255, 0, 0, 0.7);
    transition: all 0.3s;
    position: relative;
    animation: pulse 1.5s infinite, scaleIn 0.6s ease-out 1.0s forwards;
    flex-shrink: 0;
    opacity: 0;
    transform: scale(0);
}

@keyframes pulse {
    0% { transform: scale(1); box-shadow: 0 0 25px rgba(255, 0, 0, 0.7); }
    50% { transform: scale(1.1); box-shadow: 0 0 35px rgba(255, 0, 0, 0.9); }
    100% { transform: scale(1); box-shadow: 0 0 25px rgba(255, 0, 0, 0.7); }
}

#send-btn:active {
    transform: scale(0.95);
}

.typing-indicator {
    display: none;
    background: rgba(30, 30, 50, 0.8);
    padding: 10px 12px;
    border-radius: 14px;
    align-self: flex-start;
    border: 1px solid rgba(255, 0, 0, 0.2);
    border-left: 4px solid #ff0000;
    margin-bottom: 8px;
    backdrop-filter: blur(5px);
    flex-direction: column;
    gap: 5px;
    max-width: 130px;
}

.typing-text {
    font-size: 12px;
    color: #ff0000;
}

.typing-dots {
    display: flex;
    gap: 5px;
    padding-left: 2px;
}

.typing-dots span {
    height: 7px;
    width: 7px;
    background: #ff0000;
    border-radius: 50%;
    display: inline-block;
    animation: bounce 1.3s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

.typing-dots span:nth-child(1) {
    animation-delay: 0.1s;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.3s;
}

.timestamp {
    font-size: 9px;
    color: #888;
    margin-top: 5px;
    text-align: right;
}

.divider {
    height: 1px;
    background: rgba(255, 0, 0, 0.2);
    margin: 12px 8px;
    position: relative;
}

.divider::before {
    content: "Zia AI";
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(20, 20, 40, 0.8);
    padding: 0 10px;
    color: #ff0000;
    font-size: 12px;
    font-weight: 600;
}

.welcome-message {
    text-align: center;
    padding: 15px 12px;
    background: rgba(30, 30, 50, 0.8);
    border-radius: 14px;
    border: 1px solid rgba(255, 0, 0, 0.2);
    margin: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    opacity: 0;
    animation: scaleIn 0.6s ease-out 0.4s forwards;
}

.welcome-message h2 {
    font-size: 18px;
    margin-bottom: 10px;
    color: #ff0000;
    font-weight: 600;
}

.welcome-message p {
    font-size: 13px;
    color: #d0d0ff;
    line-height: 1.4;
}

/* Animasi partikel latar belakang */
.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.particle {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 0, 0, 0.15);
    animation: float 15s infinite linear;
    opacity: 0;
    animation: float 15s infinite linear, fadeIn 0.8s ease-out 0.2s forwards;
}

@keyframes float {
    0% { transform: translateY(0) translateX(0) rotate(0deg); opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { transform: translateY(-100vh) translateX(100px) rotate(720deg); opacity: 0; }
}

/* Styling khusus untuk tombol kirim */
.send-btn-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Animasi untuk tombol kirim */
@keyframes highlightBtn {
    0% { transform: scale(1); box-shadow: 0 0 25px rgba(255, 0, 0, 0.7); }
    50% { transform: scale(1.15); box-shadow: 0 0 40px rgba(255, 0, 0, 1); }
    100% { transform: scale(1); box-shadow: 0 0 25px rgba(255, 0, 0, 0.7); }
}

.highlight {
    animation: highlightBtn 1s ease;
}

/* Perbaikan untuk semua ukuran layar */
@media (max-width: 768px) {
    .chat-container {
        padding-bottom: 100px;
    }
    
    .input-area {
        padding: 8px 10px;
        height: 75px;
    }
    
    #user-input {
        padding: 11px 14px;
        height: 45px;
        font-size: 13px;
    }
    
    #send-btn {
        width: 55px;
        height: 55px;
        font-size: 24px;
    }
}

/* Perbaikan khusus untuk layar kecil */
@media (max-width: 480px) and (max-height: 700px) {
    .chat-container {
        padding-bottom: 90px;
    }
    
    .header {
        padding: 12px 10px 5px;
    }
    
    .header h1 {
        font-size: 22px;
    }
    
    .tagline {
        font-size: 11px;
    }
    
    .welcome-message {
        padding: 12px 10px;
    }
    
    .welcome-message h2 {
        font-size: 16px;
    }
    
    .welcome-message p {
        font-size: 12px;
    }
    
    .message {
        padding: 8px 10px;
        font-size: 13px;
    }
    
    .message p {
        font-size: 13px;
    }
    
    .input-area {
        padding: 6px 8px;
        gap: 6px;
        height: 70px;
    }
    
    #user-input {
        padding: 10px 13px;
        font-size: 13px;
        height: 42px;
    }
    
    #send-btn {
        width: 50px;
        height: 50px;
        font-size: 22px;
    }
}

/* Fitur tambahan untuk menghindari keyboard */
.keyboard-open .chat-container {
    padding-bottom: 140px !important;
}

.keyboard-open .input-area {
    transform: translateY(0);
}