/* Sticky Board Styles */

* {
    box-sizing: border-box;
}

/* Override body/shared.css for sticky board - prevent scrolling */
body {
    overflow: hidden !important;
    min-height: 100vh;
    height: 100vh;
}

/* Override shared.css .main-container to constrain to viewport */
.main-container {
    display: flex;
    flex-direction: column;
    height: 100vh !important;
    max-height: 100vh !important;
    min-height: 100vh !important;
    width: 100vw;
    overflow: hidden !important;
}

/* Override shared.css footer margin-top: auto which fights with flex layout */
.main-container > .footer {
    margin-top: 0;
}

/* Board Controls Bar */
.board-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    z-index: 100;
    flex-shrink: 0;
}

.controls-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.page-title {
    font-family: 'Poppins', sans-serif;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-light);
    margin: 0;
}

.controls-center {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    background: var(--dark-bg);
    border-radius: 8px;
    padding: 0.25rem 0.5rem;
}

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

.zoom-btn:hover {
    background: var(--surface-color);
    color: var(--primary);
}

.zoom-level {
    min-width: 50px;
    text-align: center;
    color: var(--text-light);
    font-family: 'Poppins', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
}

.controls-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.control-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-muted);
    font-family: 'Poppins', sans-serif;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.control-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.control-btn.primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border: none;
    color: white;
}

.control-btn.primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(88, 101, 242, 0.4);
}

/* View Only Banner */
.view-only-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: rgba(88, 101, 242, 0.1);
    border-bottom: 1px solid var(--primary);
    color: var(--text-light);
    font-family: 'Poppins', sans-serif;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.create-own-btn {
    padding: 0.4rem 0.75rem;
    background: var(--primary);
    border-radius: 6px;
    color: white;
    text-decoration: none;
    font-size: 0.85rem;
    margin-left: 1rem;
}

.create-own-btn:hover {
    background: var(--secondary);
}

/* The Board Container (handles overflow and pan) */
.board-container {
    flex: 1;
    position: relative;
    overflow: auto;
    min-height: 0;
    background: var(--dark-bg);
}

/* The Board */
.board {
    position: relative;
    min-width: 100%;
    min-height: 100%;
    width: 2000px;
    height: 2000px;
    background:
        linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px),
        linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
        var(--dark-bg);
    background-size: 40px 40px;
    cursor: default;
    transform-origin: 0 0;
    transition: transform 0.1s ease;
}

/* Sticky Note */
.sticky-note {
    position: absolute;
    min-width: 150px;
    min-height: 150px;
    border-radius: 4px;
    box-shadow: 2px 4px 15px rgba(0, 0, 0, 0.3);
    cursor: move;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.sticky-note:hover {
    box-shadow: 4px 8px 25px rgba(0, 0, 0, 0.4);
}

.sticky-note.dragging {
    z-index: 1000;
    box-shadow: 8px 12px 35px rgba(0, 0, 0, 0.5);
}

.note-header {
    display: flex;
    justify-content: flex-end;
    padding: 0.25rem 0.5rem;
    background: rgba(0, 0, 0, 0.05);
}

.note-edit-btn {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.1);
    border: none;
    border-radius: 4px;
    color: rgba(0, 0, 0, 0.5);
    cursor: pointer;
    transition: all 0.2s ease;
}

.note-edit-btn:hover {
    background: rgba(0, 0, 0, 0.2);
    color: rgba(0, 0, 0, 0.7);
}

.note-content {
    flex: 1;
    padding: 0.75rem;
    color: #333;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-y: auto;
    scrollbar-width: thin;
    font-family: 'Poppins', sans-serif;
}

.note-content::-webkit-scrollbar {
    width: 4px;
}

.note-content::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 2px;
}

/* Resize Handle */
.resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 20px;
    height: 20px;
    cursor: nwse-resize;
    background:
        linear-gradient(135deg, transparent 50%, rgba(0, 0, 0, 0.1) 50%);
}

.resize-handle::before {
    content: '';
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    border-right: 2px solid rgba(0, 0, 0, 0.3);
    border-bottom: 2px solid rgba(0, 0, 0, 0.3);
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
    padding: 1rem;
}

.modal-content {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

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

.modal-header h3 {
    color: var(--text-light);
    font-family: 'Poppins', sans-serif;
    font-size: 1.1rem;
    margin: 0;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
}

/* Note Editor */
.editor-body {
    padding: 1.5rem;
    overflow-y: auto;
}

#noteText {
    width: 100%;
    min-height: 150px;
    padding: 1rem;
    background: var(--dark-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-light);
    font-family: 'Poppins', sans-serif;
    font-size: 1rem;
    resize: vertical;
    margin-bottom: 1rem;
}

#noteText:focus {
    outline: none;
    border-color: var(--primary);
}

.editor-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.option-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.option-group label {
    color: var(--text-muted);
    font-family: 'Poppins', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
}

.color-picker {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.color-btn {
    width: 32px;
    height: 32px;
    border: 2px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.color-btn.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(88, 101, 242, 0.3);
}

.option-group select {
    padding: 0.6rem;
    background: var(--dark-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-light);
    font-family: 'Poppins', sans-serif;
    font-size: 0.95rem;
}

.option-group select:focus {
    outline: none;
    border-color: var(--primary);
}

.modal-footer {
    display: flex;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
}

.btn-delete {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: transparent;
    border: 1px solid var(--error);
    border-radius: 8px;
    color: var(--error);
    font-family: 'Poppins', sans-serif;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-delete:hover {
    background: rgba(239, 68, 68, 0.1);
}

.btn-save {
    padding: 0.6rem 1.5rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border: none;
    border-radius: 8px;
    color: white;
    font-family: 'Poppins', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-save:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(88, 101, 242, 0.4);
}

/* Share Modal */
.share-body {
    padding: 1.5rem;
}

.share-body p {
    color: var(--text-muted);
    font-family: 'Poppins', sans-serif;
    margin-bottom: 1rem;
}

.share-link-container {
    display: flex;
    gap: 0.5rem;
}

.share-link-container input {
    flex: 1;
    padding: 0.75rem;
    background: var(--dark-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-light);
    font-family: 'Poppins', sans-serif;
    font-size: 0.9rem;
}

.btn-copy {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--primary);
    border: none;
    border-radius: 8px;
    color: white;
    font-family: 'Poppins', sans-serif;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-copy:hover {
    background: var(--secondary);
}

/* Share options */
.share-options {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.btn-shorten {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-muted);
    font-family: 'Poppins', sans-serif;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    justify-content: center;
}

.btn-shorten:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-shorten.loading {
    opacity: 0.7;
    pointer-events: none;
}

.share-note {
    font-size: 0.85rem !important;
    color: var(--text-muted);
    margin-top: 1rem !important;
}

/* Sticky Board Footer */
.sticky-board-footer {
    flex-shrink: 0;
    position: relative;
    z-index: 10;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    color: var(--text-light);
    font-family: 'Poppins', sans-serif;
    font-size: 0.95rem;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
}

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

/* Responsive */
@media (max-width: 768px) {
    .board-controls {
        padding: 0.5rem 1rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .controls-left {
        width: 100%;
        justify-content: center;
    }

    .page-title {
        font-size: 1.1rem;
    }

    .controls-right {
        width: 100%;
        justify-content: center;
    }

    .control-btn span {
        display: none;
    }

    .control-btn {
        padding: 0.6rem;
    }

    .view-only-banner {
        flex-wrap: wrap;
        text-align: center;
        font-size: 0.8rem;
        padding: 0.5rem;
    }

    .view-only-banner svg {
        display: none;
    }

    .create-own-btn {
        margin: 0.5rem 0 0;
        width: 100%;
        text-align: center;
    }

    /* Mobile optimized sticky notes in view mode */
    .sticky-note {
        min-width: 120px;
        min-height: 100px;
    }

    .modal-content {
        max-height: 85vh;
        margin: 0.5rem;
    }

    .color-picker {
        justify-content: center;
    }

    .sticky-board-footer .container {
        padding: 0.75rem;
    }

    .sticky-board-footer .footer-content {
        flex-direction: column;
        gap: 0.5rem;
    }

    .sticky-board-footer .footer-legal-links {
        flex-wrap: wrap;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .board-controls {
        padding: 0.5rem;
    }

    .page-title {
        font-size: 1rem;
    }

    .share-link-container {
        flex-direction: column;
    }

    .btn-copy {
        justify-content: center;
    }

    /* Even smaller notes on very small screens */
    .sticky-note {
        min-width: 100px;
        min-height: 80px;
    }

    .note-content {
        padding: 0.5rem;
        font-size: 0.85rem;
    }

    .note-header {
        padding: 0.15rem 0.35rem;
    }

    .note-edit-btn {
        width: 20px;
        height: 20px;
    }
}

/* View-only mode mobile optimizations */
body.view-mode .board {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

body.view-mode .sticky-note {
    cursor: default;
}

/* Print styles - hide controls when printing */
@media print {
    .site-header,
    .board-controls,
    .view-only-banner,
    .note-header,
    .resize-handle,
    .sticky-board-footer {
        display: none !important;
    }

    .board {
        background: white !important;
        overflow: visible !important;
        height: auto !important;
    }

    .sticky-note {
        box-shadow: 1px 1px 5px rgba(0, 0, 0, 0.2) !important;
        break-inside: avoid;
        position: relative !important;
        margin: 1rem;
    }
}
