/* Inside - Mobile-first styles */

:root {
    --header-height: 60px;
    --input-bar-height: 150px;
    --safe-area-top: env(safe-area-inset-top, 0px);
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    background: #f8f8f8;
}

body {
    display: flex;
    flex-direction: column;
    padding-top: var(--safe-area-top);
    padding-bottom: var(--safe-area-bottom);
}

/* Sticky Header */
.header-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding-top: var(--safe-area-top) !important;
    background: #fff !important;
    border-bottom: 1px solid #e5e5e5;
}

/* Main scrollable content */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding-top: calc(var(--header-height) + var(--safe-area-top));
    padding-bottom: calc(var(--input-bar-height) + var(--safe-area-bottom) + 20px);
}

/* Fixed Bottom Input Bar */
.input-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding-bottom: calc(12px + var(--safe-area-bottom)) !important;
    background: #fff !important;
    border-top: 1px solid #e5e5e5;
}

/* Add button (large, centered) */
.add-btn-large {
    width: 60px !important;
    height: 60px !important;
    min-width: 60px !important;
    min-height: 60px !important;
    border-radius: 50% !important;
    background-color: #1e87f0 !important;
    color: #fff !important;
    border: none !important;
    cursor: pointer;
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.add-btn-large:hover {
    background-color: #0f7ae5 !important;
}

.add-btn-large:active {
    background-color: #0d6ecc !important;
}

/* Chat input */
#chatInput {
    flex: 1;
    min-height: 44px;
    border-radius: 22px;
    font-size: 16px;
}

/* Send button */
#sendBtn {
    min-width: 44px;
    min-height: 44px;
    border-radius: 50%;
    background: #1e87f0 !important;
    color: #fff !important;
}

/* Chat Messages */
.chat-messages {
    padding: 8px 0;
}

.chat-message {
    margin-bottom: 12px;
    max-width: 85%;
}

.chat-message.user {
    margin-left: auto;
}

.chat-message.user .message-bubble {
    background: #1e87f0;
    color: #fff;
    border-radius: 18px 18px 4px 18px;
}

.chat-message.assistant .message-bubble {
    background: #fff;
    color: #333;
    border-radius: 18px 18px 18px 4px;
    border: 1px solid #e5e5e5;
}

.message-bubble {
    padding: 10px 14px;
    word-wrap: break-word;
}

/* Chat images */
.chat-image {
    max-width: 100%;
    max-height: 200px;
    border-radius: 8px;
    display: block;
    margin-bottom: 8px;
}

/* Processing time */
.processing-time {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
    padding-left: 4px;
}

/* Boxes List */
.boxes-list {
    max-height: 200px;
    overflow-y: auto;
}

.box-item {
    padding: 8px 12px;
    margin-bottom: 4px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e5e5e5;
}

.box-item summary {
    cursor: pointer;
    font-weight: 500;
}

.box-item ul {
    margin: 8px 0 0 16px;
    padding: 0;
}

.box-item li {
    color: #666;
    font-size: 14px;
}

/* Image Panel */
.image-panel {
    position: fixed;
    bottom: calc(var(--input-bar-height) + var(--safe-area-bottom));
    left: 0;
    right: 0;
    z-index: 999;
    border-top: 1px solid #e5e5e5;
    border-radius: 16px 16px 0 0;
    max-height: 50vh;
    overflow-y: auto;
    background: #f0f0f0 !important;
}

.image-preview {
    max-width: 100%;
    max-height: 150px;
    border-radius: 8px;
}

/* Icon button small variant */
.uk-icon-button-small {
    width: 30px;
    height: 30px;
    min-width: 30px;
}

/* Typing indicator animation */
.typing-dots {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 0;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: typing-bounce 1.4s infinite ease-in-out both;
}

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

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

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

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

/* Loading state */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

/* Accordion tweaks */
.uk-accordion-title {
    padding: 10px 0;
}

.uk-accordion-content {
    margin-top: 0;
}

/* Touch-friendly tap targets (inputs only, not icon buttons) */
input, select, textarea {
    min-height: 44px;
}

input, select, textarea {
    font-size: 16px !important; /* Prevent iOS zoom */
}

/* Hide scrollbar but keep functionality */
.chat-messages::-webkit-scrollbar,
.boxes-list::-webkit-scrollbar {
    width: 4px;
}

.chat-messages::-webkit-scrollbar-thumb,
.boxes-list::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 2px;
}

/* Navigation icon */
.nav-icon {
    width: 72px !important;
    height: 72px !important;
    max-width: 72px;
    max-height: 72px;
    cursor: pointer;
}

@media (min-width: 640px) {
    .nav-icon {
        width: 96px !important;
        height: 96px !important;
        max-width: 96px;
        max-height: 96px;
    }
}

/* Constrain images in main content */
.main-content img {
    max-width: 200px;
    max-height: 200px;
}

/* Boxes page styles */
.boxes-page {
    padding-top: calc(var(--header-height) + var(--safe-area-top) + 16px);
    padding-bottom: 20px;
}

.boxes-list-full {
    padding: 0;
}

.boxes-list-full .box-item {
    margin-bottom: 8px;
}

.boxes-list-full .empty-state {
    padding: 60px 20px;
}

/* Box slideshow */
.box-slide {
    padding: 0 40px;
}

.box-slide .uk-card {
    height: calc(100vh - var(--header-height) - var(--safe-area-top) - 100px);
    overflow-y: auto;
    box-shadow: none;
    border: none;
}

.box-slide .uk-list {
    margin: 0;
}

/* Slideshow navigation dots - blue circles */
.uk-dotnav > * > * {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #1e87f0;
    background: transparent;
}

.uk-dotnav > .uk-active > * {
    background: #1e87f0;
    border-color: #1e87f0;
}

/* Slideshow arrows */
.uk-slidenav {
    color: #1e87f0;
}

/* Full height slideshow */
.boxes-page .uk-slideshow-items {
    min-height: calc(100vh - var(--header-height) - var(--safe-area-top) - 100px);
}

/* Box thumbnail */
.box-thumbnail {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.box-thumbnail:hover {
    opacity: 0.85;
}

/* Small thumbnails for lightbox gallery */
.box-thumbnail-small {
    width: 100%;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.box-thumbnail-small:hover {
    opacity: 0.8;
}

/* Fullscreen image overlay */
.fullscreen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.fullscreen-image {
    max-width: 95%;
    max-height: 95%;
    object-fit: contain;
    border-radius: 8px;
}

.fullscreen-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    color: white;
    cursor: pointer;
}

/* Interactive suggestion buttons */
.suggestion-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.suggestion-btn {
    text-align: left;
    white-space: normal;
    height: auto;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.4;
    background: #f0f7ff !important;
    border: 1px solid #1e87f0 !important;
    color: #1e87f0 !important;
    transition: all 0.2s ease;
}

.suggestion-btn:hover:not(:disabled) {
    background: #1e87f0 !important;
    color: #fff !important;
}

.suggestion-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
