/*
    Project Name: Real-Time Whiteboard
    Founded by: Molla Samser
    Designer & Tester: Rima Khatun
    Website: https://rskworld.in
    Email: hello@rskworld.in, info@rskworld.com
    Phone: +91 93305 39277
    Address: Nutanhat, Mongolkote, Purba Burdwan, West Bengal, India, 713147
    Year: 2026
    Copyright: © 2026 RSK World. All rights reserved.
*/
:root {
    --bg-color: #0d1117;
    --card-bg: rgba(22, 27, 34, 0.7);
    --primary-color: #00d1ff;
    --primary-hover: #00b8e6;
    --secondary-color: #21262d;
    --text-color: #c9d1d9;
    --text-muted: #8b949e;
    --border-color: rgba(48, 54, 61, 0.8);
    --danger-color: #f85149;
    --glass-blur: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.light-theme {
    --bg-color: #f0f2f5;
    --card-bg: rgba(255, 255, 255, 0.8);
    --primary-color: #007bff;
    --primary-hover: #0056b3;
    --secondary-color: #e4e6eb;
    --text-color: #1c1e21;
    --text-muted: #65676b;
    --border-color: rgba(0, 0, 0, 0.1);
}

/* Canvas Area Backgrounds */
.canvas-area.dots {
    background-image: radial-gradient(rgba(139, 148, 158, 0.2) 1.5px, transparent 1.5px);
    background-size: 40px 40px;
}

.canvas-area.grid {
    background-image:
        linear-gradient(rgba(139, 148, 158, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(139, 148, 158, 0.1) 1px, transparent 1px);
    background-size: 40px 40px;
}

.canvas-area.ruled {
    background-image: linear-gradient(rgba(139, 148, 158, 0.15) 1px, transparent 1px);
    background-size: 100% 40px;
}

.canvas-area.none {
    background-image: none;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.app-header {
    height: 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(var(--glass-blur));
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.text-info {
    color: var(--primary-color);
}

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

.btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary-color);
    color: #000;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 209, 255, 0.3);
}

.btn-secondary {
    background: var(--secondary-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: #30363d;
    border-color: #8b949e;
}

.main-container {
    flex: 1;
    display: flex;
    position: relative;
    overflow: hidden;
}

.toolbar {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 64px;
    max-height: 80vh;
    padding: 16px 8px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    backdrop-filter: blur(var(--glass-blur));
    z-index: 50;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    overflow-y: auto;
    scrollbar-width: none; /* Firefox */
}

.toolbar::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

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

.tool-btn {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: var(--transition);
}

.tool-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-color);
}

.tool-btn.active {
    background: rgba(0, 209, 255, 0.1);
    color: var(--primary-color);
    border-color: rgba(0, 209, 255, 0.3);
}

.tool-btn.danger:hover {
    color: var(--danger-color);
    background: rgba(248, 81, 73, 0.1);
}

.divider {
    width: 80%;
    height: 1px;
    background: var(--border-color);
}

.setting-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.setting-group label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.color-picker {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--border-color);
}

#colorPicker {
    width: 150%;
    height: 150%;
    margin: -25%;
    cursor: pointer;
}

#sizeRange {
    -webkit-appearance: none;
    appearance: none;
    background: var(--border-color);
    border-radius: 2px;
}

#sizeRange::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
}

.canvas-area {
    flex: 1;
    background-image:
        radial-gradient(circle, #21262d 1px, transparent 1px);
    background-size: 30px 30px;
}

#whiteboard {
    display: block;
    cursor: crosshair;
}

.app-footer {
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.toast {
    position: fixed;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 12px 24px;
    background: var(--secondary-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-color);
    font-weight: 500;
    opacity: 0;
    transition: var(--transition);
    z-index: 1000;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Landing Page */
.landing-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, #1a1c2c 0%, #0d1117 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.landing-card {
    width: 100%;
    max-width: 450px;
    padding: 3rem;
    border-radius: 24px;
    text-align: center;
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.landing-logo {
    margin-bottom: 2.5rem;
}

.landing-logo i {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    filter: drop-shadow(0 0 15px var(--primary-color));
}

.landing-logo h1 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    letter-spacing: -1px;
}

.landing-logo p {
    color: var(--text-muted);
    font-size: 1rem;
}

.join-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.input-group {
    text-align: left;
}

.input-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}

.input-group input {
    width: 100%;
    padding: 14px 18px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-color);
    font-size: 1rem;
    transition: var(--transition);
}

.input-group input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(0, 209, 255, 0.1);
    outline: none;
}

.btn-large {
    padding: 16px;
    font-size: 1rem;
    justify-content: center;
    margin-top: 1rem;
}

.landing-footer {
    margin-top: 2.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.animate-in {
    animation: slideUp 0.6s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

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

/* Glassmorphism utility */
.glass {
    background: var(--card-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
}

.hidden {
    display: none !important;
}

/* Transitions */
#app.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Cursors */
#cursors-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 40;
}

.cursor {
    position: absolute;
    width: 20px;
    height: 20px;
    pointer-events: none;
    z-index: 1000;
    will-change: transform;
}

.cursor-pointer {
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 16px solid var(--primary-color);
    transform: rotate(-30deg);
}

.cursor-label {
    position: absolute;
    top: 18px;
    left: 8px;
    padding: 2px 6px;
    background: var(--primary-color);
    color: #000;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 4px;
    white-space: nowrap;
}

/* Chat Sidebar */
.chat-sidebar {
    position: absolute;
    right: -320px;
    top: 0;
    width: 320px;
    height: 100%;
    background: var(--card-bg);
    border-left: 1px solid var(--border-color);
    backdrop-filter: blur(var(--glass-blur));
    display: flex;
    flex-direction: column;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 200;
}

.chat-sidebar.open {
    right: 0;
}

.chat-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Chat Sidebar Improvements */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.message {
    padding: 10px 14px;
    border-radius: 14px;
    max-width: 85%;
    font-size: 0.95rem;
    position: relative;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.message.received {
    align-self: flex-start;
    background: var(--secondary-color);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 2px;
}

.message.sent {
    align-self: flex-end;
    color: #000;
    border-bottom-right-radius: 2px;
    background: linear-gradient(135deg, var(--primary-color) 0%, #00b8e6 100%);
}

.message-user {
    font-weight: 800;
    font-size: 0.7rem;
    margin-bottom: 4px;
    opacity: 0.8;
}

/* Tooltips */
[title] {
    position: relative;
}

/* Typing Indicator */
.typing-indicator {
    padding: 8px 16px;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
}

.chat-input-area {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 8px;
}

#chatInput {
    flex: 1;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 12px;
    color: var(--text-color);
    outline: none;
}

#sendChat {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--primary-color);
    border: none;
    color: #000;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-toggle {
    position: absolute;
    right: 30px;
    bottom: 60px;
    z-index: 150;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
}

.close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.2rem;
}

/* Tool Improvements */
.tool-btn i {
    pointer-events: none;
}

/* Lobby */
.user-lobby {
    position: absolute;
    left: 100px;
    top: 20px;
    padding: 12px 16px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    backdrop-filter: blur(var(--glass-blur));
    z-index: 100;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.lobby-header h4 {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.user-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.user-tag {
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}

.user-tag:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.user-tag.self {
    border-color: var(--primary-color);
    background: rgba(0, 209, 255, 0.1);
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #23d160;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

/* Sticky Notes */
#sticky-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.sticky-note {
    position: absolute;
    width: 180px;
    height: 180px;
    background: #fff9c4;
    padding: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    cursor: move;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    border-radius: 2px;
    transition: transform 0.2s ease;
}

.sticky-note:hover {
    transform: scale(1.02);
}

.sticky-content {
    flex: 1;
    border: none;
    background: transparent;
    resize: none;
    outline: none;
    font-family: inherit;
    font-size: 0.9rem;
    color: #333;
}

.sticky-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 4px;
}

.delete-sticky {
    background: transparent;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 0.8rem;
}

.delete-sticky:hover {
    color: var(--danger-color);
}

/* BG Selector */
.bg-selector {
    display: flex;
    background: var(--secondary-color);
    padding: 4px;
    border-radius: 8px;
    gap: 4px;
}

/* Zoom Controls */
.zoom-controls {
    position: absolute;
    bottom: 30px;
    left: 30px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    z-index: 100;
}

.zoom-controls button {
    background: transparent;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    font-size: 1rem;
    transition: var(--transition);
}

.zoom-controls button:hover {
    color: var(--primary-color);
    transform: scale(1.1);
}

.zoom-controls span {
    font-size: 0.85rem;
    font-weight: 600;
    min-width: 45px;
    text-align: center;
}

/* Reactions */
.reactions-bar {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 16px;
    border-radius: 30px;
    border: 1px solid var(--border-color);
    display: flex;
    gap: 12px;
    z-index: 100;
}

.reaction-btn {
    font-size: 1.5rem;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.reaction-btn:hover {
    transform: scale(1.4) translateY(-5px);
}

.floating-reaction {
    position: absolute;
    font-size: 2rem;
    pointer-events: none;
    z-index: 1000;
    animation: floatUp 2s ease-out forwards;
}

@keyframes floatUp {
    0% {
        transform: translateY(0) scale(0.5);
        opacity: 0;
    }
    20% {
        opacity: 1;
        transform: translateY(-20px) scale(1.2);
    }
    100% {
        transform: translateY(-200px) scale(1);
        opacity: 0;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-color);
}

.bg-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}

.bg-btn:hover {
    color: var(--text-color);
}

.bg-btn.active {
    background: var(--card-bg);
    color: var(--primary-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Dropdown */
.export-dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    background: var(--card-bg);
    min-width: 160px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    z-index: 500;
    margin-top: 8px;
    overflow: hidden;
}

.dropdown-content button {
    width: 100%;
    padding: 12px 16px;
    text-align: left;
    background: transparent;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
}

.dropdown-content button:hover {
    background: rgba(255, 255, 255, 0.05);
}

.export-dropdown:hover .dropdown-content {
    display: block;
}

.icon-only {
    width: 44px;
    padding: 0;
    justify-content: center;
}