/**
 * ═══════════════════════════════════════════════════════════════
 * ROOTPRO PLATFORM — Global Animations & Enhancements
 * Modern, fluid animations for a premium admin experience
 * ═══════════════════════════════════════════════════════════════
 */

/* ── Page Load Animations ────────────────────────────────────── */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-20px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(20px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
}

@keyframes shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes pulse-soft {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-4px); }
}

@keyframes count-up {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes border-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
    50%      { box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15); }
}

/* ── Animation Utility Classes ───────────────────────────────── */
.animate-fade-in-up {
    animation: fadeInUp 0.5s ease-out both;
}
.animate-fade-in {
    animation: fadeIn 0.4s ease-out both;
}
.animate-slide-in-left {
    animation: slideInLeft 0.4s ease-out both;
}
.animate-slide-in-right {
    animation: slideInRight 0.4s ease-out both;
}
.animate-scale-in {
    animation: scaleIn 0.3s ease-out both;
}
.animate-float {
    animation: float 3s ease-in-out infinite;
}

/* Staggered delays for card grids */
.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.1s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.2s; }
.stagger-5 { animation-delay: 0.25s; }
.stagger-6 { animation-delay: 0.3s; }

/* ── Enhanced Card Styles ────────────────────────────────────── */
.card {
    background: white;
    border-radius: 0.875rem;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.03);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.04);
    transform: translateY(-1px);
}
.card-interactive:hover {
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.12), 0 4px 10px rgba(0, 0, 0, 0.06);
    transform: translateY(-2px);
    border-color: rgba(99, 102, 241, 0.2);
}

/* ── Skeleton Loading ────────────────────────────────────────── */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 37%, #f0f0f0 63%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: 0.5rem;
}
.skeleton-text {
    height: 0.875rem;
    margin-bottom: 0.5rem;
    border-radius: 0.25rem;
}
.skeleton-circle {
    border-radius: 50%;
}
.skeleton-card {
    padding: 1.5rem;
    background: white;
    border-radius: 0.875rem;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

/* ── Toast Notification System ───────────────────────────────── */
#toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}
.toast {
    pointer-events: auto;
    padding: 0.875rem 1.25rem;
    border-radius: 0.75rem;
    min-width: 300px;
    max-width: 420px;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
    animation: slideInRight 0.35s cubic-bezier(0.21, 1.02, 0.73, 1) both;
    font-size: 0.875rem;
    line-height: 1.4;
    border: 1px solid rgba(255, 255, 255, 0.2);
}
.toast-success { background: rgba(16, 185, 129, 0.95); color: white; }
.toast-error   { background: rgba(239, 68, 68, 0.95); color: white; }
.toast-warning { background: rgba(245, 158, 11, 0.95); color: white; }
.toast-info    { background: rgba(99, 102, 241, 0.95); color: white; }

.toast-exit {
    animation: slideInRight 0.3s cubic-bezier(0.4, 0, 0.2, 1) reverse both;
}
.toast .toast-icon {
    flex-shrink: 0;
    width: 1.25rem;
    height: 1.25rem;
    margin-top: 0.1rem;
}
.toast .toast-close {
    flex-shrink: 0;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
    margin-left: auto;
    padding: 0.125rem;
}
.toast .toast-close:hover { opacity: 1; }

/* ── Enhanced Tables ─────────────────────────────────────────── */
.data-table {
    width: 100%;
    font-size: 0.875rem;
}
.data-table thead {
    background: linear-gradient(to bottom, #f9fafb, #f3f4f6);
    border-bottom: 1px solid #e5e7eb;
}
.data-table thead th {
    padding: 0.75rem 1.25rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
}
.data-table tbody tr {
    transition: background-color 0.15s ease;
    border-bottom: 1px solid #f3f4f6;
}
.data-table tbody tr:hover {
    background-color: #f8faff;
}
.data-table tbody td {
    padding: 0.875rem 1.25rem;
}

/* ── Status Badge Enhancements ───────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.4;
    transition: all 0.2s ease;
}
.badge-dot {
    width: 0.375rem;
    height: 0.375rem;
    border-radius: 50%;
    flex-shrink: 0;
}
.badge-active     { background: #ecfdf5; color: #065f46; }
.badge-active .badge-dot { background: #10b981; }
.badge-expiring   { background: #fffbeb; color: #92400e; }
.badge-expiring .badge-dot { background: #f59e0b; animation: pulse-soft 2s infinite; }
.badge-expired    { background: #fef2f2; color: #991b1b; }
.badge-expired .badge-dot { background: #ef4444; }
.badge-pending    { background: #eff6ff; color: #1e40af; }
.badge-pending .badge-dot { background: #3b82f6; animation: pulse-soft 1.5s infinite; }
.badge-onboarding { background: #f5f3ff; color: #5b21b6; }
.badge-onboarding .badge-dot { background: #8b5cf6; }

/* ── Button Enhancements ─────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 0.625rem;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    outline: none;
    border: none;
    position: relative;
    overflow: hidden;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: white;
    box-shadow: 0 1px 3px rgba(99, 102, 241, 0.3);
}
.btn-primary:hover {
    background: linear-gradient(135deg, #4f46e5, #4338ca);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
    transform: translateY(-1px);
}
.btn-secondary {
    background: white;
    color: #374151;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.btn-secondary:hover {
    background: #f9fafb;
    border-color: #d1d5db;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}
.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    box-shadow: 0 1px 3px rgba(239, 68, 68, 0.3);
}
.btn-danger:hover {
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
    transform: translateY(-1px);
}
.btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    box-shadow: 0 1px 3px rgba(16, 185, 129, 0.3);
}
.btn-success:hover {
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
    transform: translateY(-1px);
}

/* ── Stat Card Number Animation ──────────────────────────────── */
.stat-number {
    animation: count-up 0.5s ease-out both;
    font-variant-numeric: tabular-nums;
}

/* ── Modal Enhancements ──────────────────────────────────────── */
.modal-overlay {
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.modal-panel {
    animation: scaleIn 0.25s cubic-bezier(0.4, 0, 0.2, 1) both;
}

/* ── Enhanced Scrollbar ──────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { 
    background: #d1d5db; 
    border-radius: 3px;
    transition: background 0.2s;
}
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

/* ── Page Content Container ──────────────────────────────────── */
.page-content {
    animation: fadeInUp 0.4s ease-out both;
}

/* ── Improved Form Inputs ────────────────────────────────────── */
.form-input {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.625rem;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    background: white;
    outline: none;
}
.form-input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}
.form-input:hover:not(:focus) {
    border-color: #d1d5db;
}

.form-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.375rem;
}

/* ── Stat Card Hover Effects ─────────────────────────────────── */
.stat-card {
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--stat-color, #6366f1), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}
.stat-card:hover::before {
    opacity: 1;
}

/* ── Empty State ─────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
}
.empty-state-icon {
    width: 3.5rem;
    height: 3.5rem;
    margin: 0 auto 1rem;
    animation: float 3s ease-in-out infinite;
}

/* ── Breadcrumb ──────────────────────────────────────────────── */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: #9ca3af;
}
.breadcrumb a {
    color: #6b7280;
    transition: color 0.2s;
    text-decoration: none;
}
.breadcrumb a:hover { color: #6366f1; }
.breadcrumb .separator { color: #d1d5db; }

/* ── Progress Bar ────────────────────────────────────────────── */
.progress-bar {
    height: 0.375rem;
    background: #e5e7eb;
    border-radius: 9999px;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    border-radius: 9999px;
    background: linear-gradient(90deg, #6366f1, #8b5cf6);
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Tooltip ─────────────────────────────────────────────────── */
[data-tooltip] {
    position: relative;
}
[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%) scale(0.95);
    padding: 0.375rem 0.75rem;
    background: #1f2937;
    color: white;
    font-size: 0.75rem;
    border-radius: 0.375rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 50;
}
[data-tooltip]:hover::after {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

/* ── Responsive Adjustments ──────────────────────────────────── */
@media (max-width: 640px) {
    .toast { min-width: auto; max-width: calc(100vw - 2rem); }
    #toast-container { left: 1rem; right: 1rem; }
}

/* ── Print Styles ────────────────────────────────────────────── */
@media print {
    .no-print { display: none !important; }
    .card { box-shadow: none; border: 1px solid #e5e7eb; }
}
