/* ============================================
   AP POLICE TRAINING PORTAL - Professional UI Components
   Toast Notifications, Loading Spinners, Breadcrumbs
   ============================================ */

/* ============= TOAST NOTIFICATIONS ============= */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    max-width: 420px;
    width: calc(100% - 40px);
}

.toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15), 0 2px 10px rgba(0, 0, 0, 0.08);
    border-left: 4px solid #6b7280;
    animation: toastSlideIn 0.35s cubic-bezier(0.21, 1.02, 0.73, 1);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.toast.toast-exit {
    animation: toastSlideOut 0.3s ease forwards;
}

.toast-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
    color: #fff;
    margin-top: 1px;
}

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

.toast-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: #1a1a2e;
    margin-bottom: 2px;
}

.toast-message {
    font-size: 0.85rem;
    color: #6b7280;
    line-height: 1.4;
    word-wrap: break-word;
}

.toast-close {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 2px;
    flex-shrink: 0;
    transition: color 0.2s;
}

.toast-close:hover {
    color: #374151;
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    border-radius: 0 0 0 12px;
    animation: toastProgress var(--toast-duration, 5s) linear forwards;
}

/* Toast Types */
.toast-success {
    border-left-color: #22c55e;
}
.toast-success .toast-icon {
    background: #22c55e;
}
.toast-success .toast-progress {
    background: #22c55e;
}

.toast-error {
    border-left-color: #ef4444;
}
.toast-error .toast-icon {
    background: #ef4444;
}
.toast-error .toast-progress {
    background: #ef4444;
}

.toast-warning {
    border-left-color: #f59e0b;
}
.toast-warning .toast-icon {
    background: #f59e0b;
}
.toast-warning .toast-progress {
    background: #f59e0b;
}

.toast-info {
    border-left-color: #3b82f6;
}
.toast-info .toast-icon {
    background: #3b82f6;
}
.toast-info .toast-progress {
    background: #3b82f6;
}

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

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

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

/* ============= LOADING SPINNERS ============= */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 99998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.loading-spinner {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.loading-spinner .spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e5e7eb;
    border-top: 4px solid #123e7a;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-spinner.small .spinner {
    width: 20px;
    height: 20px;
    border-width: 2.5px;
}

.loading-spinner.medium .spinner {
    width: 36px;
    height: 36px;
    border-width: 3px;
}

.loading-text {
    margin-top: 16px;
    color: #374151;
    font-size: 0.95rem;
    font-weight: 500;
}

/* Inline spinner for buttons */
.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.8;
}

.btn-loading::after {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin-left: 8px;
    vertical-align: middle;
}

/* Skeleton loading for cards */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s ease-in-out infinite;
    border-radius: 8px;
}

.skeleton-text {
    height: 14px;
    margin-bottom: 8px;
    width: 100%;
}

.skeleton-text.short {
    width: 60%;
}

.skeleton-card {
    height: 200px;
    border-radius: 12px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

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

/* ============= BREADCRUMBS ============= */
.breadcrumb-nav {
    background: #f8fafc;
    border-bottom: 1px solid #e5e7eb;
    padding: 10px 30px;
    font-size: 0.85rem;
}

.breadcrumb-list {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
    max-width: 1200px;
    margin: 0 auto;
}

.breadcrumb-list li {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #6b7280;
}

.breadcrumb-list li a {
    color: #2a5298;
    text-decoration: none;
    transition: color 0.2s;
}

.breadcrumb-list li a:hover {
    color: #123e7a;
    text-decoration: underline;
}

.breadcrumb-list li:last-child {
    color: #374151;
    font-weight: 600;
}

.breadcrumb-separator {
    color: #d1d5db;
    font-size: 0.75rem;
    user-select: none;
}

/* ============= RESPONSIVE ============= */
@media (max-width: 600px) {
    .toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
        width: auto;
    }
    .toast {
        padding: 12px 14px;
    }
    .breadcrumb-nav {
        padding: 8px 15px;
        font-size: 0.8rem;
    }
}
