/* Main styles for LightScribe App */

/* ============================================
   MODAL ANIMATIONS & TRANSITIONS
   ============================================ */

/* Fade-in animation for modal backdrop */
.modal {
    animation: fadeIn 0.15s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Slide-down animation for modal content */
.modal-content {
    animation: slideDown 0.3s ease-out;
    transform-origin: top center;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Smooth transitions for modal show/hide */
.modal {
    transition: opacity 0.15s ease-out;
}

.modal-content {
    transition: transform 0.3s ease-out, opacity 0.3s ease-out;
}

/* ============================================
   RESPONSIVE MODAL STYLES
   ============================================ */

/* Mobile devices (up to 576px) */
@media (max-width: 576px) {
    .modal-dialog {
        max-width: 100%;
        margin: 0.5rem;
    }

    .modal-content {
        border-radius: 0.25rem;
        margin: 0.5rem;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem;
    }

    .modal-title {
        font-size: 1.125rem;
    }
}

/* Tablets (576px to 768px) */
@media (min-width: 576px) and (max-width: 768px) {
    .modal-dialog {
        max-width: 90%;
        margin: 1rem auto;
    }
}

/* Desktop (768px and up) */
@media (min-width: 768px) {
    .modal-dialog {
        max-width: 500px;
    }

    /* Large modals for desktop */
    .modal-dialog.modal-lg {
        max-width: 800px;
    }

    .modal-dialog.modal-xl {
        max-width: 1140px;
    }
}

/* ============================================
   ADDITIONAL MODAL UTILITIES
   ============================================ */

/* Modal with custom sizes */
.modal-sm .modal-dialog {
    max-width: 300px;
}

.modal-lg .modal-dialog {
    max-width: 800px;
}

.modal-xl .modal-dialog {
    max-width: 1140px;
}

/* Scrollable modal body */
.modal-body {
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

@media (max-width: 576px) {
    .modal-body {
        max-height: calc(100vh - 150px);
    }
}

/* Centered modal */
.modal-centered .modal-dialog {
    display: flex;
    align-items: center;
    min-height: calc(100% - 3.5rem);
}

.modal-centered .modal-content {
    margin: 0 auto;
}

/* Processing message styles */
.processing-message {
    padding: 1rem;
    text-align: center;
    color: #6c757d;
}

.processing-message p {
    margin: 0.5rem 0;
}

.processing-subtitle {
    font-size: 0.875rem;
    color: #6c757d;
}

/* Spinner animation for loading states */
.spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    vertical-align: text-bottom;
    border: 0.125em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinner-border 0.75s linear infinite;
}

@keyframes spinner-border {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   BUTTON ENHANCEMENTS
   ============================================ */

/* Button with icon spacing */
.btn i {
    margin-right: 0.5rem;
}

.btn:only-child i {
    margin-right: 0;
}

/* Button sizes */
.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    border-radius: 0.2rem;
}

.btn-lg {
    padding: 0.5rem 1rem;
    font-size: 1.125rem;
    border-radius: 0.3rem;
}

/* Button loading state */
.btn.loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.btn.loading::after {
    content: "";
    position: absolute;
    width: 1rem;
    height: 1rem;
    top: 50%;
    left: 50%;
    margin-left: -0.5rem;
    margin-top: -0.5rem;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinner-border 0.75s linear infinite;
}

/* ============================================
   ACCESSIBILITY ENHANCEMENTS
   ============================================ */

/* Focus visible for keyboard navigation */
.btn:focus-visible,
.modal-header .close:focus-visible {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {

    .modal,
    .modal-content,
    .btn {
        animation: none;
        transition: none;
    }
}

/* ============================================
   RESPONSIVE SIDEBAR STYLES
   ============================================ */

/* Small mobile devices (up to 480px) */
@media (max-width: 480px) {
    .sidebar {
        --sidebar-width: 280px;
        width: 100%;
        max-width: var(--sidebar-width);
        box-shadow: 4px 0 12px rgba(0, 0, 0, 0.15);
    }

    .cache-action-btn {
        padding: 0.625rem;
        font-size: 0.8125rem;
    }

    .note-preview {
        font-size: 0.8125rem;
    }

    .note-full-content {
        font-size: 0.6875rem;
    }
}

/* Mobile devices (481px to 768px) */
@media (min-width: 481px) and (max-width: 768px) {
    .sidebar {
        --sidebar-width: 320px;
        width: 100%;
        max-width: var(--sidebar-width);
        box-shadow: 4px 0 12px rgba(0, 0, 0, 0.15);
    }
}

/* Tablet devices (769px to 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .sidebar {
        --sidebar-width: 300px;
        width: var(--sidebar-width);
    }
}

/* All mobile and tablet devices - overlay backdrop when sidebar is open */
@media (max-width: 1024px) {

    /* Dedicated overlay element */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 990;
        /* Below sidebar (1000) but above content */
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease-in-out, visibility 0.3s;
        pointer-events: none;
    }

    .sidebar-overlay.active {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    .sidebar-content {
        padding: 0.75rem;
    }

    .header-container h1 {
        font-size: 1.25rem;
    }
}

/* Sidebar animation enhancements */
.sidebar {
    will-change: transform;
}

.sidebar.active {
    will-change: auto;
}

/* Smooth transitions for main content when sidebar toggles */
.main-content {
    transition: margin-left 0.3s ease-in-out;
}

/* Main content shift when sidebar is open */
.main-content.sidebar-open {
    margin-left: var(--sidebar-width, 280px);
}

/* On mobile, don't shift content (sidebar overlays) */
@media (max-width: 768px) {
    .main-content.sidebar-open {
        margin-left: 0;
    }
}

/* Ensure sidebar scrollbar doesn't overlap content */
.sidebar-content {
    padding-right: 0.5rem;
}

/* Cached notes scrollbar styling */
#cached-notes::-webkit-scrollbar {
    width: 4px;
}

#cached-notes::-webkit-scrollbar-track {
    background: transparent;
}

#cached-notes::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 2px;
}

#cached-notes::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Improved note card hover effect */
#cached-notes>div {
    position: relative;
}

#cached-notes>div::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 0.5rem;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.05) 0%, rgba(147, 51, 234, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.15s ease-in-out;
    pointer-events: none;
}

#cached-notes>div:hover::before {
    opacity: 1;
}