:root {
    --primary-color: #ff9ac1;
    --secondary-color: #fff5f8;
    --accent-color: #ff619a;
    --text-color: #4a4a4a;
    --border-color: #ffcce0;
}

body {
    margin: 0;
    font-family: 'Comic Sans MS', 'Segoe UI', sans-serif;
    background-color: var(--secondary-color);
    background-image: 
        url('assets/patterns/hearts-pattern.png'),
        url('assets/patterns/lace-border.png');
    background-position: center, top;
    background-repeat: repeat, repeat-x;
}

/* AI Assistant Styles */
.ai-assistant {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    align-items: flex-end;
    z-index: 1000;
}

.ai-character img {
    width: 250px; /* Increased size */
    height: auto;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
    transition: transform 0.3s ease;
}

.ai-chat {
    display: none;  /* Hidden by default */
    background: white;
    border-radius: 25px;
    padding: 20px;
    margin-right: 20px;
    box-shadow: 0 4px 15px rgba(255, 154, 193, 0.3);
    max-width: 350px;
    min-width: 320px;
    border: 3px solid var(--border-color);
    position: relative;
}

/* When active, use flex display */
.ai-chat.active {
    display: flex !important;  /* Override the display:none */
    flex-direction: column;
}

.ai-chat::after {
    content: '';
    position: absolute;
    right: -20px;
    bottom: 20px;
    width: 0;
    height: 0;
    border-left: 20px solid var(--border-color);
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
}

.chat-messages {
    margin-bottom: 10px;
    max-height: 250px;
    overflow-y: auto;
    padding: 10px;
    background: rgba(255, 245, 248, 0.5);
    border-radius: 15px;
    scroll-behavior: smooth;
    flex-grow: 1;
}

.chat-messages p {
    margin: 8px 0;
    padding: 8px 12px;
    border-radius: 15px;
    background: white;
    box-shadow: 0 2px 5px rgba(255, 154, 193, 0.2);
}

.maid-message, .user-message {
    margin: 8px 0;
    padding: 8px 12px;
    border-radius: 15px;
    overflow-wrap: break-word;
    hyphens: auto;
    max-width: 100%;
}

.maid-message {
    background: white;
    box-shadow: 0 2px 5px rgba(255, 154, 193, 0.2);
    color: var(--text-color);
    animation: messageAppear 0.3s ease;
}

.user-message {
    background: var(--primary-color);
    color: white;
    text-align: right;
    margin-left: 20%;
    animation: messageAppear 0.3s ease;
}

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

/* Style scrollbar for chat messages */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: rgba(255, 245, 248, 0.5);
    border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
}

#userInput {
    width: calc(100% - 30px);
    padding: 10px 15px;
    border: 2px solid var(--primary-color);
    border-radius: 20px;
    outline: none;
    font-size: 12px;
    background: white;
    transition: all 0.3s ease;
    margin: 5px auto;
}

#userInput:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 10px rgba(255, 154, 193, 0.3);
}

/* Adjust placeholder text */
#userInput::placeholder {
    font-size: 11px;
    opacity: 0.8;
}

/* Header Styles */
header {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    padding: 1.5rem;
    text-align: center;
    color: white;
    box-shadow: 0 4px 15px rgba(255, 154, 193, 0.3);
}

header h1 {
    font-size: 2.5em;
    margin: 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

nav {
    margin-top: 20px;
}

nav ul {
    list-style: none;
    padding: 0;
    display: flex;
    justify-content: center;
    gap: 2rem;
}

nav a {
    color: white;
    text-decoration: none;
    font-weight: bold;
    font-size: 1.1em;
    padding: 8px 15px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

nav a:hover {
    background: white;
    color: var(--accent-color);
    transform: scale(1.05);
}

/* Animation classes */
.greeting {
    animation: greetingBow 1s ease;
}

.pointing {
    animation: pointingGesture 1s ease;
}

.thinking {
    animation: thinkingPose 1s ease;
}

@keyframes greetingBow {
    0% { transform: rotate(0deg); }
    30% { transform: rotate(15deg); }
    100% { transform: rotate(0deg); }
}

@keyframes pointingGesture {
    0% { transform: translateX(0); }
    30% { transform: translateX(10px); }
    100% { transform: translateX(0); }
}

@keyframes thinkingPose {
    0% { transform: translateY(0); }
    30% { transform: translateY(-10px); }
    100% { transform: translateY(0); }
}

/* Added cute decorative elements */
.ai-chat::before {
    content: '✨';
    position: absolute;
    top: -15px;
    left: 10px;
    font-size: 20px;
}

.chat-messages p::before {
    content: '🎀';
    margin-right: 5px;
}

/* Make sure the image is visible */
.ai-character {
    display: block;
    position: relative;
    margin-bottom: 60px; /* Make space for the button */
}

.maid-sprite {
    width: 200px;
    height: 200px;
    background-image: url('assets/maid-sprite.png');
    background-repeat: no-repeat;
    background-size: 1000px; /* Assuming 5 frames of animation */
    animation: idle 1s steps(5) infinite;
}

@keyframes idle {
    from { background-position: 0px; }
    to { background-position: -1000px; }
}

.maid-sprite.greeting {
    animation: greeting 1s steps(5) 1;
}

.maid-sprite.pointing {
    animation: pointing 1s steps(5) 1;
}

.maid-sprite.thinking {
    animation: thinking 1s steps(5) 1;
}

/* Add more animations as needed */

.ai-character img {
    width: 200px;
    height: auto;
    transition: transform 0.3s ease;
}

/* Animation classes */
.greeting {
    animation: greetingBow 1s ease;
}

.pointing {
    animation: pointingGesture 1s ease;
}

.thinking {
    animation: thinkingPose 1s ease;
}

@keyframes greetingBow {
    0% { transform: rotate(0deg); }
    30% { transform: rotate(15deg); }
    100% { transform: rotate(0deg); }
}

@keyframes pointingGesture {
    0% { transform: translateX(0); }
    30% { transform: translateX(10px); }
    100% { transform: translateX(0); }
}

@keyframes thinkingPose {
    0% { transform: translateY(0); }
    30% { transform: translateY(-10px); }
    100% { transform: translateY(0); }
}

.corner-maid {
    position: fixed;
    bottom: 100px;
    right: 20px;
    z-index: 100;
}

.maid-mascot {
    width: 200px;
    height: auto;
    transition: transform 0.3s ease;
    mix-blend-mode: multiply;
    filter: contrast(1);
}

.maid-mascot:hover {
    transform: scale(1.05);
}

/* Menu item styling with cute frame */
.menu-item {
    position: relative;
    padding: 15px;
    margin: 20px;
    background: white;
    border-radius: 20px;
    transition: transform 0.3s ease;
}

.menu-item::before {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    background: 
        /* Top left corner */
        radial-gradient(circle at 0 0, transparent 15px, var(--border-color) 16px) top left,
        /* Top right corner */
        radial-gradient(circle at 100% 0, transparent 15px, var(--border-color) 16px) top right,
        /* Bottom left corner */
        radial-gradient(circle at 0 100%, transparent 15px, var(--border-color) 16px) bottom left,
        /* Bottom right corner */
        radial-gradient(circle at 100% 100%, transparent 15px, var(--border-color) 16px) bottom right;
    background-size: 51% 51%;
    background-repeat: no-repeat;
    border: 3px solid var(--border-color);
    border-radius: 25px;
    z-index: -1;
}

.menu-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 15px;
    border: 2px solid var(--primary-color);
    box-shadow: 0 4px 10px rgba(255, 154, 193, 0.2);
}

.menu-item h3 {
    color: var(--accent-color);
    margin: 15px 0 10px;
    text-align: center;
    font-size: 1.2em;
}

/* Add cute decorative elements */
.menu-item::after {
    content: '✧';
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    color: var(--primary-color);
    font-size: 20px;
}

/* Hover effect */
.menu-item:hover {
    transform: translateY(-5px);
}

/* Menu grid layout */
.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    padding: 20px;
}

/* Back button styling */
.back-button {
    position: fixed;
    top: 20px;
    left: 20px;
    background: var(--primary-color);
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 2px solid white;
    box-shadow: 0 4px 10px rgba(255, 154, 193, 0.3);
    transition: all 0.3s ease;
    z-index: 100;
}

.back-arrow {
    font-size: 1.2em;
}

.back-text {
    font-weight: bold;
}

/* Hover effect */
.back-button:hover {
    transform: translateX(-5px);
    background: white;
    color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Add cute decoration */
.back-button::after {
    content: '✿';
    position: absolute;
    right: -15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary-color);
    font-size: 1.2em;
    opacity: 0;
    transition: all 0.3s ease;
}

.back-button:hover::after {
    opacity: 1;
    right: -25px;
}

.ai-chat.active {
    display: block;
}

/* Chat toggle button styles */
.chat-toggle-btn {
    position: absolute;
    bottom: -60px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-family: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    border: 2px solid white;
    box-shadow: 0 4px 10px rgba(255, 154, 193, 0.3);
    transition: all 0.3s ease;
    opacity: 1;
    visibility: visible;
}

.ai-chat.active + .ai-character .chat-toggle-btn {
    opacity: 0;
    visibility: hidden;
}

.chat-toggle-btn:hover {
    transform: translateX(-50%) scale(1.05);
    background: white;
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.tap-text {
    font-size: 0.8em;
    opacity: 0.9;
}

/* Close button styles */
.close-chat-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 1.2em;
    cursor: pointer;
    padding: 5px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close-chat-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.1);
}

/* Confirmation message styles */
.confirmation-overlay {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 20px;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(255, 154, 193, 0.3);
    border: 3px solid var(--primary-color);
    z-index: 1000;
    animation: popIn 0.3s ease;
}

.confirmation-message {
    text-align: center;
    color: var(--text-color);
}

.confirmation-message h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
}

.confirmation-message ul {
    list-style: none;
    padding: 0;
    margin: 15px 0;
}

.confirmation-message li {
    margin: 5px 0;
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: translate(-50%, -60%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

/* =========================================================================
   Responsive Design Media Queries 📱💻
   ========================================================================= */

/* Tablets and small desktops (max-width: 1024px) */
@media (max-width: 1024px) {
    header h1 {
        font-size: 2.2em;
    }
    
    .menu-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 15px;
        padding: 15px;
    }
}

/* Mobile Devices (max-width: 768px) */
@media (max-width: 768px) {
    /* Header & Navigation */
    header {
        padding: 1rem;
    }
    
    header h1 {
        font-size: 1.8em;
    }
    
    nav ul {
        flex-wrap: wrap;
        gap: 10px;
        justify-content: center;
    }
    
    nav a {
        font-size: 0.95em;
        padding: 6px 12px;
    }

    /* Back Button Behavior */
    .back-button {
        position: static;
        display: inline-flex;
        margin: 15px auto;
        justify-content: center;
        width: max-content;
        font-size: 0.9em;
        padding: 8px 15px;
    }

    /* AI Assistant Fixes */
    .ai-assistant {
        bottom: 5px;
        right: 5px;
        transform-origin: bottom right;
        transform: scale(0.85);
    }
    
    .ai-character {
        margin-bottom: 45px;
    }
    
    .ai-character img, #maidSprite, .maid-sprite {
        width: 120px !important;
        height: auto !important;
        background-size: 600px !important; /* Fixes animation frame size if background is used */
    }
    
    .ai-chat {
        max-width: 85vw;
        min-width: 250px;
        margin-right: 10px;
        padding: 15px;
    }
    
    .chat-messages {
        max-height: 200px;
    }
    
    /* Make the mobile toggle button a neat, horizontal speech bubble on the left */
    .chat-toggle-btn {
        bottom: 30px;
        left: -10px;
        transform: translateX(-100%);
        padding: 8px 15px;
        font-size: 0.9em !important;
        white-space: nowrap;
        border-radius: 20px 20px 0 20px;
    }
    
    .chat-toggle-btn span:first-child {
        display: none; /* Hide the long text to save space */
    }
    
    .ai-chat.active + .ai-character .chat-toggle-btn {
        display: none !important;
    }

    /* Structural Adjustments */
    .menu-grid {
        grid-template-columns: 1fr;
    }
    
    .menu-item {
        margin: 10px;
    }

    /* Reservation Forms */
    .reservation-container,
    .login-container,
    .modal-content {
        width: 90%;
        margin: 20px auto;
        padding: 20px;
        box-sizing: border-box;
    }
    
    .form-group input, 
    .form-group select, 
    .form-group textarea {
        font-size: 16px; /* Prevents auto-zoom on iOS */
        padding: 10px;
    }
    
    /* Modals & Overlays */
    .confirmation-overlay {
        width: 85vw;
        padding: 15px;
    }
}

/* Small Phones (max-width: 480px) */
@media (max-width: 480px) {
    header h1 {
        font-size: 1.5em;
    }
    
    nav ul {
        flex-direction: row;
        gap: 8px;
    }
    
    nav a {
        font-size: 0.85em;
        padding: 5px 10px;
    }
    
    .menu-item img {
        height: 180px;
    }
    
    .ai-character img {
        width: 100px;
    }
    
    .chat-toggle-btn span {
        font-size: 0.9em;
    }
}
