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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f5f5;
    height: 100vh;
    overflow: hidden;
    display: flex;
}

/* Left Chat Panel */
.chat-panel {
    width: 350px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid rgba(229, 229, 229, 0.3);
    display: flex;
    flex-direction: column;
    height: 100vh;
    z-index: 10;
    position: relative;
    transition: all 0.3s ease;
    resize: horizontal;
    overflow: auto;
    min-width: 280px;
    max-width: 600px;
}

.chat-panel.floating {
    position: fixed;
    top: 100px;
    left: 50px;
    width: 380px;
    height: 500px;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    border: 1px solid rgba(229, 229, 229, 0.3);
    resize: both;
    overflow: auto;
    min-width: 300px;
    min-height: 400px;
    max-width: 600px;
    max-height: 80vh;
}

.drag-handle {
    display: none;
    padding: 8px;
    text-align: right;
    cursor: grab;
    background: #f8f9fa;
    border-bottom: 1px solid #e5e5e5;
    color: #666;
    font-size: 16px;
    transition: all 0.2s;
}

.drag-handle:hover {
    background: #f0f0f0;
    color: #333;
}

.drag-handle.dragging {
    cursor: grabbing;
    background: #e0e0e0;
}

.chat-header {
    padding: 15px 20px;
    border-bottom: 1px solid rgba(240, 240, 240, 0.3);
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.1);
}

.chat-icon {
    width: 32px;
    height: 32px;
    background: #000;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    font-weight: bold;
}

.chat-title {
    font-size: 16px;
    font-weight: 500;
    color: #333;
}

.session-id {
    font-size: 12px;
    color: #666;
    margin-left: auto;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #999;
    text-align: center;
    padding: 40px 20px;
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 8px;
    color: #666;
}

.empty-state p {
    font-size: 14px;
    line-height: 1.5;
    max-width: 280px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    scrollbar-width: thin;
    scrollbar-color: rgba(221, 221, 221, 0.5) rgba(248, 249, 250, 0.3);
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: rgba(248, 249, 250, 0.3);
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(221, 221, 221, 0.5);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(187, 187, 187, 0.7);
}

.message {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.message-content {
    background: rgba(230, 235, 240, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(200, 210, 220, 0.3);
    padding: 15px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    position: relative;
}

.copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.8);
    border: none;
    border-radius: 4px;
    padding: 4px 6px;
    cursor: pointer;
    font-size: 12px;
    color: #666;
    opacity: 0;
    transition: all 0.2s;
}

.message-content:hover .copy-btn {
    opacity: 1;
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 1);
    color: #333;
}

.copy-btn.copied {
    color: #22c55e;
}

.message-images {
    margin-top: 10px;
}

.message-image-stack {
    position: relative;
    width: 80px;
    height: 80px;
    cursor: pointer;
    display: inline-block;
}

.message-image-stack img {
    position: absolute;
    width: 70px;
    height: 70px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s;
}

.message-image-stack img:nth-child(1) { transform: rotate(-3deg) translate(0px, 0px); z-index: 4; }
.message-image-stack img:nth-child(2) { transform: rotate(2deg) translate(6px, 2px); z-index: 3; }
.message-image-stack img:nth-child(3) { transform: rotate(-1deg) translate(12px, 4px); z-index: 2; }
.message-image-stack img:nth-child(n+4) { display: none; }

.message-more-card {
    position: absolute;
    width: 70px;
    height: 70px;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 8px;
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    font-weight: bold;
    transform: rotate(1deg) translate(18px, 6px);
    z-index: 1;
}

.message-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #666;
}

.avatar {
    width: 20px;
    height: 20px;
    background: #000;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 10px;
}

.chat-input {
    padding: 20px;
    border-top: 1px solid rgba(240, 240, 240, 0.3);
    background: rgba(255, 255, 255, 0.1);
}

.input-container {
    position: relative;
    display: flex;
    align-items: center;
    background: rgba(248, 249, 250, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 24px;
    padding: 12px 16px;
    gap: 12px;
}

.input-field {
    flex: 1;
    border: none;
    background: none;
    outline: none;
    font-size: 14px;
    color: #666;
    resize: none;
    min-height: 20px;
    max-height: 120px;
    font-family: inherit;
}

.input-icons {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #999;
    flex-shrink: 0;
}

.input-icons i {
    cursor: pointer;
    transition: color 0.2s;
    padding: 6px;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.input-icons i:hover {
    color: #333;
}

.send-btn {
    background: #ddd;
    color: #666;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    flex-shrink: 0;
}

.send-btn:hover {
    background: #000;
    color: white;
    transform: scale(1.1);
}

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

.send-btn.disabled {
    background: #f0f0f0;
    color: #ccc;
    cursor: not-allowed;
    transform: none;
}

.send-btn.disabled:hover {
    background: #f0f0f0;
    color: #ccc;
    transform: none;
}

#fileInput {
    display: none;
}

.file-preview {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    overflow-x: auto;
    padding: 4px 0;
    scrollbar-width: thin;
}

.file-preview::-webkit-scrollbar {
    height: 4px;
}

.file-preview::-webkit-scrollbar-track {
    background: rgba(248, 249, 250, 0.3);
}

.file-preview::-webkit-scrollbar-thumb {
    background: rgba(221, 221, 221, 0.5);
    border-radius: 2px;
}

.file-tag {
    background: #e3f2fd;
    color: #1976d2;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    flex-shrink: 0;
}

.file-tag .remove {
    cursor: pointer;
    font-weight: bold;
}

.image-preview {
    position: relative;
    display: inline-block;
    margin-right: 8px;
}

.image-stack {
    position: relative;
    width: 60px;
    height: 60px;
    cursor: pointer;
}

.image-stack img {
    position: absolute;
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s;
}

.image-stack img:nth-child(1) { transform: rotate(-5deg) translate(0px, 0px); z-index: 3; }
.image-stack img:nth-child(2) { transform: rotate(2deg) translate(8px, 2px); z-index: 2; }
.image-stack img:nth-child(3) { transform: rotate(-2deg) translate(16px, 4px); z-index: 1; }
.image-stack img:nth-child(n+4) { display: none; }

.image-count {
    position: absolute;
    bottom: -5px;
    right: -5px;
    background: #000;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.95);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.modal.show {
    display: flex;
}

.modal-content {
    max-width: 90vw;
    max-height: 80vh;
    position: relative;
    cursor: default;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(229, 229, 229, 0.3);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    padding: 8px;
    min-width: 220px;
    display: none;
    z-index: 100;
}

.dropdown.show {
    display: block;
}

.dropdown-item {
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 8px;
    font-size: 14px;
    color: #333;
    transition: background 0.2s;
}

.dropdown-item:hover {
    background: rgba(248, 249, 250, 0.8);
}

.instruction-input-container {
    padding: 8px;
    border-top: 1px solid rgba(229, 229, 229, 0.3);
    margin-top: 4px;
}

.instruction-input {
    width: 100%;
    padding: 8px;
    border: 1px solid rgba(221, 221, 221, 0.5);
    border-radius: 8px;
    font-size: 13px;
    background: rgba(255, 255, 255, 0.8);
    outline: none;
}

.instruction-buttons {
    margin-top: 8px;
    display: flex;
    gap: 8px;
}

.instruction-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.instruction-btn.primary {
    background: #000;
    color: white;
}

.instruction-btn.secondary {
    background: rgba(204, 204, 204, 0.8);
    color: #666;
}

.emoji-picker {
    position: absolute;
    bottom: 100%;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(229, 229, 229, 0.3);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    padding: 12px;
    width: 260px;
    max-width: calc(100vw - 40px);
    display: none;
    z-index: 100;
}

.emoji-picker.show {
    display: block;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    max-height: 180px;
    overflow-y: auto;
}

.emoji-item {
    padding: 6px;
    cursor: pointer;
    border-radius: 6px;
    text-align: center;
    font-size: 16px;
    transition: background 0.2s;
}

.emoji-item:hover {
    background: rgba(248, 249, 250, 0.8);
}

.instructions-list {
    margin-top: 8px;
}

.instruction-tag {
    background: #fff3cd;
    color: #856404;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 2px;
}

.instruction-tag .remove {
    cursor: pointer;
    font-weight: bold;
}

.modal-close {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(0,0,0,0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 1001;
}

.modal-close:hover {
    background: rgba(0,0,0,0.9);
    transform: scale(1.1);
}

.modal-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 1001;
}

.modal-nav:hover {
    background: rgba(0,0,0,0.9);
    transform: translateY(-50%) scale(1.1);
}

.modal-prev { left: 20px; }
.modal-next { right: 20px; }

.limit-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1001;
    align-items: center;
    justify-content: center;
}

.limit-modal.show {
    display: flex;
}

.limit-modal-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(229, 229, 229, 0.3);
    border-radius: 12px;
    padding: 24px;
    max-width: 320px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
}

.limit-modal h3 {
    font-size: 16px;
    font-weight: 500;
    color: #333;
    margin-bottom: 8px;
}

.limit-modal p {
    font-size: 14px;
    color: #666;
    margin-bottom: 20px;
    line-height: 1.4;
}

.limit-modal-btn {
    background: #000;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.limit-modal-btn:hover {
    background: #333;
}

.share-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1001;
    align-items: center;
    justify-content: center;
}

.share-modal.show {
    display: flex;
}

.share-modal-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(229, 229, 229, 0.3);
    border-radius: 12px;
    padding: 24px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
}

.share-modal h3 {
    font-size: 16px;
    font-weight: 500;
    color: #333;
    margin-bottom: 12px;
}

.share-url {
    background: rgba(248, 249, 250, 0.8);
    border: 1px solid rgba(221, 221, 221, 0.5);
    border-radius: 8px;
    padding: 12px;
    font-size: 13px;
    color: #666;
    word-break: break-all;
    margin-bottom: 16px;
    font-family: monospace;
}

.share-modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.share-modal-btn {
    background: linear-gradient(135deg, #000 0%, #333 100%);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 8px;
}

.share-modal-btn:hover {
    background: linear-gradient(135deg, #333 0%, #555 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.share-modal-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.share-modal-btn.secondary {
    background: rgba(248, 249, 250, 0.9);
    color: #666;
    border: 1px solid rgba(221, 221, 221, 0.5);
}

.share-modal-btn.secondary:hover {
    background: rgba(240, 240, 240, 0.9);
    color: #333;
}

.share-modal-btn.copied {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%) !important;
    transform: scale(0.98);
    box-shadow: 0 2px 12px rgba(34, 197, 94, 0.3);
}

.share-modal-btn.copied i {
    animation: copyPulse 0.6s ease;
}

@keyframes copyPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* Right Canvas Area */
.canvas-area {
    flex: 1;
    background: #f5f5f5;
    position: relative;
    overflow: hidden;
}

.canvas-header {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
    z-index: 5;
}

.header-btn {
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 12px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.header-btn:hover {
    background: #f8f9fa;
}

.canvas-container {
    width: 100%;
    height: 100vh;
    position: relative;
    cursor: grab;
}

.canvas-container.dragging {
    cursor: grabbing;
}

.canvas-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transform-origin: center;
    transition: transform 0.1s ease-out;
}



/* Zoom Controls */
.zoom-controls {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    overflow: hidden;
}

.zoom-btn {
    background: white;
    border: none;
    padding: 10px 15px;
    cursor: pointer;
    font-size: 16px;
    color: #666;
    transition: all 0.2s;
}

.zoom-btn:hover {
    background: #f8f9fa;
}

.zoom-btn:not(:last-child) {
    border-right: 1px solid #e5e5e5;
}

.zoom-level {
    padding: 10px 15px;
    font-size: 12px;
    color: #666;
    background: #f8f9fa;
    min-width: 60px;
    text-align: center;
}

/* Responsive */
@media (max-width: 1024px) {
    .chat-panel {
        width: 300px;
    }
}

@media (max-width: 768px) {
    html, body {
        margin: 0;
        padding: 0;
        width: 100%;
        height: 100vh;
        height: 100dvh;
        overflow: hidden;
    }

    .chat-panel {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        border: none;
        border-radius: 0;
        resize: none;
        min-width: unset;
        max-width: unset;
        margin: 0;
        padding: 0;
    }

    .chat-panel.floating {
        display: none;
    }

    .drag-handle {
        display: none !important;
    }

    .canvas-area {
        display: none;
    }

    .emoji-picker {
        width: 240px;
    }

    .emoji-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

@media (max-width: 480px) {
    .chat-panel {
        height: 50%;
    }

    .canvas-area {
        height: 50%;
    }

    .poster-mockup {
        width: 200px;
        height: 280px;
        padding: 15px;
    }

    .phone-mockup {
        width: 80px;
        height: 140px;
    }

    .phone-screen {
        width: 68px;
        height: 124px;
        margin: 6px;
    }
}

/* Desktop only - show drag handle */
@media (min-width: 769px) {
    .drag-handle {
        display: block;
    }
}
.user-profile-container {
    position: relative;
    margin-left: 10px;
}

.profile-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: all 0.2s;
}

.profile-avatar:hover {
    border-color: rgba(255, 255, 255, 0.6);
    transform: scale(1.05);
}

.profile-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(229, 229, 229, 0.3);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    padding: 16px;
    min-width: 240px;
    display: none;
    z-index: 1000;
}

.profile-dropdown.show {
    display: block;
}

.profile-info {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(229, 229, 229, 0.3);
}

.profile-info img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.profile-details {
    flex: 1;
}

.profile-name {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 2px;
}

.profile-email {
    font-size: 12px;
    color: #666;
    margin-bottom: 2px;
}

.profile-uid {
    font-size: 10px;
    color: #999;
    font-family: monospace;
}

.profile-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.profile-action {
    background: none;
    border: none;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    text-align: left;
}

.profile-action:hover {
    background: rgba(248, 249, 250, 0.8);
}

[data-theme="dark"] .profile-dropdown {
    background: rgba(25, 25, 25, 0.95);
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .profile-info {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .profile-name {
    color: #e5e5e5;
}

[data-theme="dark"] .profile-email {
    color: #888;
}

[data-theme="dark"] .profile-uid {
    color: #666;
}

[data-theme="dark"] .profile-action {
    color: #e5e5e5;
}

[data-theme="dark"] .profile-action:hover {
    background: rgba(35, 35, 35, 0.8);
}