/* ============================================================
   SECUREBANK ONLINE — PHASE 7: UI/UX ENHANCEMENTS
   Page transitions, loading skeletons, mobile nav,
   success animations, confirmation modals
   ============================================================ */

/* ============================================================
   PAGE TRANSITIONS
   ============================================================ */
.page-transition {
    animation: page-enter 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes page-enter {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-transition-exit {
    animation: page-exit 0.2s ease-in both;
}

@keyframes page-exit {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-8px);
    }
}

/* Staggered content reveal */
.stagger-reveal > * {
    animation: stagger-in 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.stagger-reveal > *:nth-child(1) { animation-delay: 0ms; }
.stagger-reveal > *:nth-child(2) { animation-delay: 60ms; }
.stagger-reveal > *:nth-child(3) { animation-delay: 120ms; }
.stagger-reveal > *:nth-child(4) { animation-delay: 180ms; }
.stagger-reveal > *:nth-child(5) { animation-delay: 240ms; }
.stagger-reveal > *:nth-child(6) { animation-delay: 300ms; }
.stagger-reveal > *:nth-child(7) { animation-delay: 360ms; }
.stagger-reveal > *:nth-child(8) { animation-delay: 420ms; }

@keyframes stagger-in {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================================
   LOADING SKELETONS
   ============================================================ */
.skeleton-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
}

.skeleton-cell {
    height: 14px;
    background: linear-gradient(90deg, var(--border) 25%, var(--bg-hover) 50%, var(--border) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 6px;
}

.skeleton-cell.w-20 { width: 20%; }
.skeleton-cell.w-30 { width: 30%; }
.skeleton-cell.w-40 { width: 40%; }
.skeleton-cell.w-50 { width: 50%; }
.skeleton-cell.w-60 { width: 60%; }
.skeleton-cell.w-full { width: 100%; }
.skeleton-cell.h-sm { height: 10px; }
.skeleton-cell.h-lg { height: 20px; }
.skeleton-cell.h-xl { height: 32px; }
.skeleton-cell.rounded { border-radius: var(--radius-full); }
.skeleton-cell.circle { width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; }
.skeleton-cell.square { width: 48px; height: 48px; border-radius: var(--radius); flex-shrink: 0; }

/* Skeleton card */
.skeleton-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    overflow: hidden;
}

.skeleton-card .skeleton-line {
    height: 12px;
    background: linear-gradient(90deg, var(--border) 25%, var(--bg-hover) 50%, var(--border) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 6px;
    margin-bottom: 12px;
}

.skeleton-card .skeleton-line:last-child { margin-bottom: 0; }
.skeleton-card .skeleton-line.w-25 { width: 25%; }
.skeleton-card .skeleton-line.w-50 { width: 50%; }
.skeleton-card .skeleton-line.w-75 { width: 75%; }
.skeleton-card .skeleton-line.w-100 { width: 100%; }

/* Skeleton table */
.skeleton-table {
    width: 100%;
}

.skeleton-table .skeleton-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light);
}

/* ============================================================
   MOBILE BOTTOM NAVIGATION
   ============================================================ */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    z-index: 200;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.mobile-bottom-nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-around;
    height: 100%;
    max-width: 480px;
    margin: 0 auto;
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 6px 12px;
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 600;
    transition: all var(--transition-fast);
    position: relative;
    min-width: 56px;
}

.mobile-nav-item .mobile-nav-icon {
    font-size: 22px;
    line-height: 1;
    transition: transform var(--transition-fast);
}

.mobile-nav-item.active {
    color: var(--accent);
}

.mobile-nav-item.active .mobile-nav-icon {
    transform: scale(1.1);
}

.mobile-nav-item.active::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 3px;
    background: var(--accent);
    border-radius: 0 0 3px 3px;
}

.mobile-nav-item .mobile-nav-badge {
    position: absolute;
    top: 2px;
    right: 8px;
    width: 16px;
    height: 16px;
    background: var(--danger);
    color: white;
    font-size: 9px;
    font-weight: 700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Center action button */
.mobile-nav-center {
    position: relative;
    top: -16px;
}

.mobile-nav-center-btn {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.4);
    text-decoration: none;
    transition: all var(--transition-fast);
}

.mobile-nav-center-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 24px rgba(245, 158, 11, 0.5);
}

@media (max-width: 768px) {
    .mobile-bottom-nav {
        display: block;
    }

    .content-area {
        padding-bottom: 84px !important;
    }

    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }
}

/* ============================================================
   CONFIRMATION MODAL (Enhanced)
   ============================================================ */
.confirm-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(6px);
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
}

.confirm-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.confirm-modal {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 400px;
    padding: 32px;
    text-align: center;
    box-shadow: var(--shadow-xl);
    transform: scale(0.9) translateY(10px);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.confirm-modal-overlay.active .confirm-modal {
    transform: scale(1) translateY(0);
}

.confirm-modal-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin: 0 auto 20px;
}

.confirm-modal-icon.danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.confirm-modal-icon.warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.confirm-modal-icon.info {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info);
}

.confirm-modal-icon.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.confirm-modal h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.confirm-modal p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 24px;
}

.confirm-modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.confirm-modal-actions .btn {
    min-width: 120px;
}

/* ============================================================
   SUCCESS ANIMATION (Transfer Complete)
   ============================================================ */
.success-animation-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
    z-index: 9500;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.success-animation-overlay.active {
    opacity: 1;
    visibility: visible;
}

.success-animation-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: 48px;
    text-align: center;
    max-width: 420px;
    width: 100%;
    box-shadow: var(--shadow-xl);
    transform: scale(0.8);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.success-animation-overlay.active .success-animation-card {
    transform: scale(1);
}

/* Animated Checkmark */
.success-checkmark {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    position: relative;
}

.success-checkmark .check-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--success), #059669);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: check-pop 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.2s both;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
}

.success-checkmark .check-circle::after {
    content: '';
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    border: 2px solid rgba(16, 185, 129, 0.3);
    animation: check-ring 1s ease-out 0.4s both;
}

@keyframes check-pop {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

@keyframes check-ring {
    0% { transform: scale(0.8); opacity: 1; }
    100% { transform: scale(1.4); opacity: 0; }
}

.success-checkmark svg {
    width: 40px;
    height: 40px;
    stroke: white;
    stroke-width: 3;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.success-checkmark svg path {
    stroke-dasharray: 60;
    stroke-dashoffset: 60;
    animation: check-draw 0.4s ease-out 0.5s forwards;
}

@keyframes check-draw {
    to { stroke-dashoffset: 0; }
}

.success-animation-card h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    animation: fade-in-up 0.4s ease 0.6s both;
}

.success-animation-card .success-amount {
    font-size: 32px;
    font-weight: 800;
    color: var(--success);
    margin-bottom: 8px;
    animation: fade-in-up 0.4s ease 0.7s both;
}

.success-animation-card .success-detail {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
    animation: fade-in-up 0.4s ease 0.8s both;
}

.success-animation-card .btn {
    animation: fade-in-up 0.4s ease 0.9s both;
}

/* Confetti particles */
.confetti-container {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    animation: confetti-fall 3s ease-in-out forwards;
}

@keyframes confetti-fall {
    0% {
        transform: translateY(-100px) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* ============================================================
   CHART CONTAINERS (Admin Dashboard)
   ============================================================ */
.chart-container {
    position: relative;
    height: 280px;
    width: 100%;
}

.chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: box-shadow var(--transition);
}

.chart-card:hover {
    box-shadow: var(--shadow-lg);
}

.chart-card-header {
    padding: 20px 24px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chart-card-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.chart-card-header .chart-period {
    font-size: 12px;
    color: var(--text-muted);
    background: var(--bg-hover);
    padding: 4px 10px;
    border-radius: var(--radius-full);
}

.chart-card-body {
    padding: 16px 24px 24px;
}

/* ============================================================
   ENHANCED TABLE HOVER EFFECTS
   ============================================================ */
.data-table tbody tr {
    transition: background var(--transition-fast), transform var(--transition-fast);
}

.data-table tbody tr:hover {
    background: var(--bg-hover);
}

/* Row action reveal on hover */
.data-table tbody tr .row-actions {
    opacity: 0.6;
    transition: opacity var(--transition-fast);
}

.data-table tbody tr:hover .row-actions {
    opacity: 1;
}

/* ============================================================
   PULSE DOT (Live indicator)
   ============================================================ */
.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    position: relative;
    display: inline-block;
}

.pulse-dot::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    border: 2px solid var(--success);
    animation: pulse-ring 1.5s ease-out infinite;
}

@keyframes pulse-ring {
    0% { transform: scale(0.8); opacity: 1; }
    100% { transform: scale(1.6); opacity: 0; }
}

/* ============================================================
   SCROLL-TO-TOP BUTTON
   ============================================================ */
.scroll-top-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all var(--transition);
    z-index: 50;
}

.scroll-top-btn.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.scroll-top-btn:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

@media (max-width: 768px) {
    .scroll-top-btn {
        bottom: 80px;
    }
}

/* ============================================================
   TOOLTIP ENHANCEMENTS
   ============================================================ */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    padding: 6px 12px;
    background: var(--primary);
    color: white;
    font-size: 12px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    pointer-events: none;
    z-index: 1000;
    box-shadow: var(--shadow);
}

[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* ============================================================
   PRINT STYLES (Statement PDF)
   ============================================================ */
@media print {
    body {
        background: white !important;
        color: #000 !important;
        font-size: 12px;
    }

    .sidebar,
    .admin-sidebar,
    .top-header,
    .mobile-bottom-nav,
    .sidebar-overlay,
    .scroll-top-btn,
    .no-js,
    .filter-bar,
    .action-btns,
    .pagination,
    .btn,
    .modal-overlay,
    .confirm-modal-overlay,
    .success-animation-overlay,
    .toast-container {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
        padding-top: 0 !important;
    }

    .content-area {
        padding: 0 !important;
    }

    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
        break-inside: avoid;
    }

    .data-table {
        font-size: 11px;
    }

    .data-table th,
    .data-table td {
        padding: 8px 10px !important;
    }

    .badge {
        border: 1px solid currentColor;
        background: transparent !important;
    }

    .balance-card {
        background: #f8f9fa !important;
        color: #000 !important;
        border: 1px solid #ddd;
    }

    .balance-card * {
        color: #000 !important;
    }

    a[href]::after {
        content: none !important;
    }

    @page {
        margin: 1.5cm;
        size: A4;
    }
}

/* ============================================================
   ACCESSIBILITY FOCUS STYLES
   ============================================================ */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.btn:focus-visible,
.form-input:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}