/**
 * Quick Notes CSS - Animations and Polish
 * Enhanced styling for the Quick Notes feature
 */

/* Loading Animation Classes */
.btn-loading {
    position: relative;
    pointer-events: none;
}

.btn-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Modal Animations */
.modal.fade .modal-dialog {
    transform: scale(0.8);
    transition: transform 0.3s ease-out;
}

.modal.show .modal-dialog {
    transform: scale(1);
}

/* Screenshot Preview Animations */
.screenshot-preview-container {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
}

.screenshot-preview-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Toast Animations */
.toast {
    transform: translateX(100%);
    transition: transform 0.3s ease-out;
}

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

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

/* Quick Note Button Hover Effects */
.quick-note-trigger {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.quick-note-trigger::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(13, 110, 253, 0.1);
    border-radius: 50%;
    transition: all 0.3s ease;
    transform: translate(-50%, -50%);
    z-index: 0;
}

.quick-note-trigger:hover::before {
    width: 200px;
    height: 200px;
}

.quick-note-trigger:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Form Field Focus Animations */
.form-control:focus,
.form-select:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
    transform: scale(1.02);
    transition: all 0.3s ease;
}

/* Widget Preview Card Animations */
#widgetPreview {
    transform: translateY(10px);
    opacity: 0;
    transition: all 0.4s ease;
}

#widgetPreview.show {
    transform: translateY(0);
    opacity: 1;
}

/* Progress Indicators */
.capture-progress {
    position: relative;
}

.capture-progress::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        45deg,
        rgba(13, 110, 253, 0.1) 25%,
        transparent 25%,
        transparent 50%,
        rgba(13, 110, 253, 0.1) 50%,
        rgba(13, 110, 253, 0.1) 75%,
        transparent 75%
    );
    background-size: 20px 20px;
    animation: move-stripes 1s linear infinite;
}

@keyframes move-stripes {
    0% { background-position: 0 0; }
    100% { background-position: 20px 0; }
}

/* Success State Animations */
.btn-success {
    animation: success-bounce 0.6s ease;
}

@keyframes success-bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

/* Error State Animations */
.btn-danger {
    animation: error-shake 0.6s ease;
}

@keyframes error-shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* Loading Skeleton */
.loading-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Micro Interactions */
.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    transition: all 0.3s ease;
}

/* Icon Animations */
.ri-sticky-note-line {
    transition: transform 0.3s ease;
}

.quick-note-trigger:hover .ri-sticky-note-line {
    transform: rotate(5deg) scale(1.1);
}

/* Modal Content Fade In */
.modal-body > * {
    animation: fadeInUp 0.4s ease forwards;
    opacity: 0;
    transform: translateY(20px);
}

.modal-body > *:nth-child(1) { animation-delay: 0.1s; }
.modal-body > *:nth-child(2) { animation-delay: 0.2s; }
.modal-body > *:nth-child(3) { animation-delay: 0.3s; }
.modal-body > *:nth-child(4) { animation-delay: 0.4s; }

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Enhanced Button States */
.btn {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

/* Responsive Animations */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .loading-skeleton {
        background: linear-gradient(90deg, #2d2d2d 25%, #3d3d3d 50%, #2d2d2d 75%);
        background-size: 200% 100%;
    }

    .capture-progress::after {
        background: linear-gradient(
            45deg,
            rgba(255, 255, 255, 0.1) 25%,
            transparent 25%,
            transparent 50%,
            rgba(255, 255, 255, 0.1) 50%,
            rgba(255, 255, 255, 0.1) 75%,
            transparent 75%
        );
    }
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .modal-dialog {
        margin: 1rem;
        max-width: calc(100% - 2rem);
    }

    .modal-body {
        padding: 1rem;
    }

    .btn-loading::after {
        width: 14px;
        height: 14px;
        margin: -7px 0 0 -7px;
    }
}

/* Touch Interactions */
@media (hover: none) and (pointer: coarse) {
    .quick-note-trigger:hover::before {
        display: none;
    }

    .quick-note-trigger:active {
        transform: scale(0.95);
    }

    .card:hover {
        transform: none;
        box-shadow: none;
    }

    .card:active {
        transform: scale(0.98);
    }
}