@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

body {
    font-family: 'Inter', sans-serif;
    background-color: #1a202c; /* Darker background for the body */
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    overflow: auto; /* Allow scrolling if content is too large */
    color: #e2e8f0; /* Light text color for better contrast */
}

/* App container background */
.app-container {
    background-color: #2d3748; /* Darker background for the main app container */
    color: #e2e8f0; /* Light text color */
}

/* Container for the canvas and template image */
.canvas-container {
    position: relative;
    width: 100%;
    max-width: 1600px; /* Increased max width for a bigger canvas */
    aspect-ratio: 16 / 9; /* Maintain aspect ratio */
    background-color: #3b455b; /* Darker background for canvas area */
    border-radius: 12px;
    overflow: hidden; /* Hide anything outside the rounded corners */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4); /* Darker shadow */
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px; /* Space below the canvas */
}

.canvas-container canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Ensure template image fills its space */
.canvas-container img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Ensure the image fits within the container without cropping */
    background-color: #2a313d; /* Fallback background for images in dark mode */
    border-radius: 12px; /* Match container border-radius */
    pointer-events: none; /* Make image non-interactive to allow canvas interaction */
}

/* Sticker styles */
.sticker-item {
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
    border-radius: 8px;
    cursor: grab;
    transition: transform 0.1s ease-out;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); /* Slightly darker shadow */
    background-color: #4a5568; /* Default background for stickers */
    color: #cbd5e0; /* Lighter text for stickers */
}

.sticker-item:active {
    cursor: grabbing;
    transform: scale(1.05);
}

.dropped-sticker {
    position: absolute;
    cursor: grab;
    border: 2px dashed rgba(0, 255, 0, 0.8); /* Solid white border for stronger contrast */
    box-sizing: border-box; /* Include padding/border in element's total width/height */
    z-index: 10; /* Ensure stickers are above drawing canvas */
    background-color: rgba(0, 0, 0, 0.5); /* Darker overlay */
}

.dropped-sticker:active {
    cursor: grabbing;
}

/* Custom range slider styling */
input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 8px;
    background: #4a5568; /* Darker track */
    outline: none;
    opacity: 0.7;
    transition: opacity .2s;
    border-radius: 5px;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: #818cf8; /* Lighter purple thumb */
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #818cf8;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

/* Styling for the info message box */
.info-message-box {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(255, 255, 255, 0.15); /* Light translucent background */
    color: white;
    padding: 15px 25px;
    border-radius: 10px;
    font-size: 1rem;
    z-index: 1000;
    display: none; /* Hidden by default */
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);
    text-align: center;
}

/* Confirmation Modal Styles */
.confirmation-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8); /* Darker overlay */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1001;
    display: none; /* Hidden by default */
}

.confirmation-modal-content {
    background-color: #2d3748; /* Dark background for modal content */
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    text-align: center;
    max-width: 400px;
    width: 90%;
    color: #e2e8f0; /* Light text for modal */
}

.confirmation-modal-content h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: #e2e8f0; /* Light text for heading */
}

.confirmation-modal-content .button-group {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

.confirmation-modal-content .button-group button {
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s ease;
    color: white; /* Default text color for buttons */
}

.confirmation-modal-content .button-group button.confirm {
    background-color: #ef4444; /* Red-600 */
    border: none;
}

.confirmation-modal-content .button-group button.confirm:hover {
    background-color: #dc2626; /* Red-700 */
}

.confirmation-modal-content .button-group button.cancel {
    background-color: #4a5568; /* Darker gray for cancel button */
    color: #e2e8f0; /* Light text for cancel */
    border: 1px solid #64748b; /* Slate-500 border */
}

.confirmation-modal-content .button-group button.cancel:hover {
    background-color: #64748b; /* Slate-500 */
}

/* Semi-opaque floor controls */
.floor-controls-overlay {
    background-color: rgba(45, 55, 72, 0.7); /* bg-gray-800 with 70% opacity */
    backdrop-filter: blur(5px); /* Optional: adds a blur effect behind the element */
}

/* Symmetrical floorControls container height setting to allocate space */
#floorControls {
    position: relative;
    width: 100%;
    height: 48px;
}

/* View Mode Selector button aesthetics */
#viewModeToggleContainer button {
    outline: none;
    cursor: pointer;
    border: none;
}
#viewModeToggleContainer button.active {
    background-color: #6366f1; /* Indigo-600 */
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(99, 102, 241, 0.4);
}
#viewModeToggleContainer button:not(.active) {
    background-color: rgba(74, 85, 104, 0.5); /* Semi-transparent gray */
    color: #cbd5e0; /* Gray-300 */
}
#viewModeToggleContainer button:not(.active):hover {
    background-color: rgba(74, 85, 104, 0.8);
    color: #ffffff;
}

/* ===================================================================
   MULTIPLAYER UI STYLES
   =================================================================== */

/* --- New Auth Modal Portal --- */
#auth-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(17, 24, 39, 0.95);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease-out;
}

#auth-modal-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}

#auth-modal-overlay.hidden {
    display: none;
}

#auth-card {
    background: #1f2937;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.5);
    width: 100%;
    max-width: 450px;
    text-align: center;
    border: 1px solid #374151;
    font-family: sans-serif;
    position: relative;
    box-sizing: border-box;
}

.auth-icon-container {
    margin-bottom: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
}

#auth-card h2 {
    color: #ffffff;
    margin-top: 0;
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
    font-weight: 700;
}

.auth-subtitle {
    color: #9ca3af;
    margin-top: 0;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    line-height: 1.4;
}

#username-input {
    width: 100%;
    padding: 0.75rem;
    background: #111827;
    border: 1px solid #4b5563;
    border-radius: 6px;
    color: #fff;
    margin-bottom: 1.25rem;
    box-sizing: border-box;
    font-size: 1rem;
    outline: none;
    text-align: center;
    transition: border-color 0.2s;
}

#username-input:focus {
    border-color: #0d9488;
}

#join-btn {
    width: 100%;
    padding: 0.75rem;
    background: #0d9488;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s;
    font-size: 1rem;
}

#join-btn:hover:not(:disabled) {
    background: #0f766e;
}

#join-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.auth-status-grid {
    color: #6b7280;
    font-size: 0.8rem;
    margin-top: 1.5rem;
    border-top: 1px solid #374151;
    padding-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    text-align: center;
}

.auth-status-row {
    width: 100%;
    word-break: break-all;
}

.auth-ws-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    vertical-align: middle;
}

.auth-ws-dot.offline {
    background: #ef4444;
}

.auth-ws-dot.connecting {
    background: #eab308;
    box-shadow: 0 0 6px rgba(234, 179, 8, 0.5);
    animation: dotPulse 1s infinite;
}

.auth-ws-dot.online {
    background: #22c55e;
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
    animation: dotPulse 2s infinite;
}

/* --- Connection Status Bar --- */
.connection-bar {
    width: 100%;
    max-width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    margin-bottom: 12px;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(51, 65, 85, 0.5);
    border-radius: 12px;
    font-size: 0.8rem;
    gap: 12px;
    flex-wrap: wrap;
}

.connection-bar-left,
.connection-bar-center,
.connection-bar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.connection-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    transition: background-color 0.3s;
}

.connection-dot.connected {
    background-color: #22c55e;
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
    animation: dotPulse 2s infinite;
}

.connection-dot.reconnecting {
    background-color: #eab308;
    box-shadow: 0 0 8px rgba(234, 179, 8, 0.6);
    animation: dotPulse 1s infinite;
}

.connection-dot.disconnected {
    background-color: #ef4444;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}

@keyframes dotPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.connection-status-text {
    color: #94a3b8;
    font-weight: 500;
}

.room-label,
.users-label {
    color: #64748b;
    font-weight: 600;
    font-size: 0.65rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.room-code-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 6px;
    padding: 4px 10px;
    color: #a5b4fc;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.2s;
}

.room-code-btn:hover {
    background: rgba(99, 102, 241, 0.25);
    border-color: rgba(99, 102, 241, 0.5);
}

.room-code-btn svg {
    opacity: 0.6;
}

.user-list-container {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.user-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.75rem;
    color: #cbd5e1;
    font-weight: 500;
    white-space: nowrap;
}

.user-pill-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* --- Remote Cursor Elements --- */
.remote-cursor {
    position: absolute;
    pointer-events: none;
    z-index: 9998;
    transition: left 60ms linear, top 60ms linear;
    will-change: left, top;
}

.remote-cursor-pointer {
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 12px solid currentColor;
    transform: rotate(-30deg);
    transform-origin: top left;
}

.remote-cursor-label {
    position: absolute;
    left: 14px;
    top: 8px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    letter-spacing: 0.3px;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.remote-cursor.hidden {
    opacity: 0;
    transition: opacity 0.5s;
}

/* --- Action Toast --- */
.action-toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
    z-index: 1000;
    pointer-events: none;
    max-width: 280px;
}

.action-toast {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(8px);
    border-radius: 8px;
    border-left: 3px solid #6366f1;
    font-size: 0.78rem;
    color: #e2e8f0;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    animation: toastSlideIn 0.3s ease-out, toastFadeOut 0.4s ease-in 1.2s forwards;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@keyframes toastSlideIn {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

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

/* --- Selected sticker highlight for keyboard placement --- */
.selected-sticker-in-tray {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

/* --- Elegant Initial Loading Overlay --- */
.asset-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #0f172a; /* Slate 900 background */
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease;
    opacity: 1;
}

.asset-loading-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}

.asset-loading-overlay.hidden {
    display: none;
}

.asset-loading-content {
    text-align: center;
    color: #f8fafc;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    max-width: 320px;
    width: 90%;
}

.asset-loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(13, 148, 136, 0.1);
    border-top: 3px solid #0d9488; /* Teal accent */
    border-radius: 50%;
    margin: 0 auto 1.5rem;
    animation: spin 1s linear infinite;
}

.asset-loading-text {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    letter-spacing: 0.05em;
    color: #e2e8f0;
}

.asset-loading-progress-container {
    width: 100%;
    height: 6px;
    background: #1e293b;
    border-radius: 9999px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.asset-loading-progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #0d9488, #14b8a6);
    border-radius: 9999px;
    transition: width 0.1s ease-out;
}

.asset-loading-status {
    font-size: 0.8rem;
    color: #64748b;
    font-weight: 500;
}

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

/* ===================================================================
   CANVAS TEXT TOOL INPUT OVERLAY
   =================================================================== */
.temp-canvas-text-input {
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

