/* EazeEditor Custom Styles */

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

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

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

.dark ::-webkit-scrollbar-thumb {
    background: #475569;
}

.dark ::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* Line clamp utility */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Slide-in animation for flash messages */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.animate-slide-in {
    animation: slideIn 0.3s ease-out;
}

/* Toast notification system */
#toast-container {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    pointer-events: none;
    max-width: 420px;
    width: calc(100% - 2.5rem);
}

.toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: 0.75rem;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 4px 10px -6px rgba(0, 0, 0, 0.1);
    animation: toastSlideIn 0.35s cubic-bezier(0.21, 1.02, 0.73, 1) forwards;
    position: relative;
    overflow: hidden;
}

.toast.toast-exiting {
    animation: toastSlideOut 0.3s cubic-bezier(0.06, 0.71, 0.55, 1) forwards;
}

.toast-icon {
    flex-shrink: 0;
    width: 1.375rem;
    height: 1.375rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-icon svg {
    width: 0.875rem;
    height: 0.875rem;
}

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

.toast-title {
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.25rem;
}

.toast-message {
    font-size: 0.8125rem;
    font-weight: 400;
    line-height: 1.375rem;
    margin-top: 0.125rem;
}

.toast-close {
    flex-shrink: 0;
    width: 1.25rem;
    height: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.25rem;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.15s ease, background-color 0.15s ease;
    border: none;
    background: transparent;
    padding: 0;
    color: inherit;
}

.toast-close:hover {
    opacity: 1;
}

.toast-close svg {
    width: 0.75rem;
    height: 0.75rem;
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    border-radius: 0 0 0.75rem 0.75rem;
    animation: toastProgress linear forwards;
}

/* Toast type: error */
.toast-error {
    background: rgba(239, 68, 68, 0.92);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fff;
}
.toast-error .toast-icon { background: rgba(255, 255, 255, 0.2); }
.toast-error .toast-progress { background: rgba(255, 255, 255, 0.4); }
.toast-error .toast-close:hover { background: rgba(255, 255, 255, 0.15); }

/* Toast type: success */
.toast-success {
    background: rgba(16, 185, 129, 0.92);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #fff;
}
.toast-success .toast-icon { background: rgba(255, 255, 255, 0.2); }
.toast-success .toast-progress { background: rgba(255, 255, 255, 0.4); }
.toast-success .toast-close:hover { background: rgba(255, 255, 255, 0.15); }

/* Toast type: warning */
.toast-warning {
    background: rgba(245, 158, 11, 0.92);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #fff;
}
.toast-warning .toast-icon { background: rgba(255, 255, 255, 0.2); }
.toast-warning .toast-progress { background: rgba(255, 255, 255, 0.4); }
.toast-warning .toast-close:hover { background: rgba(255, 255, 255, 0.15); }

/* Toast type: info */
.toast-info {
    background: rgba(6, 182, 212, 0.92);
    border: 1px solid rgba(6, 182, 212, 0.3);
    color: #fff;
}
.toast-info .toast-icon { background: rgba(255, 255, 255, 0.2); }
.toast-info .toast-progress { background: rgba(255, 255, 255, 0.4); }
.toast-info .toast-close:hover { background: rgba(255, 255, 255, 0.15); }

@keyframes toastSlideIn {
    from {
        transform: translateX(100%) scale(0.95);
        opacity: 0;
    }
    to {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
}

@keyframes toastSlideOut {
    from {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
    to {
        transform: translateX(100%) scale(0.95);
        opacity: 0;
    }
}

@keyframes toastProgress {
    from { width: 100%; }
    to { width: 0%; }
}

/* ─── Confirm Modal Dialog ─────────────────────────────────────────────────── */
.confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: confirmFadeIn 0.2s ease-out forwards;
}

.confirm-overlay.confirm-overlay-exiting {
    animation: confirmFadeOut 0.15s ease-in forwards;
}

.confirm-dialog {
    background: #fff;
    border-radius: 1rem;
    padding: 1.75rem;
    max-width: 26rem;
    width: 100%;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    text-align: center;
    animation: confirmScaleIn 0.25s cubic-bezier(0.21, 1.02, 0.73, 1) forwards;
}

.confirm-overlay-exiting .confirm-dialog {
    animation: confirmScaleOut 0.15s ease-in forwards;
}

.dark .confirm-dialog {
    background: #1e293b;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.confirm-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
}

.confirm-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #0f172a;
    margin: 0 0 0.5rem;
}

.dark .confirm-title {
    color: #f1f5f9;
}

.confirm-message {
    font-size: 0.875rem;
    color: #64748b;
    line-height: 1.5;
    margin: 0 0 1.5rem;
}

.dark .confirm-message {
    color: #94a3b8;
}

.confirm-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.confirm-btn-cancel,
.confirm-btn-ok {
    padding: 0.5rem 1.25rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    border: none;
    line-height: 1.25rem;
}

.confirm-btn-cancel {
    background: #f1f5f9;
    color: #475569;
}
.confirm-btn-cancel:hover {
    background: #e2e8f0;
}

.dark .confirm-btn-cancel {
    background: #334155;
    color: #cbd5e1;
}
.dark .confirm-btn-cancel:hover {
    background: #475569;
}

.confirm-btn-ok {
    color: #fff;
}
.confirm-btn-ok:hover {
    filter: brightness(1.1);
}

.confirm-btn-ok:focus,
.confirm-btn-cancel:focus {
    outline: 2px solid #06b6d4;
    outline-offset: 2px;
}

@keyframes confirmFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes confirmFadeOut {
    from { opacity: 1; }
    to   { opacity: 0; }
}
@keyframes confirmScaleIn {
    from { transform: scale(0.95); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}
@keyframes confirmScaleOut {
    from { transform: scale(1); opacity: 1; }
    to   { transform: scale(0.95); opacity: 0; }
}

/* Pulse glow effect */
@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(6, 182, 212, 0.1);
    }
    50% {
        box-shadow: 0 0 40px rgba(6, 182, 212, 0.3);
    }
}

.pulse-glow {
    animation: pulseGlow 3s ease-in-out infinite;
}

/* Code block styling */
.prose pre {
    background: #0f172a;
    border: 1px solid #1e293b;
    border-radius: 0.75rem;
    padding: 1rem;
    overflow-x: auto;
}

.prose code {
    font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
    font-size: 0.875em;
}

.prose :not(pre) > code {
    background: #f1f5f9;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    color: #0e7490;
}

.dark .prose :not(pre) > code {
    background: #1e293b;
    color: #22d3ee;
}

/* Focus visible for accessibility */
*:focus-visible {
    outline: 2px solid #06b6d4;
    outline-offset: 2px;
    border-radius: 4px;
}

/* Selection color */
::selection {
    background: rgba(6, 182, 212, 0.3);
    color: inherit;
}

/* Transition defaults */
* {
    transition-property: background-color, border-color, color, fill, stroke, opacity, box-shadow, transform;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Remove transition for specific elements that shouldn't animate */
input, textarea, select {
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

/* Print styles */
@media print {
    nav, footer, .no-print {
        display: none !important;
    }
    main {
        padding-top: 0 !important;
    }
}

/* ─── Admin Layout Responsive Fixes ────────────────────────────────────────── */

/* Shared admin container — ensures header, content, and footer align identically */
.admin-container {
    width: 100%;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
}

@media (min-width: 640px) {
    .admin-container {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

@media (min-width: 1024px) {
    .admin-container {
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

/* Ensure admin content area fills available width alongside sidebar */
.admin-content-wrapper {
    min-width: 0; /* Prevent flex child overflow */
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Admin content area grows to fill space, pushing footer to bottom */
.admin-content {
    flex: 1 1 0%;
}

/* Prevent admin cards/tables from overflowing on small screens */
.admin-content .overflow-x-auto {
    margin-left: -1rem;
    margin-right: -1rem;
    padding-left: 1rem;
    padding-right: 1rem;
}

@media (min-width: 640px) {
    .admin-content .overflow-x-auto {
        margin-left: -1.5rem;
        margin-right: -1.5rem;
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

@media (min-width: 1024px) {
    .admin-content .overflow-x-auto {
        margin-left: -2rem;
        margin-right: -2rem;
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

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