/* =================================
   GyanRank - Modern Animation Styles
   Version 2.0 with Advanced Effects
   ================================= */

/* ============ CSS Variables ============ */
:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --success-gradient: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    --danger-gradient: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
    --warning-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --info-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --dark-gradient: linear-gradient(135deg, #434343 0%, #000000 100%);
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.16);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.20);
    
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* ============ Keyframe Animations ============ */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-15px);
    }
}

@keyframes rotateIn {
    from {
        opacity: 0;
        transform: rotate(-180deg) scale(0.5);
    }
    to {
        opacity: 1;
        transform: rotate(0deg) scale(1);
    }
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

@keyframes gradient {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

@keyframes slideDown {
    from {
        max-height: 0;
        opacity: 0;
    }
    to {
        max-height: 500px;
        opacity: 1;
    }
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(102, 126, 234, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(102, 126, 234, 0.8), 0 0 30px rgba(102, 126, 234, 0.6);
    }
}

@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(2.5);
        opacity: 0;
    }
}

/* ============ General Styles ============ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    background-attachment: fixed;
    overflow-x: hidden;
}

/* Smooth Scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

/* ============ Card Animations ============ */

.card {
    border: none !important;
    border-radius: 16px !important;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
    animation: fadeInUp 0.5s ease;
    overflow: hidden;
    position: relative;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.card:hover::before {
    left: 100%;
}

.card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--shadow-xl);
}

.card-header {
    background: var(--primary-gradient) !important;
    color: white !important;
    border: none !important;
    padding: 1.25rem !important;
    font-weight: 600;
    position: relative;
    overflow: hidden;
}

.card-header::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    animation: float 6s ease-in-out infinite;
}

/* ============ Button Animations ============ */

.btn {
    border-radius: 50px !important;
    padding: 0.75rem 2rem !important;
    font-weight: 600 !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
    border: none !important;
    box-shadow: var(--shadow-sm);
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.btn:active {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-primary {
    background: var(--primary-gradient) !important;
}

.btn-success {
    background: var(--success-gradient) !important;
}

.btn-danger {
    background: var(--danger-gradient) !important;
}

.btn-warning {
    background: var(--warning-gradient) !important;
}

.btn-info {
    background: var(--info-gradient) !important;
}

/* ============ Input Animations ============ */

.form-control, .form-select {
    border-radius: 12px !important;
    border: 2px solid #e0e0e0 !important;
    padding: 0.875rem 1.25rem !important;
    transition: all var(--transition-normal);
    background: white;
}

.form-control:focus, .form-select:focus {
    border-color: #667eea !important;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1) !important;
    transform: translateY(-2px);
}

.form-label {
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
    display: block;
    transition: color var(--transition-fast);
}

.form-control:focus + .form-label {
    color: #667eea;
}

/* ============ Table Animations ============ */

.table {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.table thead {
    background: var(--primary-gradient);
    color: white;
}

.table thead th {
    border: none !important;
    padding: 1rem !important;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.5px;
}

.table tbody tr {
    transition: all var(--transition-fast);
    animation: fadeIn 0.5s ease;
}

.table tbody tr:hover {
    background: linear-gradient(90deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    transform: scale(1.01);
    box-shadow: var(--shadow-sm);
}

.table tbody td {
    padding: 1rem !important;
    vertical-align: middle;
    border-color: #f0f0f0 !important;
}

/* ============ Badge Animations ============ */

.badge {
    padding: 0.5rem 1rem !important;
    border-radius: 50px !important;
    font-weight: 600 !important;
    letter-spacing: 0.3px;
    animation: bounceIn 0.6s ease;
    transition: all var(--transition-fast);
}

.badge:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-md);
}

/* ============ Alert Animations ============ */

.alert {
    border-radius: 12px !important;
    border: none !important;
    padding: 1.25rem 1.5rem !important;
    box-shadow: var(--shadow-md);
    animation: slideInUp 0.5s ease;
}

.alert-success {
    background: linear-gradient(135deg, rgba(17, 153, 142, 0.1) 0%, rgba(56, 239, 125, 0.1) 100%);
    border-left: 4px solid #11998e !important;
}

.alert-danger {
    background: linear-gradient(135deg, rgba(235, 51, 73, 0.1) 0%, rgba(244, 92, 67, 0.1) 100%);
    border-left: 4px solid #eb3349 !important;
}

.alert-warning {
    background: linear-gradient(135deg, rgba(240, 147, 251, 0.1) 0%, rgba(245, 87, 108, 0.1) 100%);
    border-left: 4px solid #f093fb !important;
}

.alert-info {
    background: linear-gradient(135deg, rgba(79, 172, 254, 0.1) 0%, rgba(0, 242, 254, 0.1) 100%);
    border-left: 4px solid #4facfe !important;
}

/* ============ Stat Icons ============ */

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: white;
    animation: rotateIn 0.8s ease;
    transition: all var(--transition-normal);
}

.stat-icon:hover {
    animation: pulse 1s ease infinite;
    transform: scale(1.1);
}

.bg-gradient-primary {
    background: var(--primary-gradient) !important;
}

.bg-gradient-success {
    background: var(--success-gradient) !important;
}

.bg-gradient-danger {
    background: var(--danger-gradient) !important;
}

.bg-gradient-warning {
    background: var(--warning-gradient) !important;
}

.bg-gradient-info {
    background: var(--info-gradient) !important;
}

/* ============ Navbar/Header Animations ============ */

.navbar {
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95) !important;
    animation: fadeInDown 0.5s ease;
}

.navbar-brand {
    transition: all var(--transition-normal);
}

.navbar-brand:hover {
    transform: scale(1.05);
}

.nav-link {
    position: relative;
    transition: all var(--transition-fast);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--primary-gradient);
    transition: all var(--transition-normal);
    transform: translateX(-50%);
}

.nav-link:hover::after {
    width: 80%;
}

/* ============ Sidebar Animations ============ */

.sidebar {
    animation: fadeInLeft 0.5s ease;
    box-shadow: var(--shadow-lg);
}

.list-group-item {
    border: none !important;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.list-group-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0;
    background: var(--primary-gradient);
    transition: width var(--transition-normal);
}

.list-group-item:hover::before {
    width: 4px;
}

.list-group-item:hover {
    background: linear-gradient(90deg, rgba(102, 126, 234, 0.1) 0%, transparent 100%) !important;
    transform: translateX(5px);
    color: #667eea !important;
}

.list-group-item.active::before {
    width: 4px;
}

/* ============ Modal Animations ============ */

.modal.fade .modal-dialog {
    transition: transform 0.3s ease-out;
    transform: scale(0.8);
}

.modal.show .modal-dialog {
    transform: scale(1);
}

.modal-content {
    border-radius: 16px !important;
    border: none !important;
    box-shadow: var(--shadow-xl);
    animation: zoomIn 0.3s ease;
}

.modal-header {
    background: var(--primary-gradient);
    color: white;
    border-radius: 16px 16px 0 0 !important;
    border: none !important;
}

.modal-footer {
    border: none !important;
}

/* ============ Loading Animations ============ */

.spinner-border {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.3s ease;
}

/* ============ Utility Classes ============ */

.animate-fade-in {
    animation: fadeIn 0.5s ease;
}

.animate-fade-in-up {
    animation: fadeInUp 0.5s ease;
}

.animate-fade-in-down {
    animation: fadeInDown 0.5s ease;
}

.animate-fade-in-left {
    animation: fadeInLeft 0.5s ease;
}

.animate-fade-in-right {
    animation: fadeInRight 0.5s ease;
}

.animate-zoom-in {
    animation: zoomIn 0.5s ease;
}

.animate-bounce-in {
    animation: bounceIn 0.6s ease;
}

.animate-slide-in-up {
    animation: slideInUp 0.5s ease;
}

.animate-float {
    /* Disabled for performance - was: animation: float 3s ease-in-out infinite; */
}

.animate-pulse {
    /* Disabled for performance - was: animation: pulse 2s ease-in-out infinite; */
}

.animate-glow {
    /* Disabled for performance - was: animation: glow 2s ease-in-out infinite; */
}

/* Stagger animations for lists */
.stagger-animation > * {
    animation: fadeInUp 0.3s ease;
}

.stagger-animation > *:nth-child(1) { animation-delay: 0.05s; }
.stagger-animation > *:nth-child(2) { animation-delay: 0.1s; }
.stagger-animation > *:nth-child(3) { animation-delay: 0.15s; }
.stagger-animation > *:nth-child(4) { animation-delay: 0.2s; }
.stagger-animation > *:nth-child(5) { animation-delay: 0.25s; }
.stagger-animation > *:nth-child(6) { animation-delay: 0.3s; }

/* ============ Hover Effects ============ */

.hover-lift {
    transition: all 0.2s ease;
}

.hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.hover-scale {
    transition: transform var(--transition-normal);
}

.hover-scale:hover {
    transform: scale(1.05);
}

.hover-rotate {
    transition: transform var(--transition-normal);
}

.hover-rotate:hover {
    transform: rotate(5deg);
}

/* ============ Gradient Text ============ */

.gradient-text {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: bold;
    animation: gradient 3s ease infinite;
    background-size: 200% 200%;
}

/* ============ Glass Morphism ============ */

.glass {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: var(--shadow-lg);
}

/* ============ Progress Bars ============ */

.progress {
    border-radius: 50px !important;
    height: 12px !important;
    background: #e9ecef;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.progress-bar {
    background: var(--primary-gradient) !important;
    animation: slideInLeft 1s ease;
    position: relative;
    overflow: hidden;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

/* ============ Breadcrumb ============ */

.breadcrumb {
    background: transparent !important;
    padding: 0 !important;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: '›';
    font-size: 1.5rem;
    color: #667eea;
}

.breadcrumb-item a {
    text-decoration: none;
    color: #667eea;
    transition: all var(--transition-fast);
}

.breadcrumb-item a:hover {
    color: #764ba2;
    transform: translateX(3px);
}

/* ============ Pagination ============ */

.pagination .page-link {
    border-radius: 8px !important;
    margin: 0 3px;
    border: none;
    color: #667eea;
    transition: all var(--transition-fast);
}

.pagination .page-link:hover {
    background: var(--primary-gradient);
    color: white;
    transform: translateY(-2px);
}

.pagination .page-item.active .page-link {
    background: var(--primary-gradient);
    border: none;
}

/* ============ Responsive Animations ============ */

@media (max-width: 768px) {
    .card:hover {
        transform: translateY(-4px) scale(1.01);
    }
    
    .btn {
        padding: 0.625rem 1.5rem !important;
    }
    
    .stat-icon {
        width: 50px;
        height: 50px;
        font-size: 24px;
    }
}

/* ============ Print Styles ============ */

@media print {
    body {
        background: white;
    }
    
    .card {
        box-shadow: none;
        page-break-inside: avoid;
    }
    
    .btn, .sidebar, .navbar {
        display: none;
    }
}

/* ============ Dark Mode Support ============ */

@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
        color: #e0e0e0;
    }
    
    .card {
        background: rgba(255, 255, 255, 0.05);
        color: #e0e0e0;
    }
    
    .form-control, .form-select {
        background: rgba(255, 255, 255, 0.05);
        color: #e0e0e0;
        border-color: rgba(255, 255, 255, 0.1) !important;
    }
}

/* ============ Accessibility ============ */

.focus-visible:focus {
    outline: 3px solid #667eea;
    outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
