/* =============================================
   Velgraf App — Global Styles & Animations
   ============================================= */

/* --- Animations --- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(12px); }
    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 slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-6px); }
}
@keyframes pulse-ring {
    0%   { transform: scale(0.9); opacity: 0.7; }
    100% { transform: scale(1.4); opacity: 0; }
}
@keyframes gradient-shift {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
@keyframes countUp {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
}

/* --- Animation utilities --- */
.animate-fade-in      { animation: fadeIn 0.4s ease-out both; }
.animate-fade-in-up   { animation: fadeInUp 0.4s ease-out both; }
.animate-slide-left   { animation: slideInLeft 0.35s ease-out both; }
.animate-slide-down   { animation: slideDown 0.3s ease-out both; }
.animate-scale-in     { animation: scaleIn 0.3s ease-out both; }
.animate-float        { animation: float 3s ease-in-out infinite; }
.animate-gradient     {
    background-size: 200% 200%;
    animation: gradient-shift 8s ease infinite;
}

/* Stagger children */
.stagger-children > * { animation: fadeInUp 0.4s ease-out both; }
.stagger-children > *:nth-child(1) { animation-delay: 0ms; }
.stagger-children > *:nth-child(2) { animation-delay: 50ms; }
.stagger-children > *:nth-child(3) { animation-delay: 100ms; }
.stagger-children > *:nth-child(4) { animation-delay: 150ms; }
.stagger-children > *:nth-child(5) { animation-delay: 200ms; }
.stagger-children > *:nth-child(6) { animation-delay: 250ms; }
.stagger-children > *:nth-child(7) { animation-delay: 300ms; }
.stagger-children > *:nth-child(8) { animation-delay: 350ms; }

/* --- Enhanced Sidebar --- */
.sidebar-wrapper {
    background: linear-gradient(180deg, #0a2547 0%, #0d2c54 50%, #0f3460 100%);
}
.sidebar-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at top left, rgba(26,127,245,.10) 0%, transparent 60%);
    pointer-events: none;
}
.sidebar-logo {
    position: relative;
}
.sidebar-logo::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(26,127,245,.25), transparent);
}
.sidebar-link {
    position: relative;
    transition: all 0.2s cubic-bezier(.4,0,.2,1);
}
.sidebar-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%) scaleY(0);
    width: 3px;
    height: 60%;
    border-radius: 0 4px 4px 0;
    background: linear-gradient(180deg, #60b5ff, #1a7ff5);
    transition: transform 0.2s cubic-bezier(.4,0,.2,1);
}
.sidebar-link.active::before,
.sidebar-link:hover::before {
    transform: translateY(-50%) scaleY(1);
}
.sidebar-link.active {
    background: linear-gradient(90deg, rgba(26,127,245,.16), rgba(26,127,245,.05));
    color: #bce0ff;
    border-right: none;
}
.sidebar-link:hover {
    background: rgba(26,127,245,.10);
    color: #bce0ff;
}
.sidebar-link i {
    transition: transform 0.2s ease;
}
.sidebar-link:hover i {
    transform: scale(1.1);
}
.sidebar-section {
    position: relative;
    padding-left: 0.75rem;
}
.sidebar-section::before {
    content: '';
    position: absolute;
    left: 0.75rem;
    right: 0.75rem;
    top: 0;
    height: 1px;
    background: linear-gradient(90deg, rgba(255,255,255,.04), rgba(255,255,255,.08), rgba(255,255,255,.04));
}

/* --- Enhanced Cards --- */
.card {
    transition: all 0.25s cubic-bezier(.4,0,.2,1);
}
.card:hover {
    box-shadow: 0 4px 20px -4px rgba(0,0,0,.08), 0 2px 8px -2px rgba(0,0,0,.04);
}
.card-interactive:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px -8px rgba(0,0,0,.1), 0 4px 12px -4px rgba(0,0,0,.05);
}

/* --- Enhanced Tables --- */
.data-table thead {
    position: sticky;
    top: 0;
    z-index: 5;
}
.data-table thead th {
    backdrop-filter: blur(8px);
}
.data-table tbody tr {
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
}
.data-table tbody tr:hover {
    background-color: rgba(26,127,245,.04) !important;
}
.data-table tbody tr:nth-child(even) {
    background-color: rgba(248,250,252,.5);
}
.data-table tbody tr:nth-child(even):hover {
    background-color: rgba(26,127,245,.05) !important;
}

/* --- Buttons --- */
.btn-primary {
    position: relative;
    overflow: hidden;
    transition: all 0.2s cubic-bezier(.4,0,.2,1);
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px -2px rgba(26,127,245,.35);
}
.btn-primary:active {
    transform: translateY(0);
}
.btn-primary::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,.15) 0%, transparent 50%);
    pointer-events: none;
}
.btn-ghost {
    transition: all 0.2s ease;
}
.btn-ghost:hover {
    background-color: rgba(241,245,249,.8);
}

/* --- Status Dots --- */
.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    position: relative;
}
.status-dot::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    animation: pulse-ring 2s ease-out infinite;
}
.status-dot.bg-emerald-500::after { background: rgba(16,185,129,.3); }
.status-dot.bg-red-500::after     { background: rgba(239,68,68,.3); }
.status-dot.bg-amber-500::after   { background: rgba(245,158,11,.3); }

/* --- Flash Messages --- */
.flash-message {
    animation: slideDown 0.35s ease-out both;
    position: relative;
    overflow: hidden;
}
.flash-message::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
}
.flash-message.flash-success::before { background: linear-gradient(180deg, #10b981, #059669); }
.flash-message.flash-error::before   { background: linear-gradient(180deg, #ef4444, #dc2626); }
.flash-message.flash-warning::before { background: linear-gradient(180deg, #f59e0b, #d97706); }
.flash-message .flash-close {
    transition: all 0.15s ease;
}
.flash-message .flash-close:hover {
    background: rgba(0,0,0,.05);
    border-radius: 50%;
}

/* --- Form inputs --- */
input[type="text"], input[type="number"], input[type="email"],
input[type="password"], input[type="search"], input[type="tel"],
input[type="url"], input[type="date"], select, textarea {
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}
input:focus, select:focus, textarea:focus {
    border-color: #60b5ff;
    box-shadow: 0 0 0 3px rgba(26,127,245,.12), 0 1px 2px rgba(0,0,0,.05);
}

/* --- Badges / Pills --- */
.badge {
    transition: all 0.15s ease;
}
.badge:hover {
    filter: brightness(0.95);
}

/* --- Page content entry --- */
.page-content {
    animation: fadeInUp 0.35s ease-out both;
}

/* --- Login page --- */
.login-bg {
    background: linear-gradient(135deg, #0a1f3c 0%, #0f3460 30%, #1654ae 60%, #0d2c54 100%);
    background-size: 200% 200%;
    animation: gradient-shift 12s ease infinite;
    position: relative;
}
.login-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(26,127,245,.18) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(96,181,255,.12) 0%, transparent 40%),
        radial-gradient(ellipse at 60% 80%, rgba(19,103,217,.14) 0%, transparent 50%);
    pointer-events: none;
}
.login-card {
    background: rgba(255,255,255,.06);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,.08);
    box-shadow: 0 20px 60px -10px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.1);
}
.login-input {
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.08);
    color: white;
    transition: all 0.25s ease;
}
.login-input:focus {
    background: rgba(255,255,255,.07);
    border-color: rgba(96,181,255,.5);
    box-shadow: 0 0 0 3px rgba(26,127,245,.18);
}
.login-input::placeholder { color: rgba(148,163,184,.5); }
.login-btn {
    background: linear-gradient(135deg, #1a7ff5, #1367d9);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}
.login-btn:hover {
    background: linear-gradient(135deg, #60b5ff, #1a7ff5);
    box-shadow: 0 8px 25px -5px rgba(26,127,245,.4);
    transform: translateY(-1px);
}
.login-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.1), transparent);
    transition: left 0.5s ease;
}
.login-btn:hover::before {
    left: 100%;
}

/* --- Stat Cards --- */
.stat-card {
    position: relative;
    overflow: hidden;
    transition: all 0.25s cubic-bezier(.4,0,.2,1);
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px -8px rgba(0,0,0,.1);
}
.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    transform: translate(30%, -30%);
    opacity: 0.04;
}
.stat-card .stat-value {
    animation: countUp 0.5s ease-out both;
}

/* --- Error pages --- */
.error-icon {
    animation: float 3s ease-in-out infinite;
}
.error-code {
    font-size: 6rem;
    font-weight: 800;
    line-height: 1;
    background: linear-gradient(135deg, #cbd5e1, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* --- Empty States --- */
.empty-state-icon {
    animation: float 4s ease-in-out infinite;
}

/* --- Pagination --- */
.pagination-link {
    transition: all 0.2s ease;
}
.pagination-link:hover {
    transform: translateY(-1px);
}
.pagination-link.active {
    box-shadow: 0 2px 8px -2px rgba(26,127,245,.3);
}

/* --- Action row icons --- */
.action-icons {
    opacity: 0;
    transition: opacity 0.2s ease;
}
tr:hover .action-icons,
.action-icons:focus-within {
    opacity: 1;
}

/* --- Progress bars --- */
.progress-bar {
    transition: width 0.8s cubic-bezier(.4,0,.2,1);
}

/* --- Tooltip --- */
[title] {
    position: relative;
}

/* --- Print media query --- */
@media print {
    .no-print { display: none !important; }
    .data-table thead { position: static; }
    .sidebar-wrapper { display: none !important; }
    .page-content { animation: none; }
    body { background: white; }
}

/* --- Scrollbar (refined) --- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: #e2e8f0;
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
.sidebar-wrapper::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); }
.sidebar-wrapper::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.2); }

/* --- Misc --- */
.gradient-text {
    background: linear-gradient(135deg, #1a7ff5, #60b5ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.glass {
    background: rgba(255,255,255,.7);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,.2);
}
.divider-gradient {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(203,213,225,.5), transparent);
}
