/* =========================================
   ToolCanvas — Infinite Whiteboard Styles
   ========================================= */

body {
    background-color: #f8fafc;
    color: var(--color-text);
    margin: 0;
    padding: 0;
}

body.whiteboard-maximized-active {
    overflow: hidden !important;
}

/* ---------- Whiteboard App Card ---------- */
.whiteboard-app-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    height: 580px; /* Fixed height when embedded */
    position: relative;
    overflow: hidden; /* Keep canvas and widgets clipped */
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 10;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

/* Full Screen Maximized State */
.whiteboard-app-card.maximized {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 99999 !important;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
}

#whiteboard-canvas {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    outline: none;
}

/* ---------- Arrow Direction Indicator ---------- */
.pan-indicator-arrow {
    position: absolute;
    background-color: var(--color-accent);
    color: #ffffff;
    padding: 8px 16px;
    border-radius: 9999px;
    font-size: var(--font-size-xs);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
    z-index: 10;
    transition: transform 0.2s, opacity 0.2s, background-color 0.2s;
    user-select: none;
    -webkit-user-select: none;
}

.pan-indicator-arrow:hover {
    background-color: var(--color-accent-hover);
    transform: scale(1.05);
}

.pan-indicator-arrow.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.8);
}

.pan-indicator-arrow svg {
    transition: transform 0.2s;
}

/* ---------- Header Panel ---------- */
.whiteboard-header {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 5;
    pointer-events: none; /* Allows canvas clicks beneath transparent space */
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    pointer-events: auto; /* Re-enable pointer events for controls */
}

.hamburger-btn {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text);
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: background-color 0.2s, color 0.2s;
}

.hamburger-btn:hover {
    background: #ffffff;
    color: var(--color-accent);
}

.whiteboard-header .site-logo {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    padding: 0 16px;
    height: 40px;
    display: flex;
    align-items: center;
    font-size: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Zoom Panel */
.zoom-panel {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    height: 40px;
    padding: 0 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.btn-zoom {
    background: transparent;
    border: none;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-secondary);
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s, color 0.2s;
}

.btn-zoom:hover {
    background-color: #f1f5f9;
    color: var(--color-accent);
}

.zoom-percent {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
    padding: 0 8px;
    min-width: 52px;
    text-align: center;
}

/* Action Buttons */
.btn-action {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    height: 40px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-secondary);
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: background-color 0.2s, color 0.2s;
}

.btn-action:hover {
    background: #ffffff;
    color: var(--color-accent);
}

#settings-btn {
    padding: 0;
    width: 40px;
    justify-content: center;
}

/* ---------- Drawer Menu ---------- */
.drawer-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(15, 23, 42, 0.15);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 90;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.drawer-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.drawer {
    position: absolute;
    top: 0;
    left: -320px;
    width: 300px;
    height: 100vh;
    background: #ffffff;
    box-shadow: 4px 0 25px rgba(0, 0, 0, 0.08);
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.drawer.open {
    left: 0;
}

.drawer-header {
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.drawer-header h4 {
    margin: 0;
    font-size: 16px;
    color: var(--color-text);
}

.btn-close-drawer {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--color-text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    padding: 4px;
    transition: background-color 0.2s;
}

.btn-close-drawer:hover {
    background-color: #f1f5f9;
    color: var(--color-text);
}

.drawer-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.drawer-menu {
    list-style: none;
    padding: 0;
    margin: 0 0 24px 0;
}

.drawer-item {
    width: 100%;
    background: transparent;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text);
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

.drawer-item:hover {
    background-color: #f8fafc;
    border-color: var(--color-accent);
    color: var(--color-accent);
}

.drawer-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--color-text-muted);
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}

.drawer-menu li {
    margin-bottom: 8px;
}

.recent-item-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.recent-board-btn {
    flex: 1;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
    min-width: 0;
}

.recent-board-btn:hover {
    background-color: #f1f5f9;
    border-color: #cbd5e1;
}

.btn-delete-recent {
    background: transparent;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ef4444;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
    flex-shrink: 0;
}

.btn-delete-recent:hover {
    background-color: rgba(239, 68, 68, 0.08);
    color: #dc2626;
}

.recent-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.recent-time {
    font-size: 10px;
    color: var(--color-text-muted);
}

.empty-recent-msg {
    font-size: 13px;
    color: var(--color-text-muted);
    font-style: italic;
    padding: 8px 4px;
}

/* ---------- Settings Popover ---------- */
.settings-popover {
    position: absolute;
    top: 70px;
    right: 20px;
    width: 280px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    z-index: 10;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: opacity 0.2s, transform 0.2s;
    transform-origin: top right;
}

.settings-popover.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.95);
}

.settings-popover-header {
    padding: 14px 16px;
    border-bottom: 1px solid #e2e8f0;
}

.settings-popover-header h4 {
    margin: 0;
    font-size: 14px;
    color: var(--color-text);
}

.settings-popover-body {
    padding: 16px;
}

.setting-item {
    margin-bottom: 16px;
}

.setting-item:last-child {
    margin-bottom: 0;
}

.setting-item label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 8px;
}

.setting-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.setting-label-row span {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text);
}

.setting-item input[type="checkbox"] {
    cursor: pointer;
    width: 16px;
    height: 16px;
}

.setting-desc {
    font-size: 11px;
    color: var(--color-text-muted);
    margin-top: 4px;
    line-height: 1.4;
}

/* Background toggle design */
.toggle-group {
    display: flex;
    background-color: #f1f5f9;
    border-radius: 6px;
    padding: 3px;
    border: 1px solid #e2e8f0;
}

.btn-toggle {
    flex: 1;
    background: transparent;
    border: none;
    padding: 6px 0;
    font-size: 12px;
    font-weight: 500;
    color: var(--color-text-secondary);
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.btn-toggle.active {
    background-color: #ffffff;
    color: var(--color-accent);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.btn-text-action {
    width: 100%;
    background: transparent;
    border: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-accent);
    cursor: pointer;
    transition: color 0.2s;
}

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

/* ---------- Modals ---------- */
.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(15, 23, 42, 0.3);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 120;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease;
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal {
    background: #ffffff;
    border-radius: 8px;
    width: 90%;
    max-width: 420px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalShow 0.2s ease;
}

.max-about-modal {
    max-width: 600px;
}

@keyframes modalShow {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 16px;
    color: var(--color-text);
}

.btn-close-modal {
    background: transparent;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--color-text-muted);
    transition: color 0.2s;
}

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

.modal-body {
    padding: 20px;
    max-height: 70vh;
    overflow-y: auto;
}

/* Keyboard Shortcuts layout */
.shortcuts-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.shortcuts-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f1f5f9;
}

.shortcuts-list li:last-child {
    border-bottom: none;
}

.shortcuts-list .key {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    padding: 2px 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text);
}

/* About modal design */
.about-modal-body {
    line-height: 1.6;
}

.about-section {
    margin-bottom: 20px;
}

.about-section:last-child {
    margin-bottom: 0;
}

.about-section h4 {
    font-size: 14px;
    color: var(--color-text);
    margin-top: 0;
    margin-bottom: 8px;
}

.about-section p {
    font-size: 13px;
    color: var(--color-text-secondary);
    margin-bottom: 0;
}

.about-section ul {
    margin: 8px 0 0 0;
    padding-left: 20px;
    font-size: 13px;
    color: var(--color-text-secondary);
}

.about-section li {
    margin-bottom: 6px;
}

/* ---------- Drawing Floating Dock ---------- */
.drawing-dock {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 9999px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    z-index: 80;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.dock-separator {
    width: 1px;
    height: 24px;
    background-color: #cbd5e1;
}

.dock-section {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Tool Buttons */
.btn-tool {
    background: transparent;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s, transform 0.1s;
}

.btn-tool:hover {
    background-color: #f1f5f9;
    color: var(--color-text);
}

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

.btn-tool.active {
    background-color: var(--color-accent);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

/* Color Circle Selectors */
.btn-color {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
    position: relative;
    padding: 0;
}

.btn-color:hover {
    transform: scale(1.15);
}

.btn-color.active {
    border-color: #ffffff;
    box-shadow: 0 0 0 2px var(--color-accent);
    transform: scale(1.1);
}

/* Custom color picker input style */
.custom-picker-label {
    background: conic-gradient(red, yellow, lime, aqua, blue, magenta, red);
    overflow: hidden;
    display: block;
}

.custom-picker-label input[type="color"] {
    opacity: 0;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

/* Dock Undo/Redo Buttons */
.btn-dock-action {
    background: transparent;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.btn-dock-action:hover:not(:disabled) {
    background-color: #f1f5f9;
    color: var(--color-text);
}

.btn-dock-action:disabled {
    color: var(--color-text-muted);
    opacity: 0.4;
    cursor: not-allowed;
}
/* Size Controller */
.size-controller {
    display: flex;
    align-items: center;
    gap: 8px;
    transition: opacity 0.2s;
}

.size-preview-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background-color: var(--color-text);
    transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.2s, border 0.2s;
    flex-shrink: 0;
    display: inline-block;
    box-sizing: border-box;
}

#size-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 80px;
    height: 4px;
    border-radius: 2px;
    background: #cbd5e1;
    outline: none;
    cursor: pointer;
    transition: background 0.2s;
}

#size-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--color-accent);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
    transition: transform 0.15s ease;
}

#size-slider::-webkit-slider-thumb:hover {
    transform: scale(1.25);
}

#size-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--color-accent);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
    border: none;
    transition: transform 0.15s ease;
}

#size-slider::-moz-range-thumb:hover {
    transform: scale(1.25);
}

.size-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-secondary);
    min-width: 32px;
    text-align: right;
}

/* ---------- Transparent Footer Links ---------- */
.bottom-left-links {
    position: absolute;
    bottom: 24px;
    left: 24px;
    z-index: 5;
    font-size: 11px;
    color: var(--color-text-muted);
    opacity: 0.65;
    transition: opacity 0.2s;
}

.bottom-left-links:hover {
    opacity: 1;
}

.bottom-left-links a {
    color: var(--color-text-muted);
    text-decoration: none;
}

.bottom-left-links a:hover {
    text-decoration: underline;
    color: var(--color-text-secondary);
}

.bottom-left-links .sep {
    margin: 0 4px;
}

/* ---------- About Trigger Button ---------- */
.btn-about-trigger {
    position: absolute;
    bottom: 24px;
    right: 24px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-secondary);
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    z-index: 5;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: background-color 0.2s, color 0.2s;
}

.btn-about-trigger:hover {
    background-color: #ffffff;
    color: var(--color-accent);
}

/* ---------- Responsive Layout Adjustments ---------- */
@media (max-width: 580px) {
    .whiteboard-header {
        top: 12px;
        left: 12px;
        right: 12px;
    }

    .whiteboard-header .site-logo {
        padding: 0 8px;
        font-size: 16px;
    }

    .btn-action span {
        display: none; /* Hide share/zoom text labels on small screens */
    }

    .btn-action {
        padding: 0;
        width: 40px;
        justify-content: center;
    }

    .drawing-dock {
        bottom: 70px; /* Shift dock up to clear links and about icons on small devices */
        padding: 8px 12px;
        border-radius: 16px;
        display: grid;
        grid-template-columns: auto auto;
        gap: 8px 12px;
        width: max-content;
        max-width: 95vw;
        justify-content: center;
        align-items: center;
    }

    .dock-separator {
        display: none;
    }

    .btn-tool {
        width: 32px;
        height: 32px;
    }

    .btn-color {
        width: 20px;
        height: 20px;
    }

    #size-slider {
        width: 55px;
    }

    .size-value {
        display: none;
    }

    .bottom-left-links {
        bottom: 12px;
        left: 12px;
    }

    .btn-about-trigger {
        bottom: 12px;
        right: 12px;
    }
}

/* ---------- Launch Card (Landing Page CTA) ---------- */
.launch-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 60px 40px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.04);
    margin: 20px 0 40px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.launch-card-icon {
    width: 80px;
    height: 80px;
    background: rgba(37, 99, 235, 0.08);
    color: var(--color-accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}

.launch-card h2 {
    font-size: 28px;
    font-weight: 700;
    color: var(--color-text);
    margin: 0;
}

.launch-card p {
    font-size: 16px;
    color: var(--color-text-secondary);
    max-width: 540px;
    margin: 0 0 12px 0;
    line-height: 1.6;
}

.btn-launch {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background-color: var(--color-accent);
    color: #ffffff !important;
    padding: 14px 28px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
    transition: transform 0.2s, background-color 0.2s, box-shadow 0.2s;
}

.btn-launch:hover {
    background-color: var(--color-accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.btn-launch:active {
    transform: translateY(0);
}
