/**
 * Core Components Styles
 * Unified styling for Toast, Modal, and UI components
 */

/* ── Toast Notifications ── */
.toast-container {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 400px;
    pointer-events: none;
}

.toast-container .toast {
    pointer-events: auto;
    min-width: 300px;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border: none;
    border-radius: 8px;
    overflow: hidden;
}

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

.toast-container .toast.hiding {
    opacity: 0;
    transform: translateX(100%);
}

.toast .toast-body {
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.toast .bi {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.toast-success { border-left: 4px solid #198754 !important; }
.toast-error { border-left: 4px solid #dc3545 !important; }
.toast-warning { border-left: 4px solid #ffc107 !important; }
.toast-info { border-left: 4px solid #0dcaf0 !important; }
.toast-loading { border-left: 4px solid #6c757d !important; }

/* Spin animation for loading */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.bi.spin {
    animation: spin 1s linear infinite;
}

/* ── Modal Enhancements ── */
.modal-backdrop {
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(2px);
}

.modal-content {
    border: none;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.modal-header {
    border-bottom: 1px solid #e9ecef;
    padding: 1.25rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid #e9ecef;
    padding: 1rem 1.5rem;
    gap: 0.5rem;
}

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

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

.skeleton-text {
    height: 1em;
    margin-bottom: 0.5em;
}

.skeleton-text:last-child {
    width: 80%;
}

.skeleton-card {
    height: 120px;
    margin-bottom: 1rem;
}

/* ── Dashboard Card View ── */
/* Drag & Drop Styles only - Bootstrap cards used for layout */
[data-drop-zone].drag-over {
    background: #e3f2fd !important;
    box-shadow: inset 0 0 0 2px #0d6efd;
}

.card[draggable="true"] {
    cursor: grab;
}

.card[draggable="true"].dragging {
    opacity: 0.5;
    cursor: grabbing;
}

/* ── Loading States ── */
.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(2px);
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e9ecef;
    border-top-color: #0d6efd;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* ── Empty States ── */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #6c757d;
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* ── Status Badges ── */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
}

.status-badge::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-open { background: #e9ecef; color: #495057; }
.status-open::before { background: #6c757d; }

.status-inprogress { background: #cfe2ff; color: #084298; }
.status-inprogress::before { background: #0d6efd; animation: pulse 2s infinite; }

.status-done { background: #d1e7dd; color: #0f5132; }
.status-done::before { background: #198754; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ── Animations ── */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

.slide-in-right {
    animation: slideInRight 0.3s ease-out;
}

/* ── Responsive Enhancements ── */
@media (max-width: 768px) {
    .toast-container {
        left: 1rem;
        right: 1rem;
        bottom: 1rem;
    }
    
    .toast-container .toast {
        min-width: auto;
        max-width: none;
    }
}

/* ── Focus States (Accessibility) ── */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
}

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