@import url('https://fonts.googleapis.com/css2?family=Comic+Neue:wght@400;700&family=Fredoka+One&display=swap');

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

body {
    background: linear-gradient(135deg, #00C063, #EEA047);
    font-family: 'Comic Neue', cursive, sans-serif;
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh; /* Better mobile viewport */
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #AB2323, #8B1E1E);
    color: white;
    padding: 1rem 1rem 0.8rem 1rem;
    text-align: center;
    font-family: 'Fredoka One', cursive;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    position: relative;
    flex-shrink: 0;
}

.bot-avatar {
    width: 60px;
    height: 60px;
    margin: 0 auto 0.5rem auto;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: bounce 3s infinite;
}

.robot-face {
    position: relative;
    transform: scale(0.7);
}

.robot-head {
    width: 50px;
    height: 45px;
    background: linear-gradient(145deg, #00C063, #00A055);
    border-radius: 15px 15px 10px 10px;
    position: relative;
    margin: 0 auto 2px auto;
    box-shadow: 0 3px 8px rgba(0,0,0,0.2);
    border: 2px solid #EEA047;
}

.robot-eyes {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
}

.eye {
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    position: relative;
    box-shadow: inset 0 0 0 2px #AB2323;
    animation: blink 4s infinite;
}

.eye::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 4px;
    height: 4px;
    background: #AB2323;
    border-radius: 50%;
}

@keyframes blink {
    0%, 90%, 100% { transform: scaleY(1); }
    95% { transform: scaleY(0.1); }
}

.robot-mouth {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 8px;
    background: #AB2323;
    border-radius: 0 0 10px 10px;
    box-shadow: inset 0 2px 0 rgba(0,0,0,0.2);
}

.robot-body {
    width: 35px;
    height: 25px;
    background: linear-gradient(145deg, #EEA047, #D4903D);
    border-radius: 8px;
    position: relative;
    margin: 0 auto;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    border: 2px solid #00C063;
}

.robot-chest {
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 15px;
    height: 3px;
    background: #AB2323;
    border-radius: 2px;
    box-shadow: 0 1px 0 rgba(0,0,0,0.2);
}

.robot-arms {
    position: absolute;
    top: 5px;
    width: 100%;
    height: 100%;
}

.arm {
    position: absolute;
    width: 4px;
    height: 15px;
    background: linear-gradient(145deg, #00C063, #00A055);
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.left-arm {
    left: -6px;
    transform: rotate(-15deg);
    animation: wave-left 2s infinite alternate;
}

.right-arm {
    right: -6px;
    transform: rotate(15deg);
    animation: wave-right 2s infinite alternate;
}

@keyframes wave-left {
    0% { transform: rotate(-15deg); }
    100% { transform: rotate(-25deg); }
}

@keyframes wave-right {
    0% { transform: rotate(15deg); }
    100% { transform: rotate(25deg); }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-8px); }
    60% { transform: translateY(-4px); }
}

.header-title {
    font-size: 2rem;
    margin-bottom: 0.2rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.header-subtitle {
    font-family: 'Comic Neue', cursive;
    font-size: 1rem;
    opacity: 0.95;
    font-weight: 400;
}

.reset-button {
    position: absolute;
    top: 0.8rem;
    right: 1rem;
    background: rgba(255,255,255,0.2);
    border: 2px solid white;
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    font-family: 'Comic Neue', cursive;
    transition: all 0.3s ease;
    touch-action: manipulation; /* Better mobile touch */
}

.reset-button:hover {
    background: white;
    color: #AB2323;
}

.main-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 20px 20px 0 0;
    margin: 0.5rem 0.5rem 0 0.5rem;
    overflow: hidden;
    box-shadow: 0 -8px 30px rgba(0,0,0,0.2);
    min-height: 0;
}

.chat-messages {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    min-height: 0;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

.chat-message {
    max-width: 85%;
    padding: 0.8rem 1rem;
    border-radius: 18px;
    line-height: 1.4;
    font-size: 1rem;
    word-wrap: break-word;
    animation: slideIn 0.4s ease-out;
    white-space: pre-wrap;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

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

.user-message {
    background: linear-gradient(135deg, #00C063, #00A055);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 6px;
}

.bot-message {
    background: linear-gradient(135deg, #AB2323, #8B1E1E);
    color: white;
    align-self: flex-start;
    border-bottom-left-radius: 6px;
}

.typing {
    background: #f5f5f5 !important;
    color: #666 !important;
    animation: pulse 1.5s infinite;
}

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

.quick-questions {
    padding: 1rem;
    background: linear-gradient(135deg, #EEA047, #D4903D);
    border-top: 3px solid #AB2323;
    flex-shrink: 0;
}

.quick-questions h3 {
    margin: 0 0 0.8rem 0;
    font-family: 'Fredoka One', cursive;
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    font-size: 1rem;
    text-align: center;
}

.question-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.6rem;
    justify-items: center;
}

.question-btn {
    background: white;
    border: 2px solid #AB2323;
    color: #AB2323;
    padding: 0.6rem 1rem;
    border-radius: 25px;
    font-size: 0.85rem;
    cursor: pointer;
    font-family: 'Comic Neue', cursive;
    font-weight: 700;
    transition: all 0.3s ease;
    white-space: nowrap;
    min-width: 110px;
    touch-action: manipulation; /* Better mobile touch */
    -webkit-tap-highlight-color: transparent; /* Remove tap highlight */
}

.question-btn:hover, .question-btn:active {
    background: #AB2323;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(171,35,35,0.4);
}

.input-container {
    display: flex;
    padding: 1rem;
    background: linear-gradient(135deg, #EEA047, #D4903D);
    gap: 0.8rem;
    align-items: center;
    flex-shrink: 0;
}

input[type="text"] {
    flex-grow: 1;
    padding: 1rem;
    border: 2px solid #AB2323;
    border-radius: 25px;
    font-size: 1rem;
    font-family: 'Comic Neue', cursive;
    background: white;
    transition: all 0.3s ease;
    -webkit-appearance: none; /* Remove iOS styling */
    touch-action: manipulation;
}

input[type="text"]:focus {
    outline: none;
    border-color: #00C063;
    box-shadow: 0 0 0 3px rgba(0,192,99,0.2);
}

.send-button {
    background: linear-gradient(135deg, #AB2323, #8B1E1E);
    border: none;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 25px;
    font-size: 1rem;
    cursor: pointer;
    font-family: 'Fredoka One', cursive;
    transition: all 0.3s ease;
    box-shadow: 0 3px 12px rgba(171,35,35,0.4);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.send-button:hover, .send-button:active {
    background: linear-gradient(135deg, #8B1E1E, #6B1717);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(171,35,35,0.6);
}

.footer {
    background: linear-gradient(135deg, #AB2323, #8B1E1E);
    color: white;
    padding: 0.6rem;
    text-align: center;
    font-family: 'Comic Neue', cursive;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.heart {
    color: #ff4757;
    font-size: 1rem;
    animation: heartbeat 1.5s infinite;
}

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

.giiyo-tech-logo {
    height: 20px;
    width: auto;
    border-radius: 3px;
    transition: all 0.3s ease;
}

.giiyo-tech-logo:hover {
    transform: scale(1.1);
}

.footer-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    align-items: center;
}

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

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #AB2323, #8B1E1E);
    border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #8B1E1E, #6B1717);
}

/* IMPROVED MOBILE RESPONSIVENESS */
@media (max-width: 768px) {
    body {
        height: 100vh;
        height: 100dvh; /* Dynamic viewport height */
    }
    
    header {
        padding: 0.8rem 1rem 0.6rem 1rem;
    }
    
    .header-title {
        font-size: 1.6rem;
    }
    
    .header-subtitle {
        font-size: 0.9rem;
    }
    
    .bot-avatar {
        width: 50px;
        height: 50px;
        margin-bottom: 0.3rem;
    }
    
    .robot-face {
        transform: scale(0.6);
    }
    
    .reset-button {
        top: 0.5rem;
        right: 0.8rem;
        padding: 0.3rem 0.6rem;
        font-size: 0.75rem;
    }
    
    .main-container {
        margin: 0.3rem 0.3rem 0 0.3rem;
        border-radius: 15px 15px 0 0;
    }
    
    .chat-messages {
        padding: 0.8rem;
        gap: 0.6rem;
    }
    
    .chat-message {
        font-size: 0.9rem;
        max-width: 90%;
        padding: 0.7rem 0.9rem;
        border-radius: 15px;
    }
    
    .quick-questions {
        padding: 0.8rem;
    }
    
    .quick-questions h3 {
        font-size: 0.9rem;
        margin-bottom: 0.6rem;
    }
    
    .question-buttons {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }
    
    .question-btn {
        font-size: 0.75rem;
        padding: 0.5rem 0.8rem;
        min-width: auto;
    }
    
    .input-container {
        padding: 0.8rem;
        gap: 0.6rem;
    }
    
    input[type="text"] {
        font-size: 1rem;
        padding: 0.9rem;
    }
    
    .send-button {
        font-size: 0.9rem;
        padding: 0.9rem 1.2rem;
    }
    
    .footer {
        padding: 0.5rem;
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .header-title {
        font-size: 1.4rem;
    }
    
    .header-subtitle {
        font-size: 0.8rem;
    }
    
    .main-container {
        margin: 0.2rem 0.2rem 0 0.2rem;
    }
    
    .chat-messages {
        padding: 0.6rem;
    }
    
    .chat-message {
        font-size: 0.85rem;
        padding: 0.6rem 0.8rem;
    }
    
    .question-buttons {
        grid-template-columns: 1fr;
        gap: 0.4rem;
    }
    
    .question-btn {
        font-size: 0.7rem;
        padding: 0.4rem 0.6rem;
    }
    
    .input-container {
        padding: 0.6rem;
    }
    
    input[type="text"] {
        font-size: 0.9rem;
        padding: 0.8rem;
    }
    
    .send-button {
        font-size: 0.8rem;
        padding: 0.8rem 1rem;
    }
    
    .footer {
        flex-direction: column;
        gap: 0.3rem;
        font-size: 0.7rem;
        padding: 0.4rem;
    }
}

/* Handle landscape orientation on mobile */
@media (max-height: 500px) and (orientation: landscape) {
    header {
        padding: 0.5rem 1rem;
    }
    
    .bot-avatar {
        width: 40px;
        height: 40px;
        margin-bottom: 0.2rem;
    }
    
    .robot-face {
        transform: scale(0.5);
    }
    
    .header-title {
        font-size: 1.3rem;
        margin-bottom: 0.1rem;
    }
    
    .header-subtitle {
        font-size: 0.8rem;
    }
    
    .quick-questions {
        padding: 0.6rem;
    }
    
    .input-container {
        padding: 0.6rem;
    }
}