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

body {
    font-family: 'Merriweather', serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
    padding: 0;
    margin: 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Navigation */
.main-nav {
    background-color: #CBB0FF;
    padding: 1rem 2rem;
    display: flex;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    margin: 0 0.5rem;
    border-radius: 4px;
    transition: background-color 0.3s;
    font-family: 'Merriweather', serif;
    font-size: 0.9rem;
    font-weight: 700;
}

.nav-link:hover,
.nav-link.active {
    background-color: #b495f0;
}

.user-info {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 1rem;
}

#username-display {
    color: white;
    font-weight: bold;
}

#logout-btn {
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid white;
    border-radius: 5px;
    cursor: pointer;
    font-family: 'Merriweather', serif;
}

#logout-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Page Header */
.page-header {
    text-align: center;
    margin: 3rem 0 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #eee;
}

.page-header h1 {
    font-size: 2.8rem;
    color: #CBB0FF;
    margin-bottom: 0.5rem;
    font-family: 'Merriweather', serif;
    font-weight: 700;
}

.page-header p {
    font-size: 1.3rem;
    color: #777;
    margin-top: 1.5rem;
}

/* Tabs for Public/My Boards */
.boards-tabs {
    display: flex;
    margin-bottom: 2rem;
    border-bottom: 2px solid #ddd;
}

.tab-btn {
    padding: 1rem 2rem;
    background: none;
    border: none;
    cursor: pointer;
    font-family: 'Merriweather', serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: #777;
    position: relative;
}

.tab-btn.active {
    color: #CBB0FF;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: #CBB0FF;
}

/* Login Prompt */
.login-prompt {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 50vh;
}

.prompt-content {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    text-align: center;
    max-width: 400px;
}

.prompt-content h2 {
    color: #CBB0FF;
    margin-bottom: 1rem;
}

/* Boards Grid */
.boards-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.primary-btn {
    padding: 0.8rem 1.5rem;
    background: #CBB0FF;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Merriweather', serif;
    font-size: 1rem;
    font-weight: 700;
    transition: background 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.primary-btn:hover {
    background: #b495f0;
}

.boards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 2rem;
}

.board-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

.board-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.board-thumbnail {
    height: 150px;
    background: #f0f0f0;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #888;
}

.board-info {
    padding: 1rem;
}

.board-title {
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: #555;
}

.board-meta {
    display: flex;
    justify-content: space-between;
    color: #888;
    font-size: 0.9rem;
}

.board-author {
    font-style: italic;
}

/* Board Editor */
.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1.5rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.editor-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.visibility-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.visibility-toggle label {
    font-weight: bold;
    color: #555;
}

.visibility-toggle select {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-family: 'Merriweather', serif;
}

#share-section {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#share-link {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    width: 200px;
    font-family: 'Merriweather', serif;
}

/* Enhanced Toolbar */
.enhanced-toolbar {
    background: white;
    padding: 1rem;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.toolbar-section {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.toolbar-label {
    font-weight: bold;
    color: #555;
    min-width: 60px;
}

.toolbar-select,
.toolbar-input {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-family: 'Merriweather', serif;
}

.color-picker {
    width: 40px;
    height: 40px;
    padding: 0;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

/* Editor Tools */
.editor-tools {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
}

.tools-section {
    flex: 1;
    min-width: 250px;
}

.tools-section h3 {
    margin-bottom: 1rem;
    color: #555;
}

.tool-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
}

.tool-btn {
    padding: 0.8rem 1rem;
    background: #f0f0f0;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.3s ease;
    font-family: 'Merriweather', serif;
}

.tool-btn:hover {
    background: #e0e0f0;
}

/* Board Canvas */
.board-canvas-container {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 3rem;
    min-height: 500px;
}

.board-canvas {
    position: relative;
    width: 100%;
    min-height: 500px;
    background: #f9f9f9;
    border: 2px dashed #ddd;
}

/* Draggable Elements */
.draggable {
    position: absolute;
    cursor: move;
    user-select: none;
    resize: both;
    overflow: auto;
    min-width: 100px;
    min-height: 50px;
}

.draggable img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.draggable-text {
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid #ddd;
    border-radius: 5px;
    font-family: 'Merriweather', serif;
}

.draggable-sticker {
    font-size: 3rem;
    user-select: none;
    display: flex;
    justify-content: center;
    align-items: center;
}

.draggable-music {
    padding: 1rem;
    background: rgba(255, 192, 203, 0.2);
    border: 1px solid #FFC0CB;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.draggable-music iframe {
    width: 100%;
    height: 100%;
    border-radius: 5px;
}

.music-placeholder {
    text-align: center;
    color: #555;
}

.draggable-controls {
    position: absolute;
    top: -25px;
    right: 0;
    background: white;
    padding: 0.3rem;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    display: flex;
    gap: 0.5rem;
}

.draggable-controls button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.8rem;
}

/* NEW: Resize handle for all elements */
.resize-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: #CBB0FF;
    border: 1px solid white;
    border-radius: 50%;
    bottom: -6px;
    right: -6px;
    cursor: se-resize;
    z-index: 10;
}

/* Modal Styles - Redesigned Login */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
}

.modal-content {
    background-color: #2c2c2c;
    margin: 10% auto;
    padding: 2.5rem;
    border-radius: 15px;
    width: 90%;
    max-width: 450px;
    position: relative;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.5);
    font-family: 'Merriweather', serif;
    color: white;
    text-align: center;
}

.close-modal {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 1.8rem;
    cursor: pointer;
    color: #aaa;
}

.close-modal:hover {
    color: white;
}

.modal-content h2 {
    color: #CBB0FF;
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
}

.modal-footer {
    margin-top: 1.5rem;
    text-align: center;
    color: #aaa;
    font-size: 0.9rem;
}

/* Form Styles */
.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
    color: #ddd;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.9rem;
    border: 1px solid #444;
    border-radius: 8px;
    font-family: 'Merriweather', serif;
    background: #3a3a3a;
    color: white;
}

.form-group textarea {
    min-height: 80px;
    resize: vertical;
}

.submit-btn {
    width: 100%;
    padding: 1rem;
    background: #CBB0FF;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Merriweather', serif;
    font-weight: bold;
    font-size: 1rem;
    transition: background 0.3s ease;
}

.submit-btn:hover {
    background: #b495f0;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .editor-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .editor-actions {
        width: 100%;
        justify-content: space-between;
    }

    .tools-section {
        min-width: 100%;
    }

    .user-info {
        display: none;
    }

    .main-nav {
        flex-wrap: wrap;
    }

    .nav-link {
        margin: 0.3rem;
        font-size: 0.8rem;
    }

    .enhanced-toolbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .boards-tabs {
        flex-direction: column;
    }

    .tab-btn {
        width: 100%;
        text-align: center;
    }
}