﻿/* Subtle, professional UI animations for the Admin, Distributor and Sub-Distributor panels.
   Loaded after sidebar-fix.css in _AdminLayout, _DistributorLayout and _SubdistributorLayout.
   All effects are short (150-400ms) and are switched off for users who prefer reduced motion. */

/* ---------- Page content: soft fade-in on load ---------- */
@keyframes ui-fade-up {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: none; }
}

@keyframes ui-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.app-content .breadcrumb {
    animation: ui-fade-in .35s ease-out both;
}

/* Final state is "transform: none" so modals inside cards still position correctly */
.app-content .card,
.app-content .rpt-hero,
.app-content .rpt-card {
    animation: ui-fade-up .4s ease-out both;
}

/* Small stagger so cards appear one after another */
.app-content .row > [class*="col-"]:nth-child(2) .card,
.app-content .row > [class*="col-"]:nth-child(2) .rpt-card { animation-delay: .06s; }
.app-content .row > [class*="col-"]:nth-child(3) .card,
.app-content .row > [class*="col-"]:nth-child(3) .rpt-card { animation-delay: .12s; }
.app-content .row > [class*="col-"]:nth-child(4) .card,
.app-content .row > [class*="col-"]:nth-child(4) .rpt-card { animation-delay: .18s; }

/* ---------- Sidebar menu ---------- */
.side-menu__item {
    transition: background-color .2s ease, padding-left .2s ease, color .2s ease;
}

.side-menu__item:hover {
    padding-left: 28px; /* default is 24px */
}

.side-menu__item .side-menu__icon {
    transition: transform .2s ease, color .2s ease;
}

.side-menu__item:hover .side-menu__icon {
    transform: scale(1.12);
    color: #fff;
}

.side-menu__item .angle {
    transition: transform .25s ease;
}


.slide-item {
    transition: padding-left .2s ease, color .2s ease, background-color .2s ease;
}

.slide-item:hover {
    padding-left: 66px; /* default is 60px */
}

/* ---------- Buttons ---------- */
.btn {
    transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease, border-color .15s ease;
}

.btn:hover:not(:disabled):not(.disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(30, 34, 90, .15);
}

.btn:active:not(:disabled):not(.disabled) {
    box-shadow: none;
}

/* ---------- Form fields ---------- */
.form-control {
    transition: border-color .2s ease, box-shadow .2s ease;
}


/* ---------- Tables ---------- */
.table tbody tr {
    transition: background-color .15s ease;
}

.table-hover tbody tr:hover,
.table tbody tr:hover {
    background-color: rgba(84, 88, 179, .05);
}

/* ---------- Dropdowns and modals ---------- */
.dropdown-menu.show {
    animation: ui-fade-in .15s ease-out;
}

.modal.fade .modal-dialog {
    transition: transform .25s ease-out, opacity .25s ease-out;
}

/* =====================================================================
   Sidebar menu animations
   ===================================================================== */

/* Menu items slide in one after another when the page loads */
@keyframes ui-menu-in {
    from { opacity: 0; transform: translateX(-12px); }
    to   { opacity: 1; transform: none; }
}

.side-menu > li {
    animation: ui-menu-in .35s ease-out both;
}

.side-menu > li:nth-child(1)  { animation-delay: .02s; }
.side-menu > li:nth-child(2)  { animation-delay: .04s; }
.side-menu > li:nth-child(3)  { animation-delay: .06s; }
.side-menu > li:nth-child(4)  { animation-delay: .08s; }
.side-menu > li:nth-child(5)  { animation-delay: .10s; }
.side-menu > li:nth-child(6)  { animation-delay: .12s; }
.side-menu > li:nth-child(7)  { animation-delay: .14s; }
.side-menu > li:nth-child(8)  { animation-delay: .16s; }
.side-menu > li:nth-child(9)  { animation-delay: .18s; }
.side-menu > li:nth-child(10) { animation-delay: .20s; }
.side-menu > li:nth-child(11) { animation-delay: .22s; }
.side-menu > li:nth-child(12) { animation-delay: .24s; }
.side-menu > li:nth-child(13) { animation-delay: .26s; }
.side-menu > li:nth-child(14) { animation-delay: .28s; }
.side-menu > li:nth-child(15) { animation-delay: .30s; }
.side-menu > li:nth-child(n+16) { animation-delay: .32s; }

/* Accent bar on the left of the hovered / open menu item */
.side-menu__item::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(#00d2ff, #3a7bd5);
    border-radius: 0 3px 3px 0;
    transform: scaleY(0);
    transition: transform .25s ease;
}

.side-menu__item:hover::before,
.side-menu__item.active::before,
.slide.is-expanded > .side-menu__item::before {
    transform: scaleY(1);
}

/* Open menu: slightly highlighted background with a soft gradient */
.slide.is-expanded > .side-menu__item {
    background: linear-gradient(90deg, rgba(0, 210, 255, .12), rgba(0, 0, 0, .2));
    color: #fff;
}

/* Icon: soft glow on hover and when the menu is open */
.side-menu__item:hover .side-menu__icon,
.slide.is-expanded > .side-menu__item .side-menu__icon {
    color: #fff;
    text-shadow: 0 0 10px rgba(0, 210, 255, .6);
}

/* Submenu: fades in while it opens */
.slide-menu {
    opacity: 0;
    transition: max-height .35s ease, opacity .3s ease;
}

.slide.is-expanded .slide-menu {
    opacity: 1;
}

/* Submenu items appear one after another when a menu is opened */
@keyframes ui-submenu-in {
    from { opacity: 0; transform: translateX(-8px); }
    to   { opacity: 1; transform: none; }
}

.slide.is-expanded .slide-menu > li {
    animation: ui-submenu-in .28s ease-out both;
}

.slide.is-expanded .slide-menu > li:nth-child(1) { animation-delay: .03s; }
.slide.is-expanded .slide-menu > li:nth-child(2) { animation-delay: .06s; }
.slide.is-expanded .slide-menu > li:nth-child(3) { animation-delay: .09s; }
.slide.is-expanded .slide-menu > li:nth-child(4) { animation-delay: .12s; }
.slide.is-expanded .slide-menu > li:nth-child(5) { animation-delay: .15s; }
.slide.is-expanded .slide-menu > li:nth-child(6) { animation-delay: .18s; }
.slide.is-expanded .slide-menu > li:nth-child(n+7) { animation-delay: .21s; }

/* Submenu items: small dot that grows on hover */
.slide-item {
    position: relative;
}

.slide-item::before {
    content: "";
    position: absolute;
    left: 44px;
    top: 50%;
    width: 5px;
    height: 5px;
    margin-top: -2.5px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .35);
    transition: transform .2s ease, background-color .2s ease;
}

.slide-item:hover::before,
.slide-item.active::before {
    transform: scale(1.6);
    background: #00d2ff;
}

.slide-item:hover {
    color: #fff;
}

/* =====================================================================
   Page-wide soft animations (every page of all panels)
   ===================================================================== */

/* Whole page content fades in softly (opacity only, so fixed popups are not affected) */
.app-content {
    animation: ui-fade-in .35s ease-out both;
}

/* Top header slides down slightly on load */
@keyframes ui-slide-down {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: none; }
}

.main-navbar {
    animation: ui-slide-down .35s ease-out both;
}

/* Card headers: title fades in after the card */
.card .card-header h4,
.card .card-header h5 {
    animation: ui-fade-in .4s ease-out .1s both;
}

/* Cards: soft shadow on hover */
.app-content .card {
    transition: box-shadow .25s ease;
}

.app-content .card:hover {
    box-shadow: 0 8px 24px rgba(30, 34, 90, .10);
}

/* Table rows appear one after another (first rows only, the rest show immediately) */
.app-content .table > tbody > tr {
    animation: ui-fade-in .3s ease-out both;
}

.app-content .table > tbody > tr:nth-child(1)  { animation-delay: .03s; }
.app-content .table > tbody > tr:nth-child(2)  { animation-delay: .06s; }
.app-content .table > tbody > tr:nth-child(3)  { animation-delay: .09s; }
.app-content .table > tbody > tr:nth-child(4)  { animation-delay: .12s; }
.app-content .table > tbody > tr:nth-child(5)  { animation-delay: .15s; }
.app-content .table > tbody > tr:nth-child(6)  { animation-delay: .18s; }
.app-content .table > tbody > tr:nth-child(7)  { animation-delay: .21s; }
.app-content .table > tbody > tr:nth-child(8)  { animation-delay: .24s; }
.app-content .table > tbody > tr:nth-child(9)  { animation-delay: .27s; }
.app-content .table > tbody > tr:nth-child(n+10) { animation-delay: .3s; }

/* Table header: soft underline accent */
.app-content .table > thead > tr > th {
    transition: background-color .2s ease, color .2s ease;
}

.app-content .table > thead > tr > th:hover {
    color: #3b3fb6;
}

/* Pagination buttons */
.pagination .page-link {
    transition: background-color .2s ease, color .2s ease, transform .15s ease;
}

.pagination .page-link:hover {
    transform: translateY(-1px);
}

/* Alerts and messages slide in */
.alert {
    animation: ui-fade-up .35s ease-out both;
}

/* Links: smooth color change */
.app-content a {
    transition: color .2s ease;
}

/* Header icons (menu, notifications, fullscreen): soft hover */
.main-navbar .nav-link i {
    transition: transform .2s ease, color .2s ease;
}

.main-navbar .nav-link:hover i {
    transform: scale(1.12);
}

/* Profile picture in the header */
.main-navbar .dropdown-toggle img {
    transition: box-shadow .2s ease;
}

.main-navbar .dropdown-toggle:hover img {
    box-shadow: 0 0 0 3px rgba(84, 88, 179, .25);
}

/* Select2 dropdowns open softly */
.select2-dropdown {
    animation: ui-fade-in .15s ease-out;
}

/* ---------- Buttons: soft shine, focus ring and press effect ---------- */
.btn {
    position: relative;
    overflow: hidden;
}

/* A soft light sweep across the button on hover */
.btn::after {
    content: "";
    position: absolute;
    top: 0;
    left: -75%;
    width: 50%;
    height: 100%;
    background: linear-gradient(120deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, .35) 50%, rgba(255, 255, 255, 0) 100%);
    transform: skewX(-20deg);
    pointer-events: none;
    transition: left .6s ease;
}

.btn:hover:not(:disabled):not(.disabled)::after {
    left: 125%;
}

/* Clear focus ring for keyboard users */
.btn:focus,
.btn.focus {
    box-shadow: 0 0 0 3px rgba(0, 198, 255, .30);
    outline: none;
}

/* Pressed state */
.btn:active:not(:disabled):not(.disabled) {
    transform: scale(.98);
}

/* Disabled buttons: no animation */
.btn:disabled,
.btn.disabled {
    transform: none !important;
    box-shadow: none !important;
}

/* Icons inside buttons move slightly on hover */
.btn i {
    transition: transform .2s ease;
}

.btn:hover:not(:disabled):not(.disabled) i {
    transform: translateX(2px);
}

/* =====================================================================
   Input fields: soft highlight on hover and focus
   (text boxes, dropdowns, text areas, date pickers, Select2, input groups)
   ===================================================================== */

@keyframes ui-focus-glow {
    0%   { box-shadow: 0 0 0 0 rgba(0, 198, 255, .35); }
    100% { box-shadow: 0 0 0 4px rgba(0, 198, 255, .15); }
}

.form-control,
select,
textarea,
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="tel"],
input[type="date"],
input[type="search"],
.select2-container .select2-selection,
.input-group-text {
    transition: border-color .25s ease, box-shadow .25s ease, background-color .25s ease;
}

/* Hover: border becomes slightly darker */
.form-control:hover:not(:disabled):not([readonly]),
select:hover:not(:disabled),
textarea:hover:not(:disabled):not([readonly]),
.select2-container:hover .select2-selection {
    border-color: rgba(84, 88, 179, .45);
}

/* Focus: blue border + soft glow that grows in */
.form-control:focus,
select:focus,
textarea:focus,
input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
input[type="tel"]:focus,
input[type="date"]:focus,
input[type="search"]:focus,
.select2-container--focus .select2-selection,
.select2-container--open .select2-selection {
    border-color: #00a8e8 !important;
    background-color: #fbfdff;
    outline: none;
    animation: ui-focus-glow .3s ease-out both;
}

/* Read-only / disabled fields: no highlight */
.form-control[readonly]:focus,
.form-control:disabled {
    animation: none;
    box-shadow: none;
    border-color: inherit;
}

/* Input groups (e.g. calendar icon + date box): the icon lights up with the field */
.input-group:focus-within .input-group-text {
    border-color: #00a8e8;
    background-color: #e8f8fe;
    color: #0088c2;
}

.input-group:focus-within .input-group-text i {
    transform: scale(1.1);
    transition: transform .2s ease;
}

/* Label of the field that has focus */
.form-group:focus-within > label,
.form-group:focus-within .control-label {
    color: #3b3fb6;
    transition: color .2s ease;
}

/* Checkboxes and radio buttons */
input[type="checkbox"],
input[type="radio"] {
    transition: box-shadow .2s ease;
}

input[type="checkbox"]:focus,
input[type="radio"]:focus {
    box-shadow: 0 0 0 3px rgba(0, 198, 255, .25);
    outline: none;
}

/* Validation error fields: soft red glow instead of the blue one */
.form-control.input-validation-error,
.form-control.field-validation-error,
.input-validation-error {
    border-color: #e74c3c !important;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, .12);
}

/* ---------- Accessibility: no motion for users who ask for it ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-delay: 0s !important;
        transition-duration: .01ms !important;
    }
}
