/**
 * DashStack Admin Dashboard - Custom CSS
 * Additional styles that complement Tailwind
 */

/* ===========================================
   Custom Scrollbar
   =========================================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.dark ::-webkit-scrollbar-thumb {
    background: #475569;
}

.dark ::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* ===========================================
   Sidebar Scrollbar
   =========================================== */
#sidebar nav::-webkit-scrollbar {
    width: 4px;
}

#sidebar nav::-webkit-scrollbar-thumb {
    background: #e2e8f0;
    border-radius: 2px;
}

.dark #sidebar nav::-webkit-scrollbar-thumb {
    background: #334155;
}

/* ===========================================
   Glass Effect (for cards/modals)
   =========================================== */
.glass {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.dark .glass {
    background: rgba(30, 41, 59, 0.7);
}

/* ===========================================
   Soft Shadows
   =========================================== */
.shadow-soft {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05),
                0 2px 4px -2px rgba(0, 0, 0, 0.05);
}

.shadow-soft-lg {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05),
                0 4px 6px -4px rgba(0, 0, 0, 0.05);
}

.shadow-soft-xl {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.05),
                0 8px 10px -6px rgba(0, 0, 0, 0.05);
}

/* ===========================================
   Gradient Backgrounds
   =========================================== */
.bg-gradient-primary {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
}

.bg-gradient-sidebar {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.dark .bg-gradient-sidebar {
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
}

/* ===========================================
   Skeleton Animation
   =========================================== */
@keyframes skeleton-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.skeleton {
    animation: skeleton-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ===========================================
   Transitions
   =========================================== */
.transition-colors-shadow {
    transition-property: color, background-color, border-color, box-shadow;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

/* ===========================================
   Button Hover Effects
   =========================================== */
.btn-hover-lift {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-hover-lift:hover {
    transform: translateY(-2px);
}

/* ===========================================
   Card Hover Effects
   =========================================== */
.card-hover {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-hover:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.15);
}

/* ===========================================
   Badge Animation
   =========================================== */
@keyframes badge-pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.badge-pulse {
    animation: badge-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ===========================================
   Focus Styles
   =========================================== */
.focus-ring {
    outline: none;
}

.focus-ring:focus {
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.3);
}

/* ===========================================
   Dropdown Animations
   =========================================== */
@keyframes dropdown-enter {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

#notificationPanel:not(.hidden),
#userPanel:not(.hidden) {
    animation: dropdown-enter 0.15s ease-out;
}

/* ===========================================
   Sidebar Animation
   =========================================== */
@keyframes sidebar-enter {
    from {
        opacity: 0;
        transform: translateX(-100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ===========================================
   Chart Bar Animation (for future use)
   =========================================== */
@keyframes bar-grow {
    from {
        transform: scaleY(0);
        transform-origin: bottom;
    }
    to {
        transform: scaleY(1);
        transform-origin: bottom;
    }
}

.bar-animate {
    animation: bar-grow 0.5s ease-out forwards;
}

/* ===========================================
   Print Styles
   =========================================== */
@media print {
    #sidebar,
    #sidebarOverlay,
    header {
        display: none !important;
    }
    
    main {
        padding: 0 !important;
    }
    
    .no-print {
        display: none !important;
    }
}

/* ===========================================
   Dark Mode Transitions
   =========================================== */
html {
    color-scheme: light;
}

html.dark {
    color-scheme: dark;
}

/* Smooth theme transition */
html.transitioning,
html.transitioning *,
html.transitioning *::before,
html.transitioning *::after {
    transition: background-color 0.3s ease,
                border-color 0.3s ease,
                color 0.3s ease !important;
}

/* ===========================================
   Custom Form Styles
   =========================================== */
input[type="checkbox"] {
    cursor: pointer;
}

input[type="checkbox"]:checked {
    background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e");
}

/* ===========================================
   Loading Spinner
   =========================================== */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.spinner {
    animation: spin 1s linear infinite;
}

/* ===========================================
   Notification Badge
   =========================================== */
.notification-badge {
    position: relative;
}

.notification-badge::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 8px;
    height: 8px;
    background-color: #ef4444;
    border-radius: 50%;
    border: 2px solid white;
}

.dark .notification-badge::after {
    border-color: #1e293b;
}

/* ===========================================
   Utility Classes
   =========================================== */
.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ===========================================
   Sidebar Collapsed State
   =========================================== */
.sidebar-collapsed .sidebar-text {
    display: none;
}

.sidebar-collapsed .sidebar-logo-text {
    display: none;
}

.sidebar-collapsed .sidebar-badge {
    display: none;
}

.sidebar-collapsed .sidebar-section-title {
    display: none;
}

.sidebar-collapsed .sidebar-widget {
    display: none;
}

.sidebar-collapsed nav ul li a {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

.sidebar-collapsed nav ul li a span:not(.sr-only) {
    display: none;
}

.sidebar-collapsed nav ul li a svg {
    margin: 0;
}

.sidebar-collapsed .sidebar-collapse-btn {
    justify-content: center;
}

/* Tooltip for collapsed sidebar items */
.sidebar-collapsed nav ul li {
    position: relative;
}

.sidebar-collapsed nav ul li:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    background: #1e293b;
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 14px;
    white-space: nowrap;
    z-index: 100;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.dark .sidebar-collapsed nav ul li:hover::after {
    background: #475569;
}

/* Collapse button styles */
.collapse-btn {
    transition: transform 0.3s ease;
}

.collapse-btn.rotate-180 {
    transform: rotate(180deg);
}
