body {
    margin: 0;
    background: #1a1a1a;
}

.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: 1rem;
    background: #2a2a2a;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

#webCanvas {
    margin-top: 60px;
}

@media (max-width: 768px) {
    .header {
        padding: 0.5rem;
        flex-direction: column;
        align-items: flex-start;
    }

    .header button {
        font-size: 14px;
        padding: 6px 12px;
        margin-top: 4px;
    }

    #webCanvas {
        margin-top: 80px; /* More space for potential stacked header */
    }

    .login-popup {
        width: 90%;
        max-width: 300px;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 0.25rem;
    }
    
    .header button {
        font-size: 12px;
        padding: 4px 8px;
    }
    
    .login-popup input {
        width: 100%;
        padding: 6px;
    }
}

/* Login popup styles */
.login-popup {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    z-index: 2000;
}

.login-popup.show {
    display: block;
}

.login-popup input {
    width: 250px;
    padding: 8px;
    margin: 10px 0;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.login-popup button {
    width: 100%;
    padding: 10px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 10px;
}

.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: 1999;
}

.overlay.show {
    display: block;
}

.error-message {
    color: red;
    margin-top: 10px;
    display: none;
}


/* Sidebar styles */
.sidebar {
    position: fixed;
    top: 60px;
    right: 0;
    width: 300px;
    height: calc(100vh - 60px);
    background: var(--popup-bg);
    box-shadow: -2px 0 5px rgba(0,0,0,0.2);
    z-index: 1500;
    overflow-y: auto;
    
    /* Book animation setup */
    transform-origin: left center;
    transform: perspective(1200px) rotateY(90deg);
    transition: transform 0.5s ease;
}

.sidebar.open {
    transform: perspective(1200px) rotateY(0deg);
}

.sidebar-content {
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease 0.2s; /* Delay the content fade-in */
}

.sidebar.open .sidebar-content {
    opacity: 1;
}

.sidebar h2 {
    margin-top: 0;
    color: var(--text-color);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.admin-controls {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sidebar-btn {
    padding: 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

.add-btn {
    background-color: var(--button-bg);
    color: var(--button-text);
}

.delete-btn {
    background-color: #ff4444;
    color: white;
}

@media (max-width: 768px) {
    .sidebar {
        width: 250px;
        top: 80px;
        height: calc(100vh - 80px);
    }
}

@media (max-width: 480px) {
    .sidebar {
        width: 100%;
        /* Adjust the perspective for mobile */
        transform: perspective(1200px) rotateY(90deg);
    }
}
