body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    position: relative;
}

/* Info Icon and Modal */
.info-icon-container {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 10000;
}

.canvas-area {
    position: relative;
}

.info-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, black 0%, gray 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    font-size: 24px;
    font-weight: bold;
}

.info-icon:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

.info-modal {
    display: none;
    position: absolute;
    top: 50px;
    right: 0;
    width: 400px;
    max-width: 90vw;
    max-height: 70vh;
    overflow-y: auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    padding: 20px;
    animation: slideDown 0.3s ease;
}

.info-modal.show {
    display: block;
}

.info-modal h3 {
    margin: 0 0 20px 0;
    color: #667eea;
    font-size: 20px;
    border-bottom: 2px solid black;
    padding-bottom: 10px;
}

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

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

.info-section h4 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 16px;
    font-weight: 600;
}

.info-section ul {
    margin: 0;
    padding-left: 20px;
}

.info-section li {
    margin-bottom: 8px;
    color: #555;
    line-height: 1.6;
    font-size: 14px;
}

.info-section li strong {
    color: #333;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile responsiveness for info icon */
@media (max-width: 768px) {
    .info-icon-container {
        top: 10px;
        right: 10px;
    }

    .info-icon {
        width: 35px;
        height: 35px;
        font-size: 20px;
    }

    .info-modal {
        width: 90vw;
        max-height: 70vh;
        right: -10px;
    }
}

.main-layout {
    display: flex;
    height: 100vh;
    width: 100vw;
}

.toolbox {
    width: 300px;
    min-width: 300px;
    background-color: #2c3e50;
    color: white;
    padding: 20px;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.toolbox h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: white;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
}

.right-tray {
    width: 300px;
    min-width: 300px;
    background-color: #34495e;
    color: white;
    padding: 20px;
    overflow-y: auto;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
}

.right-tray h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: white;
    border-bottom: 2px solid #e74c3c;
    padding-bottom: 10px;
}

.canvas-area {
    flex: 1;
    overflow: auto;
    background-color: #ecf0f1;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .main-layout {
        flex-direction: column;
        overflow-y: auto;
    }

    .toolbox,
    .right-tray {
        width: 100%;
        min-width: 100%;
        max-height: 30vh;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    }

    .canvas-area {
        min-height: 60vh;
        overflow-x: auto;
    }

    book-element {
        padding: 10px;
    }

    page-element {
        transform: scale(0.5);
        transform-origin: top center;
    }

    .book-navigation {
        flex-wrap: wrap;
        gap: 10px;
    }

    .book-nav-btn {
        padding: 6px 12px;
        font-size: 12px;
    }

    .book-page-indicator {
        width: 100%;
        order: -1;
        margin-bottom: 5px;
    }
}

/* Tablet responsiveness */
@media (min-width: 769px) and (max-width: 1024px) {
    .toolbox,
    .right-tray {
        width: 200px;
        min-width: 200px;
        padding: 15px;
    }

    .toolbox h3,
    .right-tray h3 {
        font-size: 1.2em;
        margin-bottom: 15px;
    }

    page-element {
        transform: scale(0.7);
        transform-origin: top center;
    }
}

book-element {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background-color: #ecf0f1;
    min-height: 100%;
}

.book-navigation {
    display: flex;
    gap: 15px;
    align-items: center;
    padding: 10px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.book-nav-btn {
    padding: 8px 16px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.book-nav-btn:hover:not(:disabled) {
    background-color: greenyellow;
}

.book-nav-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.book-page-indicator {
    font-weight: 500;
    color: #333;
    min-width: 100px;
    text-align: center;
}

.book-add-page-btn {
    background-color: #28a745;
}

.book-add-page-btn:hover {
    background-color: #218838;
}
textarea {
    resize: both;
    touch-action: none;
    -webkit-user-select: text;
    user-select: text;
}

textarea:focus {
    touch-action: manipulation;
}

/* Mobile textarea styling */
@media (max-width: 768px) {
    textarea {
        min-width: 100px;
        min-height: 60px;
    }

    /* Make resize handle more visible on mobile */
    textarea::after {
        content: '';
        position: absolute;
        bottom: 0;
        right: 0;
        width: 20px;
        height: 20px;
        background: linear-gradient(135deg, transparent 50%, #007bff 50%);
        pointer-events: none;
    }
}
/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 20000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: white;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s;
}

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

.modal-header h3 {
    margin: 0;
    color: #333;
}

.close-modal {
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    line-height: 1;
}

.close-modal:hover {
    color: #000;
}

.modal-body {
    padding: 20px;
}

.style-group {
    margin-bottom: 15px;
}

.style-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
}

.style-group input,
.style-group select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.style-group input[type="color"] {
    height: 40px;
    cursor: pointer;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #ddd;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

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

@keyframes slideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

page-element {
    display: inline-block;
    position: relative;
    border-radius: 1px;
    height: 11in;
    width: 8in;
    background-color: white;
    border: 1px solid #ccc;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* Page spread styling - pair pages side by side */
book-element page-element:nth-child(odd) {
    margin-right: 0;
}

book-element page-element:nth-child(even) {
    margin-left: 0;
}

.draggable-container {
    margin: 20px;
}

.draggable-input {
    padding: 8px;
    border: 2px solid #333;
    border-radius: 4px;
    cursor: move;
    font-size: 14px;
}

.draggable-input:hover {
    background-color: #f0f0f0;
}

.draggable-image {
    display: inline-block;
    width: 200px;
    height: 200px;
    border: 2px dashed #666;
    cursor: move;
    resize: both;
    overflow: hidden;
    position: relative;
    background-color: #f9f9f9;
}

.draggable-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
    user-select: none;
}

.draggable-image:hover {
    border-color: #007bff;
}

.draggable-image.placed {
    border-style: solid;
}

/* Copyright Footer */
.copyright-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(44, 62, 80, 0.95);
    color: white;
    text-align: center;
    padding: 10px 20px;
    font-size: 12px;
    line-height: 1.6;
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.copyright-footer a {
    color: #3498db;
    text-decoration: none;
}

.copyright-footer a:hover {
    color: #5dade2;
    text-decoration: underline;
}

.copyright-footer img {
    vertical-align: middle;
    margin: 5px 0;
}

/* Adjust main layout to account for footer */
@media (max-width: 768px) {
    .main-layout {
        padding-bottom: 120px;
    }
}

@media (min-width: 769px) {
    .main-layout {
        padding-bottom: 80px;
    }
}