/* Custom styles for Scribbin */

a,
a:hover,
a:visited,
a:active,
a:focus {
  text-decoration: none;
}

/* Character image aspect ratio preservation */
.character-img {
    object-fit: cover;
    object-position: center;
}

.character-img-contain {
    object-fit: contain;
    object-position: center;
}

/* Loading spinner */
.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #9333ea;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Story page preview */
.story-page {
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border-radius: 0.5rem;
    min-height: 400px;
}

/* Flipbook effect */
.flipbook-container {
    perspective: 1000px;
}

.flipbook-page {
    transform-style: preserve-3d;
    transition: transform 0.6s;
}

.flipbook-page.flipped {
    transform: rotateY(180deg);
}

/* Character grid hover effect */
.character-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

/* File upload area */
.upload-area {
    border: 2px dashed #cbd5e1;
    border-radius: 0.5rem;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.upload-area:hover {
    border-color: #9333ea;
    background-color: #faf5ff;
}

.upload-area.dragging {
    border-color: #9333ea;
    background-color: #faf5ff;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #9333ea;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #7c22ce;
}

/* Story text editor */
.story-text-editor {
    min-height: 150px;
    padding: 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    font-family: 'Georgia', serif;
    line-height: 1.8;
}

.story-text-editor:focus {
    outline: none;
    border-color: #9333ea;
    box-shadow: 0 0 0 3px rgba(147, 51, 234, 0.1);
}

/* Credit balance animation */
.credit-balance-update {
    animation: pulse 0.5s ease-in-out;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Modal backdrop blur */
.modal-backdrop {
    backdrop-filter: blur(4px);
}

/* Image composition types */
.composition-option {
    cursor: pointer;
    transition: all 0.2s;
}

.composition-option:hover {
    border-color: #9333ea;
    background-color: #faf5ff;
}

.composition-option.selected {
    border-color: #9333ea;
    background-color: #ede9fe;
}

/* Toast notifications */
#toast-container {
    pointer-events: none;
}

#toast-container .toast {
    pointer-events: auto;
}

.toast {
    position: relative;
    min-width: 300px;
    max-width: 400px;
    padding: 0;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    opacity: 0;
    transform: translateX(1rem);
    transition: all 0.3s ease-in-out;
    margin-bottom: 0.75rem;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast.cursor-pointer:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    transform: translateX(-2px);
}

.toast-content {
    display: flex;
    align-items: flex-start;
    padding: 1rem;
}

.toast-icon {
    flex-shrink: 0;
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    margin-right: 0.75rem;
    font-weight: bold;
}

.toast.success .toast-icon {
    background-color: #d1fae5;
    color: #059669;
}

.toast.error .toast-icon {
    background-color: #fee2e2;
    color: #dc2626;
}

.toast.warning .toast-icon {
    background-color: #fef3c7;
    color: #d97706;
}

.toast.info .toast-icon {
    background-color: #dbeafe;
    color: #2563eb;
}

.toast-body {
    flex: 1;
    min-width: 0;
}

.toast-message {
    color: #374151;
    font-size: 0.875rem;
    line-height: 1.25rem;
    word-wrap: break-word;
}

.toast-image {
    margin-top: 0.5rem;
    width: 100%;
    max-width: 200px;
    height: auto;
    border-radius: 0.375rem;
    border: 1px solid #e5e7eb;
}

.toast-dismiss {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 0.25rem;
    transition: all 0.2s;
}

.toast-dismiss:hover {
    color: #374151;
    background-color: #f3f4f6;
}

/* Slide-over panel styles */
.slide-over-backdrop {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.25);
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    z-index: 40;
}

.slide-over-backdrop.show {
    opacity: 1;
}

/* Responsive adjustments for slide-over */
@media (max-width: 640px) {
    .slide-over-panel {
        max-width: 90%;
    }
}

/* Remove any layout shifts when slide-over is open */
.book-spread {
    position: relative;
    z-index: 1;
}

/* Ensure the slide-over doesn't affect the main content layout */
.slide-over-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 480px;
    background-color: white;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
    z-index: 50;
    display: flex;
    flex-direction: column;
    /* Ensure it doesn't affect document flow */
    pointer-events: none;
}

.slide-over-panel.show {
    transform: translateX(0);
    pointer-events: auto;
}

/* Panel content should fill available space */
#page-settings-content {
    flex: 1;
    overflow: hidden;
    padding: 1.5rem;
}

#page-settings-content > div {
    height: 100%;
}

/* New Page Settings Section Styles */
#page-settings-section {
    transition: opacity 0.3s ease-in-out;
}

#page-settings-content-new {
    max-height: 600px; /* Always visible with reasonable max height */
    transition: max-height 0.3s ease-in-out;
    overflow-y: auto;
    overflow-x: hidden;
}



/* Page settings content scrollbar styling */
#page-settings-content-new::-webkit-scrollbar {
    width: 6px;
}

#page-settings-content-new::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

#page-settings-content-new::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

#page-settings-content-new::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Ensure page settings section doesn't interfere with fullscreen mode */
body.fullscreen-mode #page-settings-section {
    display: none !important;
}

/* Page settings responsive design */
@media (max-width: 768px) {
    #page-settings-section {
        margin-left: 1rem;
        margin-right: 1rem;
    }
    
    #page-settings-section .p-6 {
        padding: 1rem;
    }
}