:root {
    --primary-color: #FFB6C1;
    --secondary-color: #E6E6FA;
    --accent-color: #FFDAB9;
    --text-primary: #4A4A4A;
    --text-secondary: #757575;
    --background: linear-gradient(135deg, #FFF0F5 0%, #F8F8FF 100%);
    --white: #FFFFFF;
    --border-radius: 20px;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.16);
}

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

html {
    height: 100%;
    /* Prevent iOS Safari bounce effect */
    position: fixed;
    width: 100%;
    overflow: hidden;
}

body {
    font-family: 'Noto Sans KR', sans-serif;
    color: var(--text-primary);
    background: var(--background);
    height: 100%;
    margin: 0;
    overflow: hidden;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    /* Prevent iOS Safari bounce */
    position: fixed;
    width: 100%;
    touch-action: manipulation;
    -webkit-overflow-scrolling: touch;
}

#app {
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.hidden {
    display: none !important;
}

/* Auth Container */
.auth-container {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 40px 30px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}

.app-title {
    font-size: 32px;
    font-weight: 600;
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.app-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 30px;
}

.auth-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
}

.auth-tab {
    flex: 1;
    padding: 12px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
}

.auth-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

.form-group {
    margin-bottom: 20px;
}

.form-group input {
    width: 100%;
    padding: 14px 18px;
    border: 1px solid #E0E0E0;
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: #FAFAFA;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: var(--white);
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--primary-color), #FFA0B4);
    color: var(--white);
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 182, 193, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.error-message {
    color: #FF6B6B;
    font-size: 14px;
    margin-top: 15px;
    text-align: center;
    padding: 10px;
    background: #FFE5E5;
    border-radius: 8px;
    display: none;
}

.error-message:not(:empty) {
    display: block;
}

/* Chat Container */
.chat-container {
    height: 100%;
    height: 100dvh; /* Dynamic viewport height for mobile */
    display: flex;
    flex-direction: column;
    max-width: 480px;
    margin: 0 auto;
    width: 100%;
    background: var(--white);
    position: relative;
    overflow: hidden;
}

/* Header */
.chat-header {
    background: linear-gradient(135deg, var(--primary-color), #FFA0B4);
    padding: 16px 20px;
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-title {
    color: var(--white);
    font-size: 20px;
    font-weight: 600;
}

.header-actions {
    display: flex;
    gap: 10px;
}

.credit-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    padding: 6px 14px;
    color: var(--white);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s ease;
}

.credit-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.menu-btn {
    background: transparent;
    border: none;
    color: var(--white);
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
}

/* Messages Container */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    padding-bottom: 120px; /* Space for fixed input container */
    background: #FAFAFA;
    min-height: 0;
    /* iOS scroll optimization */
    -webkit-overflow-scrolling: touch;
}

.welcome-message {
    text-align: center;
    padding: 40px 20px;
}

.welcome-message h2 {
    font-size: 24px;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.welcome-message p {
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.hint {
    font-size: 14px;
    color: var(--primary-color);
    background: rgba(255, 182, 193, 0.1);
    padding: 10px;
    border-radius: 10px;
    display: inline-block;
    margin-top: 10px;
}

.message {
    margin-bottom: 16px;
    display: flex;
    animation: slideIn 0.3s ease;
}

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

.message.user {
    justify-content: flex-end;
}

.message-bubble {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    box-shadow: var(--shadow-sm);
}

.message.user .message-bubble {
    background: linear-gradient(135deg, var(--primary-color), #FFA0B4);
    color: var(--white);
    border-bottom-right-radius: 4px;
}

.message.assistant .message-bubble {
    background: var(--white);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.message-images-container {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.message-image {
    max-width: 150px;
    max-height: 150px;
    object-fit: cover;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s ease;
    /* iOS Safari optimization */
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    /* Prevent image flickering on iOS */
    -webkit-backface-visibility: hidden;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    /* Ensure image loads properly */
    min-height: 50px;
    background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
}

.message-images-container .message-image {
    flex: 0 0 auto;
}

.message-image:hover {
    transform: scale(1.05);
}

.typing-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 16px 20px;
    background: var(--white);
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    min-width: 60px;
    min-height: 44px;
    box-shadow: var(--shadow-sm);
}

/* Pink Spinner for AI Response */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 182, 193, 0.2);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Original Dots Animation (kept as fallback) */
.typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;
}

.typing-dots span {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary-color);
    animation: typing 1.4s infinite;
    opacity: 0.8;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.5;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Input Container */
.input-container {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    padding: 16px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom)); /* iOS safe area */
    background: var(--white);
    border-top: 1px solid #E0E0E0;
    z-index: 100;
    transition: padding 0.3s ease;
    max-height: 50vh;
    overflow-y: auto;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    /* Prevent iOS Safari viewport issues */
    -webkit-transform: translate3d(-50%, 0, 0);
    transform: translate3d(-50%, 0, 0);
    will-change: transform;
}

.image-preview {
    margin-bottom: 10px;
    padding: 8px;
    background: rgba(245, 245, 245, 0.98);
    border-radius: 8px;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    max-height: 120px;
    overflow-y: auto;
    position: relative;
    z-index: 101;
    /* iOS scroll optimization */
    -webkit-overflow-scrolling: touch;
}

.preview-image-container {
    position: relative;
    display: inline-block;
}

.preview-image-container img {
    display: block;
    border-radius: 8px;
    border: 1px solid #E0E0E0;
}

.remove-single-image {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #FF6B6B;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    padding: 0;
    transition: all 0.2s ease;
}

.remove-single-image:hover {
    background: #FF5252;
    transform: scale(1.1);
}

.message-form {
    display: flex;
    gap: 8px;
    align-items: center;
}

.image-upload-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.05);
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
    padding: 0;
    font-size: 32px;
    font-weight: 400;
    line-height: 1;
}

.image-upload-btn:hover {
    background: rgba(255, 182, 193, 0.2);
    color: var(--primary-color);
    transform: scale(1.05);
}

.image-upload-btn:active {
    transform: scale(0.95);
}

#messageInput {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #E0E0E0;
    border-radius: 24px;
    font-size: 16px !important; /* Prevent iOS zoom */
    background: #FAFAFA;
    transition: all 0.3s ease;
    min-width: 0;
    resize: none; /* Disable manual resize */
    overflow-y: hidden; /* Hide scrollbar initially */
    min-height: 48px; /* Minimum height */
    max-height: 200px; /* Maximum height before scrolling */
    line-height: 1.5;
    /* iOS-specific fixes */
    -webkit-appearance: none;
    -webkit-user-select: text;
    user-select: text;
    touch-action: manipulation;
}

#messageInput:focus {
    outline: none;
    border-color: var(--primary-color);
    background: var(--white);
    /* Prevent iOS zoom on focus */
    font-size: 16px !important;
}

/* Adjust when textarea grows */
#messageInput.expanded {
    overflow-y: auto; /* Show scrollbar when max height reached */
}

.send-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), #FFA0B4);
    border: none;
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.send-btn:hover {
    transform: scale(1.1);
}

.send-btn:active {
    transform: scale(0.95);
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    overflow-x: hidden !important;
    overflow-y: auto;
}

/* When modal is open, prevent body scroll */
body.modal-open {
    overflow: hidden !important;
}

.modal-content {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 30px;
    max-width: 400px;
    width: 100%;
    position: relative;
    animation: modalSlideIn 0.3s ease;
    overflow-x: hidden;
    overflow-y: auto;
    box-sizing: border-box;
}

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

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    font-size: 28px;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
    z-index: 10;
    transition: all 0.2s ease;
}

.modal-close:hover {
    color: var(--text-primary);
    transform: scale(1.1);
}

/* Special styling for About modal close button - REMOVED (moved to about.html)
.about-modal .modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #666;
    z-index: 1000;
    border: 1px solid rgba(255, 182, 193, 0.3);
}

.about-modal .modal-close:hover {
    background: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transform: rotate(90deg);
}

.modal h3 {
    margin-bottom: 20px;
    font-size: 20px;
    color: var(--text-primary);
}

/* Menu Modal */
.menu-modal {
    overflow-x: hidden;
    overflow-y: auto;
    max-height: 90vh;
}

.menu-list {
    list-style: none;
}

.menu-list li {
    margin-bottom: 10px;
}

.menu-list button {
    width: 100%;
    padding: 14px;
    background: transparent;
    border: 1px solid #E0E0E0;
    border-radius: 12px;
    font-size: 16px;
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
    transition: all 0.3s ease;
}

.menu-list button:hover {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
}

/* Payment Modal */
.payment-modal {
    overflow-x: hidden;
    overflow-y: auto;
    max-height: 90vh;
}

.payment-info {
    background: #FAFAFA;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.payment-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
}

.payment-item:last-child {
    margin-bottom: 0;
}

.payment-label {
    color: var(--text-secondary);
}

.payment-value {
    font-weight: 600;
    color: var(--text-primary);
}

.payment-note {
    font-size: 14px;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 20px;
}

/* Image Modal */
.image-modal {
    max-width: 90vw;
    max-height: 90vh;
    overflow-x: hidden;
    overflow-y: auto;
}

/* Modal z-index hierarchy */
#galleryModal {
    z-index: 1000;  /* Gallery modal base level */
}

#imageModal {
    z-index: 2000;  /* Image detail modal above gallery */
}

.image-viewer {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
    max-height: 60vh;
    overflow: auto;
}

#modalImage {
    max-width: 100%;
    max-height: 100%;
    border-radius: 12px;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 182, 193, 0.3);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-text {
    margin-top: 20px;
    color: var(--text-secondary);
    font-size: 16px;
}

/* Gallery Modal */
.gallery-modal {
    max-width: 90vw;
    max-height: 90vh;
    width: 600px;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
    box-sizing: border-box;
}

.gallery-modal h3 {
    flex-shrink: 0;
    margin-bottom: 15px;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding: 10px;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: calc(90vh - 120px);
    flex-grow: 1;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 182, 193, 0.5) transparent;
}

.gallery-grid::-webkit-scrollbar {
    width: 8px;
}

.gallery-grid::-webkit-scrollbar-track {
    background: rgba(255, 182, 193, 0.1);
    border-radius: 4px;
}

.gallery-grid::-webkit-scrollbar-thumb {
    background: rgba(255, 182, 193, 0.5);
    border-radius: 4px;
}

.gallery-grid::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 182, 193, 0.7);
}

.gallery-item {
    position: relative;
    padding-bottom: 100%;
    background: linear-gradient(135deg, #F5F5F5 0%, #E8E8E8 100%);
    border-radius: 8px;
    overflow: hidden;
    will-change: transform;
    transition: transform 0.2s ease;
}

.gallery-item:hover .delete-image-btn {
    opacity: 1;
}

.gallery-item img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.3s ease;
    background: linear-gradient(135deg, #F5F5F5 0%, #E8E8E8 100%);
}

.gallery-item img:hover {
    transform: scale(1.05);
}

/* Shimmer loading effect for gallery images */
@keyframes shimmer {
    0% {
        background-position: -200% center;
    }
    100% {
        background-position: 200% center;
    }
}

.gallery-item:not(.loaded) {
    background: linear-gradient(
        90deg,
        #F5F5F5 0%,
        #E8E8E8 50%,
        #F5F5F5 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.delete-image-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 82, 82, 0.3);
    color: #FF5252;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 10;
}

.delete-image-btn:hover {
    background: #FF5252;
    color: white;
    transform: scale(1.1);
}

/* Terms Modal */
.terms-modal {
    max-width: 90vw;
    max-height: 85vh;
    width: 700px;
    overflow-x: hidden;
    overflow-y: auto;
}

.terms-section {
    margin-bottom: 30px;
}

.terms-section h4 {
    color: var(--primary);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--secondary);
    font-size: 1.1rem;
}

.business-info {
    background: var(--light-bg);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.business-info p {
    margin: 8px 0;
    color: var(--text-primary);
}

.business-info strong {
    color: var(--primary);
    display: inline-block;
    width: 140px;
}

.about-content,
.support-info,
.feature-info {
    background: var(--light-bg);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.about-content p,
.support-info p,
.feature-info p {
    margin: 12px 0;
    color: var(--text-primary);
    line-height: 1.6;
}

.support-info strong,
.feature-info strong {
    color: var(--primary);
    display: inline-block;
    min-width: 100px;
}

.feature-info p {
    padding-left: 30px;
    position: relative;
}

.feature-info p::before {
    content: attr(data-emoji);
    position: absolute;
    left: 0;
}

.terms-content {
    background: #FAFAFA;
    padding: 20px;
    border-radius: 12px;
    max-height: 400px;
    overflow-y: auto;
}

.terms-content h5 {
    color: var(--text-primary);
    margin: 20px 0 10px 0;
    font-size: 1rem;
    font-weight: 600;
}

.terms-content h5:first-child {
    margin-top: 0;
}

.terms-content p {
    color: var(--text-secondary);
    line-height: 1.8;
    margin: 10px 0;
    font-size: 0.9rem;
}

.terms-date {
    margin-top: 30px !important;
    padding-top: 20px;
    border-top: 1px solid #E0E0E0;
    text-align: right;
    font-size: 0.85rem !important;
}

/* About Modal Styles */
.about-modal {
    max-width: 600px;
    max-height: 60vh !important;
    height: 60vh !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 0 !important;
    box-sizing: border-box;
    position: relative;
}

#aboutModal .modal-content {
    max-height: 60vh !important;
    height: 60vh !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
}

/* Ultimate override for mobile */
@media only screen and (max-device-width: 480px) {
    #aboutModal .modal-content.about-modal {
        width: 85vw !important;
        max-width: 85vw !important;
        height: 60vh !important;
        max-height: 60vh !important;
        overflow-x: hidden !important;
        overflow-y: scroll !important;
        -webkit-overflow-scrolling: touch !important;
    }
}

/* Ensure all child elements stay within bounds */
.about-modal * {
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden !important;
}

/* Force modal content to respect overflow */
.modal-content.about-modal {
    overflow-x: hidden !important;
    overflow-y: auto !important;
    max-height: 60vh !important;
    height: 60vh !important;
    display: flex;
    flex-direction: column;
    -webkit-overflow-scrolling: touch;
}

/* Create scrollable content area */
.about-modal-wrapper {
    overflow-x: hidden !important;
    overflow-y: auto !important;
    flex: 1;
    width: 100%;
}

.about-header {
    text-align: center;
    padding: 35px 20px 25px;
    background: linear-gradient(135deg, #FFB6C1 0%, #E6E6FA 100%);
    border-radius: 20px 20px 0 0;
    margin: -30px -30px 20px -30px;
    position: relative;
    overflow: hidden;
    width: calc(100% + 60px);
    max-width: calc(100% + 60px);
    box-sizing: border-box;
}

.about-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: rotate 30s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.about-logo {
    font-size: 48px;
    margin-bottom: 15px;
    animation: sparkle 2s ease-in-out infinite;
    position: relative;
    z-index: 1;
    filter: drop-shadow(0 0 10px rgba(255,255,255,0.5));
}

@keyframes sparkle {
    0%, 100% { 
        transform: scale(1) rotate(0deg); 
        opacity: 1; 
    }
    50% { 
        transform: scale(1.15) rotate(5deg); 
        opacity: 0.9; 
    }
}

.about-header h3 {
    color: white;
    font-size: 24px;
    margin: 0 0 10px 0;
    font-weight: 700;
    position: relative;
    z-index: 1;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.about-tagline {
    color: rgba(255, 255, 255, 0.95);
    font-size: 15px;
    margin: 0;
    position: relative;
    z-index: 1;
    font-weight: 300;
    letter-spacing: 0.5px;
}

.about-intro {
    text-align: center;
    padding: 15px 20px 25px;
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 14px;
    position: relative;
    overflow-x: hidden;
    max-width: 100%;
    box-sizing: border-box;
}

.about-intro::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, transparent, #FFB6C1, transparent);
    border-radius: 2px;
}

.about-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
    margin: 0 10px 30px;
    padding: 0 5px;
    overflow-x: hidden !important;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.feature-card {
    background: white;
    border: 1px solid rgba(255, 182, 193, 0.2);
    border-radius: 16px;
    padding: 18px 12px;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #FFB6C1, #E6E6FA);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.feature-card:hover::before {
    transform: scaleX(1);
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(255, 182, 193, 0.25);
    border-color: rgba(255, 182, 193, 0.4);
}

.feature-icon {
    font-size: 36px;
    margin-bottom: 12px;
    display: inline-block;
    transition: transform 0.3s ease;
}

.feature-card:hover .feature-icon {
    transform: scale(1.1) rotate(5deg);
}

.feature-card h5 {
    color: var(--primary-color);
    font-size: 14px;
    margin: 0 0 8px 0;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.feature-card p {
    color: var(--text-secondary);
    font-size: 12px;
    margin: 0;
    line-height: 1.5;
}

.about-sections {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 0 10px;
    overflow-x: hidden !important;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.info-card {
    background: linear-gradient(135deg, #FFFFFF 0%, #FFF9FA 100%);
    border: 1px solid rgba(255, 182, 193, 0.15);
    border-radius: 18px;
    padding: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
    transition: box-shadow 0.3s ease;
}

.info-card:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.info-card h4 {
    color: var(--primary-color);
    font-size: 17px;
    margin: 0 0 20px 0;
    font-weight: 600;
    padding-bottom: 12px;
    border-bottom: 2px solid rgba(255, 182, 193, 0.3);
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 18px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px;
    background: rgba(255, 182, 193, 0.05);
    border-radius: 10px;
    transition: background 0.2s ease;
}

.info-item:hover {
    background: rgba(255, 182, 193, 0.1);
}

.info-item.full-width {
    grid-column: 1 / -1;
}

.info-label {
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.8;
}

.info-value {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    word-break: break-all;
}

.contact-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: linear-gradient(135deg, #FAFAFA 0%, #F5F5F5 100%);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.contact-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 182, 193, 0.1), transparent);
    transition: left 0.5s ease;
}

.contact-item:hover::before {
    left: 100%;
}

.contact-item:hover {
    background: white;
    box-shadow: 0 4px 12px rgba(255, 182, 193, 0.2);
    transform: translateX(5px);
}

.contact-icon {
    font-size: 28px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.contact-info {
    flex: 1;
}

.contact-label {
    color: var(--text-secondary);
    font-size: 12px;
    margin: 0 0 4px 0;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    opacity: 0.7;
}

.contact-value {
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 600;
    margin: 0;
}

.about-footer {
    text-align: center;
    padding: 25px 20px;
    margin: 35px -30px -30px -30px;
    background: linear-gradient(135deg, #FAFAFA 0%, #F5F5F5 100%);
    border-top: 1px solid rgba(255, 182, 193, 0.15);
    border-radius: 0 0 20px 20px;
    color: var(--text-secondary);
    font-size: 12px;
    letter-spacing: 0.3px;
    width: calc(100% + 60px);
    max-width: calc(100% + 60px);
    box-sizing: border-box;
}

/* Mobile Optimizations */
@media screen and (max-width: 480px) {
    .auth-card {
        padding: 30px 20px;
    }
    
    .messages-container {
        padding: 15px;
    }
    
    .message-bubble {
        max-width: 85%;
    }
    
    .gallery-modal {
        width: 95vw;
        max-height: 85vh;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 5px;
        max-height: calc(85vh - 100px);
        padding: 5px;
    }
    
    .terms-modal {
        width: 95vw;
        max-height: 90vh;
    }
    
    .business-info strong {
        width: 120px;
        font-size: 0.9rem;
    }
    
    .terms-content {
        padding: 15px;
        max-height: 350px;
    }
    
    /* About Modal Mobile Styles */
    #aboutModal .modal-content.about-modal {
        width: 85vw !important;
        max-width: 85vw !important;
        max-height: 60vh !important;
        height: 60vh !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
    }
    
    .about-modal {
        max-height: 60vh !important;
        height: 60vh !important;
    }
    
    .about-modal .modal-close {
        position: absolute;
        top: 8px;
        right: 8px;
        width: 32px;
        height: 32px;
        font-size: 20px;
    }
    
    div.modal-content.about-modal {
        width: 85vw !important;
        max-width: 85vw !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        padding: 15px !important;
        max-height: 60vh !important;
        height: 60vh !important;
    }
    
    .about-header {
        padding: 30px 15px 20px;
        margin: -20px -20px 15px -20px !important;
        width: calc(100% + 40px) !important;
        max-width: calc(100% + 40px) !important;
        box-sizing: border-box;
    }
    
    .about-logo {
        font-size: 42px;
        margin-bottom: 15px;
    }
    
    .about-header h3 {
        font-size: 22px;
        margin-bottom: 8px;
    }
    
    .about-tagline {
        font-size: 13px;
    }
    
    .about-intro {
        padding: 15px 10px 25px;
        font-size: 14px;
    }
    
    .about-features {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        margin: 0 0 20px;
        padding: 0 5px;
        width: 100%;
    }
    
    .feature-card {
        padding: 18px 10px;
    }
    
    .feature-icon {
        font-size: 30px;
        margin-bottom: 8px;
    }
    
    .feature-card h5 {
        font-size: 12px;
        margin-bottom: 6px;
    }
    
    .feature-card p {
        font-size: 11px;
        line-height: 1.3;
    }
    
    .about-sections {
        gap: 15px;
        padding: 0 5px;
        width: 100% !important;
        overflow-x: hidden !important;
        max-width: 100% !important;
    }
    
    /* Force overflow and size on mobile */
    #aboutModal {
        overflow: hidden !important;
    }
    
    #aboutModal > .modal-content {
        overflow-x: hidden !important;
        overflow-y: auto !important;
        width: 85vw !important;
        max-width: 85vw !important;
        height: 60vh !important;
        max-height: 60vh !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    /* All content inside should not overflow */
    #aboutModal * {
        max-width: 100% !important;
    }
    
    .info-card {
        padding: 18px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .info-card h4 {
        font-size: 15px;
        margin-bottom: 15px;
    }
    
    .contact-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .contact-item {
        padding: 12px;
    }
    
    .contact-icon {
        width: 40px;
        height: 40px;
        font-size: 24px;
    }
    
    .contact-label {
        font-size: 11px;
    }
    
    .contact-value {
        font-size: 14px;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .info-item {
        padding: 10px;
    }
    
    .about-footer {
        font-size: 11px;
        padding: 18px 15px;
        margin: 25px -20px -20px -20px !important;
        width: calc(100% + 40px) !important;
        max-width: calc(100% + 40px) !important;
    }
}

/* iOS specific fixes for input field */
@supports (-webkit-touch-callout: none) {
    /* Fix About modal on iOS */
    #aboutModal .modal-content.about-modal {
        max-height: 60vh !important;
        height: 60vh !important;
        width: 85vw !important;
        max-width: 85vw !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        position: relative !important;
    }
    
    #aboutModal {
        overflow: hidden !important;
    }
    
    /* Prevent zoom on input focus (iOS) */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    textarea,
    select {
        font-size: 16px !important;
        -webkit-appearance: none;
    }
    
    /* Fixed input container iOS adjustments */
    .input-container {
        -webkit-backdrop-filter: saturate(180%) blur(20px);
        backdrop-filter: saturate(180%) blur(20px);
    }
}

/* Mobile specific adjustments for fixed input */
@media screen and (max-width: 480px) {
    /* Ensure input container stays at bottom on mobile */
    .input-container {
        max-width: 100%;
        left: 0;
        right: 0;
        transform: none;
        width: 100%;
        position: fixed !important;
        bottom: 0 !important;
        /* iOS specific */
        -webkit-transform: none;
    }
    
    /* Adjust message container padding for fixed input */
    .messages-container {
        padding-bottom: 140px;
    }
    
    /* Prevent horizontal scroll */
    body, html {
        overflow-x: hidden;
        position: relative;
    }
    
    /* Adjust image preview for mobile */
    .image-preview {
        max-height: 100px;
    }
    
    .image-preview img {
        max-height: 80px;
    }
    
    /* Ensure proper z-index stacking */
    .chat-container {
        position: relative;
        z-index: 1;
    }
}

/* Viewport height fixes for mobile browsers */
@supports (-webkit-touch-callout: none) {
    /* iOS Safari specific */
    .chat-container {
        height: -webkit-fill-available;
    }
    
    body {
        height: -webkit-fill-available;
    }
    
    /* Prevent Safari UI from appearing when input is focused */
    .input-container {
        position: fixed !important;
        bottom: 0 !important;
        bottom: constant(safe-area-inset-bottom) !important;
        bottom: env(safe-area-inset-bottom) !important;
    }
    
    #messageInput {
        font-size: 16px !important; /* Prevents zoom on iOS */
        -webkit-text-size-adjust: 100%;
        transform: translateZ(0); /* Enable hardware acceleration */
        -webkit-transform: translateZ(0);
    }
    
    /* Lock viewport when keyboard is shown */
    .input-container:focus-within {
        position: fixed !important;
        width: 100% !important;
    }
}