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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    overflow: hidden;
    background: #000;
    color: #fff;
    height: 100vh;
    position: relative;
}

/* Camera Container */
#camera-container {
    width: 100vw;
    height: 100vh;
    position: relative;
    cursor: pointer;
}

#camera-view {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#capture-canvas {
    display: none;
}

/* Analysis Container with Gradient Blur */
#analysis-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40vh;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.6) 0%,
        rgba(0, 0, 0, 0.3) 30%,
        rgba(0, 0, 0, 0.1) 70%,
        transparent 100%
    );
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(100%);
    pointer-events: none;
}

#analysis-container:not(.hidden) {
    transform: translateY(0);
    pointer-events: auto;
}

#analysis-content {
    padding: 2rem;
    padding-top: 4rem;
    height: 100%;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

#analysis-content::-webkit-scrollbar {
    width: 6px;
}

#analysis-content::-webkit-scrollbar-track {
    background: transparent;
}

#analysis-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

#analysis-text {
    font-size: 1.1rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.95);
    white-space: pre-wrap;
    word-wrap: break-word;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Typing Indicator */
.typing-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 1rem;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

@keyframes typing {
    0%, 60%, 100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    30% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Thumbnails Container - Card Stack */
#thumbnails-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    width: 100px;
    height: 100px;
    cursor: pointer;
    z-index: 10;
    transition: height 0.3s ease;
}

/* Expanded grid becomes scrollable */
#thumbnails-grid.expanded {
    height: calc(100vh - 4rem);
    overflow-y: auto;
    overflow-x: visible;
    padding-top: 1rem; /* Space for count badge */
    padding-bottom: 1rem;
}

/* Adjust count badge position when expanded */
#thumbnails-grid.expanded .card-stack-count {
    top: 2px; /* Move badge inside the container when expanded */
}

/* Hide scrollbar for cleaner look */
#thumbnails-grid.expanded::-webkit-scrollbar {
    width: 6px;
}

#thumbnails-grid.expanded::-webkit-scrollbar-track {
    background: transparent;
}

#thumbnails-grid.expanded::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

/* Hidden header - keeping for count display */
#thumbnails-header {
    display: none;
}

/* Card Stack Container */
#thumbnails-grid {
    position: relative;
    width: 100%;
    height: 100%;
    padding: 0;
    display: block;
    background: transparent;
}

/* Ensure grid doesn't have default styles that interfere */
#thumbnails-grid:not(.expanded) {
    display: block !important;
}

/* Card Stack Count Badge */
.card-stack-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #3b82f6;
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    min-width: 24px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    z-index: 100;
    pointer-events: none;
}

/* Individual Cards */
.thumbnail-item {
    position: absolute;
    width: 90px;
    height: 90px;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 2px solid transparent;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    transform-origin: top right;
    background: #111;
}

/* Stack Effect - All cards start at same position when collapsed */
#thumbnails-grid:not(.expanded) .thumbnail-item {
    position: absolute !important;
    top: 5px !important;
    left: 5px !important;
    right: auto !important;
    bottom: auto !important;
}

/* Stack Effect - New cards go under, with reverse z-index (accounting for count badge) */
#thumbnails-grid:not(.expanded) .thumbnail-item:last-child { z-index: 10; }
#thumbnails-grid:not(.expanded) .thumbnail-item:nth-last-child(2) { z-index: 9; transform: translate(-3px, 3px) rotate(1deg); }
#thumbnails-grid:not(.expanded) .thumbnail-item:nth-last-child(3) { z-index: 8; transform: translate(-6px, 6px) rotate(2deg); }
#thumbnails-grid:not(.expanded) .thumbnail-item:nth-last-child(4) { z-index: 7; transform: translate(-9px, 9px) rotate(3deg); }
#thumbnails-grid:not(.expanded) .thumbnail-item:nth-last-child(5) { z-index: 6; transform: translate(-12px, 12px) rotate(4deg); }
#thumbnails-grid:not(.expanded) .thumbnail-item:nth-last-child(n+6) { z-index: 5; transform: translate(-15px, 15px) rotate(5deg); opacity: 0.9; }

/* Expanded State - Vertical List */
#thumbnails-grid.expanded .thumbnail-item {
    cursor: pointer;
    opacity: 1; /* Reset opacity for all items when expanded */
    position: absolute;
    top: 5px;
    left: 5px;
    right: auto;
    bottom: auto;
    z-index: 1 !important; /* Reset z-index from collapsed state */
    box-shadow: none !important; /* Remove shadow in expanded view */
}

#thumbnails-grid.expanded .thumbnail-item:last-child { 
    transform: translateY(0) !important;
}
#thumbnails-grid.expanded .thumbnail-item:nth-last-child(2) { 
    transform: translateY(100px) !important;
}
#thumbnails-grid.expanded .thumbnail-item:nth-last-child(3) { 
    transform: translateY(200px) !important;
}
#thumbnails-grid.expanded .thumbnail-item:nth-last-child(4) { 
    transform: translateY(300px) !important;
}
#thumbnails-grid.expanded .thumbnail-item:nth-last-child(5) { 
    transform: translateY(400px) !important;
}
#thumbnails-grid.expanded .thumbnail-item:nth-last-child(6) { 
    transform: translateY(500px) !important;
}
#thumbnails-grid.expanded .thumbnail-item:nth-last-child(7) { 
    transform: translateY(600px) !important;
}
#thumbnails-grid.expanded .thumbnail-item:nth-last-child(8) { 
    transform: translateY(700px) !important;
}
#thumbnails-grid.expanded .thumbnail-item:nth-last-child(9) { 
    transform: translateY(800px) !important;
}
/* For 10+ items, calculate position dynamically */
#thumbnails-grid.expanded .thumbnail-item:nth-last-child(10) { 
    transform: translateY(900px) !important;
}
#thumbnails-grid.expanded .thumbnail-item:nth-last-child(11) { 
    transform: translateY(1000px) !important;
}
#thumbnails-grid.expanded .thumbnail-item:nth-last-child(12) { 
    transform: translateY(1100px) !important;
}
#thumbnails-grid.expanded .thumbnail-item:nth-last-child(13) { 
    transform: translateY(1200px) !important;
}
#thumbnails-grid.expanded .thumbnail-item:nth-last-child(14) { 
    transform: translateY(1300px) !important;
}
#thumbnails-grid.expanded .thumbnail-item:nth-last-child(15) { 
    transform: translateY(1400px) !important;
}
/* Continue pattern for more items */
#thumbnails-grid.expanded .thumbnail-item:nth-last-child(n+16) { 
    transform: translateY(1500px) !important;
}

/* Hover Effects */
.thumbnail-item:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
    z-index: 50 !important;
}

#thumbnails-grid:not(.expanded) .thumbnail-item:hover {
    transform: scale(1.05) !important;
}

#thumbnails-grid.expanded .thumbnail-item:hover {
    background: #222; /* Subtle background change on hover */
    border-color: rgba(255, 255, 255, 0.2); /* Subtle border highlight */
}

.thumbnail-item.active {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3), 0 8px 24px rgba(0, 0, 0, 0.6);
}

.thumbnail-item.processing {
    position: relative;
}

.thumbnail-item.processing::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.thumbnail-item.processing::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    z-index: 1;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

.thumbnail-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Active Sessions Indicator */
#active-sessions {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: rgba(59, 130, 246, 0.9);
    backdrop-filter: blur(10px);
    padding: 0.75rem 1.5rem;
    border-radius: 24px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.4);
}

.pulse-indicator {
    width: 8px;
    height: 8px;
    background: #fff;
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(255, 255, 255, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
    }
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    #analysis-container {
        height: 50vh;
    }
    
    #thumbnails-container {
        width: 80px;
        height: 80px;
    }
    
    #thumbnails-grid.expanded {
        height: calc(100vh - 3rem);
    }
    
    .thumbnail-item {
        width: 70px;
        height: 70px;
    }
    
    #thumbnails-grid.expanded .thumbnail-item:nth-last-child(2) { 
        transform: translateY(80px) !important;
    }
    #thumbnails-grid.expanded .thumbnail-item:nth-last-child(3) { 
        transform: translateY(160px) !important;
    }
    #thumbnails-grid.expanded .thumbnail-item:nth-last-child(4) { 
        transform: translateY(240px) !important;
    }
    #thumbnails-grid.expanded .thumbnail-item:nth-last-child(5) { 
        transform: translateY(320px) !important;
    }
    #thumbnails-grid.expanded .thumbnail-item:nth-last-child(6) { 
        transform: translateY(400px) !important;
    }
    #thumbnails-grid.expanded .thumbnail-item:nth-last-child(7) { 
        transform: translateY(480px) !important;
    }
    #thumbnails-grid.expanded .thumbnail-item:nth-last-child(8) { 
        transform: translateY(560px) !important;
    }
    #thumbnails-grid.expanded .thumbnail-item:nth-last-child(9) { 
        transform: translateY(640px) !important;
    }
    #thumbnails-grid.expanded .thumbnail-item:nth-last-child(n+10) { 
        transform: translateY(720px) !important;
    }
} 

/* Connection Status */
.connection-status {
    position: fixed;
    top: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 1000;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.connection-status .status-icon {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #4CAF50;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
}

.connection-status.offline .status-icon {
    background: #f44336;
    box-shadow: 0 0 10px rgba(244, 67, 54, 0.5);
}

/* Notification Container */
.notification-container {
    position: fixed;
    top: 80px;
    left: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.notification {
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 15px 20px;
    border-radius: 10px;
    backdrop-filter: blur(10px);
    animation: slideIn 0.3s ease;
    max-width: 350px;
}

.notification.success {
    border-left: 4px solid #4CAF50;
}

.notification.warning {
    border-left: 4px solid #ff9800;
}

.notification.error {
    border-left: 4px solid #f44336;
}

@keyframes slideIn {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Thumbnail Upload Status */

.thumbnail-item.uploaded::after {
    content: '☁';
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(76, 175, 80, 0.9);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
} 