/* ============================================
   CARDS MODAL - Premium Fintech Styling
   ============================================ */

.cards-modal-content {
    padding: 15px 20px 25px;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
}

/* Drag Handle - styles moved to main style.css for reuse */

/* ============================================
   3D CARD FLIP CONTAINER
   ============================================ */
.card-3d-container {
    perspective: 1000px;
    width: 100%;
    max-width: 400px;
    margin: 0 auto 20px;
    flex-shrink: 0;
    /* Smooth fade-in to prevent any residual FOUC */
    animation: cardFadeIn 0.3s ease-out;
}

@keyframes cardFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card-3d-flipper {
    position: relative;
    width: 100%;
    aspect-ratio: 1.586 / 1;
    max-height: 220px;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
}

.card-3d-flipper.flipped {
    transform: rotateY(180deg);
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.card-front {
    z-index: 2;
}

.card-back {
    transform: rotateY(180deg);
}

/* ============================================
   PREMIUM CARD DISPLAY (FRONT)
   ============================================ */
.premium-card {
    position: relative;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a1a 0%, #0a0a0a 50%, #1a1a1a 100%);
    border-radius: 16px;
    padding: 20px;
    box-sizing: border-box;
    overflow: hidden;
    border: 1px solid rgba(207, 181, 106, 0.3);
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(255, 255, 255, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
}

/* Holographic Shine Effect */
.card-shine {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        120deg,
        transparent 30%,
        rgba(207, 181, 106, 0.1) 45%,
        rgba(255, 255, 255, 0.2) 50%,
        rgba(207, 181, 106, 0.1) 55%,
        transparent 70%
    );
    animation: shine 4s ease-in-out infinite;
    pointer-events: none;
}

@keyframes shine {
    0%, 100% { left: -100%; }
    50% { left: 100%; }
}

/* Geometric Pattern Overlay */
.card-pattern {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: 
        radial-gradient(circle at 100% 0%, rgba(207, 181, 106, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 0% 100%, rgba(207, 181, 106, 0.08) 0%, transparent 40%);
    pointer-events: none;
}

/* Card Top Row */
.card-top-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    position: relative;
    z-index: 1;
}

.card-brand {
    display: flex;
    align-items: center;
    gap: 8px;
}

.brand-icon {
    font-size: 28px;
    color: var(--gold);
    font-weight: 300;
}

.brand-text {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 3px;
    color: var(--gold);
}

.card-contactless {
    color: rgba(255, 255, 255, 0.6);
    font-size: 18px;
    transform: rotate(90deg);
}

/* Card Chip */
.card-chip-row {
    margin-top: 12px;
    position: relative;
    z-index: 1;
}

.card-chip-large {
    width: 45px;
    height: 32px;
    background: linear-gradient(135deg, #d4af37 0%, #f9e295 30%, #d4af37 60%, #c4a030 100%);
    border-radius: 5px;
    position: relative;
    box-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.3),
        inset 0 1px 2px rgba(255, 255, 255, 0.4);
}

.card-chip-large::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 5px;
    right: 5px;
    height: 1px;
    background: rgba(0, 0, 0, 0.2);
}

.card-chip-large::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 5px;
    bottom: 5px;
    width: 1px;
    background: rgba(0, 0, 0, 0.2);
}

/* Card Number */
.card-number-row {
    margin-top: 15px;
    position: relative;
    z-index: 1;
}

.card-number {
    font-family: 'Courier New', monospace;
    font-size: 18px;
    font-weight: 500;
    letter-spacing: 2px;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
}

/* Card Bottom Row */
.card-bottom-row {
    display: flex;
    justify-content: flex-start;
    align-items: flex-end;
    margin-top: auto;
    gap: 25px;
    position: relative;
    z-index: 1;
}

.card-info-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.card-label {
    font-size: 7px;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.card-value {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    letter-spacing: 0.5px;
}

/* Balance Overlay */
.card-balance-overlay {
    position: absolute;
    bottom: 20px;
    right: 20px;
    text-align: right;
    z-index: 1;
}

.card-balance-overlay .balance-label {
    display: block;
    font-size: 8px;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 2px;
}

.card-balance-overlay .balance-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--gold);
}

/* ============================================
   FROZEN OVERLAY (Animated)
   ============================================ */
.frozen-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    z-index: 10;
    backdrop-filter: blur(3px);
    border-radius: 16px;
    /* Hidden by default */
    opacity: 0;
    visibility: hidden;
    transform: scale(0.95);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.frozen-overlay.visible {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

.frozen-overlay i {
    font-size: 40px;
    color: #64B5F6;
    animation: pulse-freeze 2s ease-in-out infinite;
}

.frozen-overlay span {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 4px;
    color: #64B5F6;
}

@keyframes pulse-freeze {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

/* ============================================
   CARD BACK (Details View)
   ============================================ */
.card-back-content {
    background: linear-gradient(135deg, #0f0f0f 0%, #1a1a1a 50%, #0f0f0f 100%);
    justify-content: flex-start;
    padding-top: 25px;
}

.card-back-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 15px;
    position: relative;
    z-index: 1;
}

.card-back-header .brand-icon {
    font-size: 20px;
    color: var(--gold);
}

.card-back-header .brand-text {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--gold);
}

.card-detail-row {
    margin-bottom: 15px;
    position: relative;
    z-index: 1;
}

.detail-label {
    display: block;
    font-size: 9px;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.detail-value {
    font-size: 16px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
    letter-spacing: 1px;
}

.card-number-reveal {
    font-family: 'Courier New', monospace;
    font-size: 18px;
    letter-spacing: 3px;
}

/* CVV reveal - same style as other values for consistency */
.cvv-reveal {
    /* Inherits from .detail-value - no special styling needed */
}

.card-detail-split {
    display: flex;
    gap: 40px;
}

/* Magnetic stripe removed - was ugly */

/* ============================================
   CARD ACTION BUTTONS
   ============================================ */
.card-actions-row {
    display: flex;
    justify-content: space-around;
    margin-bottom: 20px;
    gap: 10px;
    flex-shrink: 0;
}

.card-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: transparent;
    background-color: transparent;
    border: none;
    cursor: pointer;
    padding: 12px 20px;
    border-radius: 12px;
    flex: 1;
    /* Prevent flash - no transition on initial load */
}

.card-action-btn:hover {
    background: rgba(255, 255, 255, 0.05);
}

.card-action-btn:active {
    transform: scale(0.95);
}

.card-action-btn .action-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #CFB56A; /* Explicit gold color, not var */
    /* No transition to prevent flash */
}

.card-action-btn:hover .action-icon {
    background: rgba(207, 181, 106, 0.15);
    border-color: #8A7538;
    transition: all 0.2s ease;
}

.card-action-btn.active .action-icon {
    background: rgba(100, 181, 246, 0.2);
    background-color: rgba(100, 181, 246, 0.2);
    border-color: #64B5F6;
    color: #64B5F6;
}

.card-action-btn span {
    font-size: 12px;
    color: #888888; /* Explicit color, not var */
    font-weight: 500;
}

/* ============================================
   CARD LIMITS SECTION
   ============================================ */
.card-limits-section {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
    flex-shrink: 0;
}

.limits-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.limits-title {
    font-size: 13px;
    color: var(--text-secondary);
}

.limits-value {
    font-size: 13px;
    font-weight: 600;
    color: white;
}

.limits-progress {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.limits-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--gold) 0%, #E5C578 100%);
    border-radius: 3px;
    transition: width 0.5s ease;
}

/* ============================================
   TRANSACTIONS SECTION (SCROLLABLE!)
   ============================================ */
.card-transactions-section {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    /* Removed flex: 1 - section should only take the space it needs, not fill the modal */
}

.transactions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-shrink: 0;
}

.transactions-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: white;
}

.transactions-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    /* No max-height - let it grow naturally, modal scrolls if needed */
}

/* Custom Scrollbar */
.transactions-list::-webkit-scrollbar {
    width: 4px;
}

.transactions-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
}

.transactions-list::-webkit-scrollbar-thumb {
    background: var(--gold-dim);
    border-radius: 2px;
}

.transactions-list::-webkit-scrollbar-thumb:hover {
    background: var(--gold);
}

/* Transaction Item */
.card-transaction-item {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    padding: 12px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    transition: background 0.2s ease;
    flex-shrink: 0;
}

.card-transaction-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.tx-icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: white;
    flex-shrink: 0;
}

.tx-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.tx-title {
    font-size: 14px;
    font-weight: 500;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tx-time {
    font-size: 11px;
    color: var(--text-secondary);
}

.tx-value {
    text-align: right;
}

.tx-amount {
    font-size: 14px;
    font-weight: 600;
}

.tx-amount.positive {
    color: var(--success);
}

.tx-amount.negative {
    color: var(--danger);
}

/* Empty State */
.empty-transactions {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.empty-transactions i {
    font-size: 32px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-transactions p {
    margin: 0;
    font-size: 14px;
}

.empty-state {
    text-align: center;
    padding: 30px;
    color: var(--text-secondary);
    font-size: 14px;
}

.loading-spinner {
    text-align: center;
    padding: 30px;
    color: var(--text-secondary);
}

/* ============================================
   SKELETON LOADING STATES
   ============================================ */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.skeleton-text {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.05) 25%,
        rgba(255, 255, 255, 0.1) 50%,
        rgba(255, 255, 255, 0.05) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
    color: transparent !important;
}

.skeleton-bar {
    background: linear-gradient(
        90deg,
        rgba(207, 181, 106, 0.2) 25%,
        rgba(207, 181, 106, 0.4) 50%,
        rgba(207, 181, 106, 0.2) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.skeleton-item {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.02) 25%,
        rgba(255, 255, 255, 0.05) 50%,
        rgba(255, 255, 255, 0.02) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 12px;
    height: 60px;
    margin-bottom: 8px;
}

/* ============================================
   LIGHT MODE - PREMIUM CARD STYLING
   ============================================ */

/* Premium card - white background in light mode */
body[data-theme="light"] .premium-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8f8f8 50%, #ffffff 100%);
    border: 1px solid rgba(184, 151, 63, 0.4);
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(0, 0, 0, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

body[data-theme="light"] .card-number {
    color: rgba(0, 0, 0, 0.8);
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.5);
}

body[data-theme="light"] .card-label {
    color: rgba(0, 0, 0, 0.4);
}

body[data-theme="light"] .card-value {
    color: rgba(0, 0, 0, 0.8);
}

body[data-theme="light"] .card-contactless {
    color: rgba(0, 0, 0, 0.4);
}

/* Card back in light mode */
body[data-theme="light"] .card-back-content {
    background: linear-gradient(135deg, #f8f8f8 0%, #ffffff 50%, #f8f8f8 100%);
}

body[data-theme="light"] .detail-label {
    color: rgba(0, 0, 0, 0.4);
}

body[data-theme="light"] .detail-value {
    color: rgba(0, 0, 0, 0.85);
}

/* Card actions in light mode */
body[data-theme="light"] .card-action-btn .action-icon {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

body[data-theme="light"] .card-action-btn:hover .action-icon {
    background: rgba(184, 151, 63, 0.15);
    border-color: var(--gold);
}

body[data-theme="light"] .card-action-btn span {
    color: #666;
}

/* Limits section in light mode */
body[data-theme="light"] .card-limits-section {
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

body[data-theme="light"] .limits-value {
    color: #333;
}

body[data-theme="light"] .limits-progress {
    background: rgba(0, 0, 0, 0.08);
}

/* Transactions in light mode */
body[data-theme="light"] .transactions-header h3 {
    color: #333;
}

body[data-theme="light"] .card-transaction-item {
    background: rgba(0, 0, 0, 0.02);
}

body[data-theme="light"] .card-transaction-item:hover {
    background: rgba(0, 0, 0, 0.05);
}

body[data-theme="light"] .tx-title {
    color: #333;
}

body[data-theme="light"] .tx-icon {
    color: #333;
}