/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body, #root { height: 100%; width: 100%; }
body {
    font-family: 'Roboto', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow: hidden;
}

/* === Haptics: Micro-interactions === */
.haptic-btn {
    transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease !important;
    cursor: pointer;
}
.haptic-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.haptic-btn:active {
    transform: scale(0.95) translateY(0);
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

/* Card hover lift with glow */
.haptic-card {
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.25s ease,
                border-color 0.25s ease !important;
}
.haptic-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.12), 0 4px 8px rgba(0,0,0,0.06);
}

/* KPI count-up animation */
@keyframes countUp {
    from { opacity: 0; transform: translateY(10px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.kpi-value {
    animation: countUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Page fade-slide-in */
@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}
.page-enter {
    animation: fadeSlideIn 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* Staggered card entrance */
@keyframes staggerIn {
    from { opacity: 0; transform: translateY(20px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.stagger-1 { animation: staggerIn 0.4s 0.05s cubic-bezier(0.25, 0.46, 0.45, 0.94) both; }
.stagger-2 { animation: staggerIn 0.4s 0.1s cubic-bezier(0.25, 0.46, 0.45, 0.94) both; }
.stagger-3 { animation: staggerIn 0.4s 0.15s cubic-bezier(0.25, 0.46, 0.45, 0.94) both; }
.stagger-4 { animation: staggerIn 0.4s 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94) both; }

/* DataGrid polished rows */
.MuiDataGrid-root {
    border: none !important;
    border-radius: 12px !important;
}
.MuiDataGrid-row:hover {
    border-left: 3px solid var(--primary, #43B8B0);
}
.MuiDataGrid-columnHeaders {
    border-radius: 12px 12px 0 0 !important;
}

/* Toast slide-in with bounce */
@keyframes slideInRight {
    from { transform: translateX(120%); opacity: 0; }
    60%  { transform: translateX(-4%); opacity: 1; }
    to   { transform: translateX(0); opacity: 1; }
}
.toast-enter {
    animation: slideInRight 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Skeleton shimmer */
@keyframes skeletonShimmer {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
.skeleton {
    animation: skeletonShimmer 1.8s ease-in-out infinite;
    background: linear-gradient(90deg, rgba(0,0,0,0.06) 25%, rgba(0,0,0,0.03) 50%, rgba(0,0,0,0.06) 75%);
    background-size: 200% 100%;
    border-radius: 8px;
}

/* Glassmorphism card (login) */
.glass-card {
    background: rgba(255, 255, 255, 0.08) !important;
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-radius: 20px !important;
}

/* Gradient text utility */
.gradient-text {
    background: linear-gradient(135deg, var(--primary, #43B8B0), var(--secondary, #7AB648));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Theme transition — smooth color morphing */
.theme-transition {
    transition: background-color 0.4s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Scrollbar styling */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(128,128,128,0.25); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(128,128,128,0.4); }

/* === Layout === */
.dashboard-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}
.sidebar {
    width: 260px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
}
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}
.page-content {
    flex: 1;
    overflow-y: auto;
    padding: 28px 32px;
}

/* === Gradient overlays for cards === */
.gradient-card-teal {
    background: linear-gradient(135deg, #43B8B0 0%, #3AA89F 100%) !important;
    color: #fff !important;
}
.gradient-card-blue {
    background: linear-gradient(135deg, #4169E1 0%, #3557C4 100%) !important;
    color: #fff !important;
}
.gradient-card-green {
    background: linear-gradient(135deg, #7AB648 0%, #6AA03D 100%) !important;
    color: #fff !important;
}
.gradient-card-red {
    background: linear-gradient(135deg, #ef5350 0%, #d43a38 100%) !important;
    color: #fff !important;
}
.gradient-card-purple {
    background: linear-gradient(135deg, #A855F7 0%, #8B3FD9 100%) !important;
    color: #fff !important;
}

/* Pulse ring for notifications */
@keyframes pulseRing {
    0%   { box-shadow: 0 0 0 0 rgba(var(--primary-rgb, 67,184,176), 0.4); }
    70%  { box-shadow: 0 0 0 8px rgba(var(--primary-rgb, 67,184,176), 0); }
    100% { box-shadow: 0 0 0 0 rgba(var(--primary-rgb, 67,184,176), 0); }
}
.pulse-dot {
    animation: pulseRing 2s infinite;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .page-content { padding: 16px; }
}
@media (max-width: 1200px) {
    .page-content { padding: 20px 24px; }
}
