/* ============================================
   Bank Statement OCR Scanning Animation
   Colors matched to Eagle Doc brand palette
   ============================================ */

.bs-animation-wrapper {
    width: 100%;
    max-width: 360px;
    margin: 0 auto;
    perspective: 800px;
}

.bs-animation-scene {
    position: relative;
    width: 100%;
    padding-bottom: 135%;
    /* taller aspect ratio for bank statement */
}

/* ── Bank Statement Paper ── */
.bs-paper {
    position: absolute;
    inset: 0;
    background: #fff;
    border-radius: 12px;
    box-shadow:
        0 2px 20px rgba(26, 47, 110, 0.10),
        0 8px 40px rgba(0, 0, 0, 0.06);
    padding: 10% 7% 7%;
    display: flex;
    flex-direction: column;
    gap: 4%;
    overflow: hidden;
    animation: bsFadeIn 0.8s ease-out both;
}

@keyframes bsFadeIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ── Scanline ── */
.bs-scanline {
    position: absolute;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(26, 47, 110, 0.15) 15%,
        #1a2f6e 50%,
        rgba(26, 47, 110, 0.15) 85%,
        transparent 100%);
    box-shadow:
        0 0 15px rgba(26, 47, 110, 0.4),
        0 0 40px rgba(26, 47, 110, 0.15);
    opacity: 0;
    z-index: 10;
    animation: bsScanLine 8s ease-in-out infinite;
}

@keyframes bsScanLine {
    0%   { top: 2%; opacity: 0; }
    3%   { opacity: 1; }
    25%  { top: 98%; opacity: 1; }
    28%  { opacity: 0; }
    100% { opacity: 0; top: 98%; }
}

/* ── AI Processing Pulse ── */
.bs-ai-pulse {
    position: absolute;
    inset: 0;
    border-radius: 12px;
    border: 2px solid transparent;
    opacity: 0;
    z-index: 5;
    animation: bsAiPulse 8s ease-in-out infinite;
}

@keyframes bsAiPulse {
    0%, 25% { opacity: 0; border-color: transparent; }
    30% {
        opacity: 1;
        border-color: rgba(26, 47, 110, 0.5);
        box-shadow: inset 0 0 30px rgba(26, 47, 110, 0.05), 0 0 20px rgba(26, 47, 110, 0.1);
    }
    35% {
        opacity: 1;
        border-color: rgba(26, 47, 110, 0.4);
        box-shadow: inset 0 0 30px rgba(26, 47, 110, 0.05), 0 0 20px rgba(26, 47, 110, 0.1);
    }
    40% { opacity: 0; border-color: transparent; box-shadow: none; }
    100% { opacity: 0; }
}

/* ── AI Badge ── */
.bs-ai-badge {
    position: absolute;
    top: 3%;
    right: 3%;
    background: linear-gradient(135deg, #1a2f6e, #142252);
    color: #fff;
    font-size: 0.55rem;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    padding: 3px 10px;
    border-radius: 20px;
    letter-spacing: 0.1em;
    z-index: 15;
    opacity: 0;
    transform: scale(0.7);
    animation: bsAiBadge 8s ease-in-out infinite;
    box-shadow: 0 2px 10px rgba(26, 47, 110, 0.3);
}

@keyframes bsAiBadge {
    0%, 28%  { opacity: 0; transform: scale(0.7); }
    33%      { opacity: 1; transform: scale(1); }
    85%      { opacity: 1; transform: scale(1); }
    92%      { opacity: 0; transform: scale(0.7); }
    100%     { opacity: 0; }
}

/* ── Highlighted Fields ── */
.bs-field {
    position: relative;
    border-radius: 4px;
    transition: all 0.3s ease;
}

/* Highlight overlay pseudo-element */
.bs-field::before {
    content: '';
    position: absolute;
    inset: -3px -5px;
    border-radius: 5px;
    border: 2px solid transparent;
    background: transparent;
    opacity: 0;
    z-index: 2;
    pointer-events: none;
}

/* Field label tooltip */
.bs-field::after {
    position: absolute;
    font-size: 0.5rem;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    color: #fff;
    padding: 1px 6px;
    border-radius: 3px;
    white-space: nowrap;
    opacity: 0;
    z-index: 3;
    pointer-events: none;
    letter-spacing: 0.03em;
}

/* ── Field: BankName (header) ── */
.bs-field-bankname::before {
    animation: bsHighlightField 8s ease-in-out infinite;
    animation-delay: 0s;
    border-color: #1a2f6e;
    background: rgba(26, 47, 110, 0.06);
}
.bs-field-bankname::after {
    content: attr(data-label);
    top: -12px;
    left: -5px;
    background: #1a2f6e;
    animation: bsShowLabel 8s ease-in-out infinite;
    animation-delay: 0s;
}

/* ── Field: IBAN (removed) ── */

/* ── Field: Balance ── */
.bs-field-balance::before {
    animation: bsHighlightField 8s ease-in-out infinite;
    animation-delay: 0.4s;
    border-color: #E65100;
    background: rgba(230, 81, 0, 0.05);
}
.bs-field-balance::after {
    content: attr(data-label);
    top: -12px;
    right: -5px;
    background: #E65100;
    animation: bsShowLabel 8s ease-in-out infinite;
    animation-delay: 0.4s;
}

/* ── Field: Transactions section ── */
.bs-field-transactions::before {
    animation: bsHighlightField 8s ease-in-out infinite;
    animation-delay: 0.8s;
    border-color: #00796B;
    background: rgba(0, 121, 107, 0.04);
}
.bs-field-transactions::after {
    content: attr(data-label);
    top: -12px;
    left: -5px;
    background: #00796B;
    animation: bsShowLabel 8s ease-in-out infinite;
    animation-delay: 0.8s;
}

/* ── Column highlight overlays (removed — using bs-field on divs instead) ── */

@keyframes bsHighlightField {
    0%, 32%  { opacity: 0; }
    38%      { opacity: 1; }
    82%      { opacity: 1; }
    90%      { opacity: 0; }
    100%     { opacity: 0; }
}

@keyframes bsShowLabel {
    0%, 32%  { opacity: 0; transform: translateY(3px); }
    38%      { opacity: 1; transform: translateY(0); }
    82%      { opacity: 1; transform: translateY(0); }
    90%      { opacity: 0; transform: translateY(3px); }
    100%     { opacity: 0; }
}

/* ── Bank Statement Header ── */
.bs-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2%;
}

.bs-bank-logo-block {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.bs-bank-logo {
    width: 55px;
    height: 10px;
    background: #1a2f6e;
    border-radius: 3px;
    opacity: 0.7;
}

.bs-bank-name-lines {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-top: 3px;
}

.bs-bank-name-line {
    height: 4px;
    background: #d0d0d8;
    border-radius: 2px;
}
.bs-bank-name-line:nth-child(1) { width: 70px; }
.bs-bank-name-line:nth-child(2) { width: 50px; }

.bs-title-block {
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.bs-title {
    font-size: 0.75rem;
    font-weight: 800;
    color: #1a2f6e;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-family: 'Inter', sans-serif;
}

.bs-period-lines {
    display: flex;
    flex-direction: column;
    gap: 3px;
    align-items: flex-end;
}

.bs-period-line {
    height: 4px;
    background: #e8e8f0;
    border-radius: 2px;
}
.bs-period-line:nth-child(1) { width: 90px; }
.bs-period-line:nth-child(2) { width: 70px; }

/* ── IBAN Row ── */
.bs-iban-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    border-bottom: 1px solid #f0f0f5;
    border-top: 1px solid #f0f0f5;
}

.bs-iban-label {
    font-size: 0.45rem;
    font-weight: 700;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-family: 'Inter', sans-serif;
    flex-shrink: 0;
    width: 28px;
}

.bs-iban-value {
    display: flex;
    gap: 3px;
    align-items: center;
    flex-wrap: wrap;
}

.bs-iban-chunk {
    height: 4px;
    background: #c8c8d8;
    border-radius: 2px;
    width: 22px;
}

/* ── Balance Section ── */
.bs-balance-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: #f7f7fc;
    border-radius: 6px;
    padding: 5px 8px;
}

.bs-balance-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bs-balance-label {
    height: 4px;
    width: 80px;
    background: #d0d0d8;
    border-radius: 2px;
}

.bs-balance-value {
    height: 5px;
    width: 55px;
    background: #1a2f6e;
    border-radius: 2px;
    opacity: 0.7;
}

.bs-balance-row.closing .bs-balance-value {
    background: #00796B;
}

/* ── Transactions Table ── */
.bs-transactions {
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow: visible;
    position: relative;
}

.bs-tx-header {
    display: flex;
    gap: 3%;
    padding-bottom: 4px;
    border-bottom: 1.5px solid #1a2f6e;
    margin-bottom: 4px;
}

.bs-tx-header span,
.bs-tx-header div {
    font-size: 0.38rem;
    font-weight: 700;
    color: #1a2f6e;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-family: 'Inter', sans-serif;
    flex-shrink: 0;
}

.bs-tx-header span:nth-child(1),
.bs-tx-header div:nth-child(1) { width: 18%; }
.bs-tx-header span:nth-child(2),
.bs-tx-header div:nth-child(2) { width: 46%; }
.bs-tx-header span:nth-child(3),
.bs-tx-header div:nth-child(3) { width: 20%; }

.bs-tx-row {
    display: flex;
    gap: 3%;
    align-items: center;
    padding: 2px 0;
    border-bottom: 1px solid #f3f3f8;
}

.bs-tx-cell {
    height: 4px;
    background: #e2e2ea;
    border-radius: 2px;
    flex-shrink: 0;
}

.bs-tx-cell.date  { width: 18%; }
.bs-tx-cell.desc  { width: 46%; }
.bs-tx-cell.amount {
    width: 20%;
    background: transparent;
    position: relative;
}
.bs-tx-cell.amount::before {
    content: '';
    display: block;
    width: var(--aw, 70%);
    height: 100%;
    border-radius: 2px;
}

.bs-tx-row.credit .bs-tx-cell.amount::before { background: #00796B; opacity: 0.7; }
.bs-tx-row.debit  .bs-tx-cell.amount::before { background: #E53935; opacity: 0.6; }

/* ── Responsive ── */
@media (max-width: 991px) {
    .bs-animation-wrapper {
        max-width: 300px;
        margin-top: 2rem;
    }
}

@media (max-width: 767px) {
    .bs-animation-wrapper {
        display: none;
    }
}
