.card-display-area {
    display: flex;
    justify-content: center;
    margin-bottom: 50px; 
    position: relative; 
    perspective: 1000px; 
    height: auto; 
}

/* Card Flipper Container */
.card-flipper {
    width: 100%;
    max-width: 500px; 
    aspect-ratio: 2 / 1; 
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s ease-in-out;
    cursor: pointer;
}

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

/* Common styles for both card faces */
.membership-card {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden; 
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    padding: 12px;
    font-size: 0.95rem;
    overflow: hidden; 
}

/* Front Card Specific Styles */
.front-card {
    background: url('/static/img/ecide_bg.png') center/cover no-repeat;
    border: 2px solid var(--card-accent-yellow); 
    color: var(--card-text-white); 
    transform: rotateY(0deg);
    z-index: 2; 
}

/* Back Card Specific Styles */
.back-card {
    background: url('/static/img/ecide_bg.png') center/cover no-repeat;
    border: 2px solid var(--card-accent-yellow); 
    color: var(--card-text-white); 
    transform: rotateY(180deg); 
    display: flex;
    flex-direction: column;
    justify-content: space-between; 
    align-items: center; 
    padding: 12px;
    z-index: 1; 
}

/* Front Card Content - existing styles */
.card-header {
    display: flex;
    flex-direction: column;
    align-items: center; 
    width: 100%;
    margin-bottom: 6px; 
}

.card-header .header-text {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.card-header .subtitle {
    font-size: 11px; 
    font-weight: bold;
    color: var(--card-text-white);
    margin-bottom: 2px;
}

.card-header h3 {
    font-size: 14px; 
    font-weight: bold;
    color: var(--card-accent-yellow); 
    margin: 0;
    text-transform: uppercase;
}

.divider {
    width: 100%;
    height: 1px;
    background-color: var(--card-accent-yellow);
    margin-top: 2px; 
}

.card-main-content {
    display: flex; 
    width: 100%;
    height: 100%; 
    margin-top: 6px; 
    align-items: flex-start; 
}

.card-details-column {
    flex: 2; 
    display: flex;
    flex-direction: column;
    justify-content: flex-start; 
    padding-right: 12px; 
}

.card-photo-column {
    flex: 1; 
    display: flex;
    justify-content: flex-end; 
    align-items: flex-start; 
}

.card-photo-container {
    width: 100px; 
    height: 150px; 
    background-color: var(--card-accent-yellow); 
    border: 1px solid var(--card-accent-yellow);
    border-radius: 8px; 
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.2); 
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    flex-shrink: 0; 
    transition: all 0.3s ease;
}

.member-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 4px; 
}

.photo-placeholder-text {
    position: absolute;
    color: var(--primary-color); 
    font-size: 0.9rem; 
    text-align: center;
    font-weight: 500;
    line-height: 1.4;
}

.photo-placeholder-text::before {
    content: '📷'; 
    display: block;
    font-size: 1.8rem; 
    margin-bottom: 5px; 
    color: var(--primary-color); 
}

.card-details-column p {
    display: flex;
    margin: 1px 0; 
    font-size: 10px; 
    line-height: 1.2;
    align-items: baseline;
    color: var(--card-text-white); 
}

/* Apply consistent text truncation to all dynamic content spans */
.card-details-column p span {
    white-space: nowrap; 
    overflow: hidden;     
    text-overflow: ellipsis; 
    display: block; 
    flex-grow: 1; 
}

/* Ensure strong tags (labels) do not shrink */
.card-details-column p strong {
    font-weight: bold;
    margin-right: 5px; 
    color: var(--card-text-white);
    flex-shrink: 0; 
}

.card-details-column p.member-number {
    margin-bottom: 6px; 
}

.card-bottom-row {
    display: flex;
    align-items: flex-end; 
    width: 100%;
    margin-top: auto; 
}

.card-dates {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end; 
    margin-right: 10px; 
}

.card-dates p.date-text,
.card-dates p.secretary-text {
    font-size: 8px; 
    color: var(--card-text-white);
    margin: 0; 
    line-height: 1.3;
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis; 
}
.card-dates p.secretary-text strong {
    font-weight: bold;
    color: var(--card-text-white);
}

.card-qr-code {
    width: 59px; 
    height: 59px; 
    background-color: transparent; 
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0; 
    padding: 0; 
}

/* This targets the canvas generated by qrcode.js to ensure it fits the padded div */
.card-qr-code canvas {
    width: 100% !important;
    height: 100% !important;
    border-radius: 0; 
}

/* New styles for back card elements based on Flutter design */
.back-top-text {
    font-size: 10px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 0; 
    padding-top: 5px; 
}

.back-logo-container {
    flex-grow: 1; 
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%; 
}

.ecide-back-logo {
    width: 100px; 
    height: 100px; 
    object-fit: contain;
}

.back-bottom-section {
    width: 100%;
    text-align: center;
    padding-bottom: 5px; 
}

.back-info-text {
    font-size: 9px;
    margin: 2px 0 10px 0; 
    line-height: 1.2;
    font-weight: 500;
}

/* Adjust barcode section for the back card specifically */
.back-card .barcode-section {
    width: 90%;
    height: 10px;
    margin: 0 auto; 
    display: block; 
}

.back-card .barcode-section svg {
    width: 100%;
    height: 100%;
    color: var(--card-text-white); 
}

.back-footer {
    width: 100%;
    text-align: center;
    margin-top: auto; 
}