/* ========================================
   ID Card Design - Blue/White Theme
   3D Flip Animation & Professional Layout
   ======================================== */

/* Card Container with 3D Perspective */
.id-card-container {
    perspective: 1000px;
    width: 520px;
    height: 340px;
    margin: 0 auto;
}

/* Card Flipper */
.id-card-flipper {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.8s cubic-bezier(0.4, 0.2, 0.2, 1);
    transform-style: preserve-3d;
}

.id-card-flipper.flipped {
    transform: rotateY(180deg);
}

/* Front and Back Faces */
/* Front and Back Faces Common */
.id-card-front,
.id-card-back {
    position: absolute;
    width: 90%;
    height: 80%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

/* Front Face Specifics */
.id-card-front {
    background-color: #ffffff;
    z-index: 2;
    transform: rotateY(0deg);
}

/* Back Face Specifics */
.id-card-back {
    background-color: #ffffff;
    transform: rotateY(180deg);
}

/* ========================================
   FRONT CARD DESIGN - Malawi Theme
   ======================================== */



/* Header Section */
.card-header {
    background: #0ea64e;
    /* Malawi Green */
    padding: 8px 10px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border-bottom: 2px solid #ddd;
}

/* Remove the decorative arrow */
.card-header::after {
    display: none;
}

.school-header-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
}

.school-logo-front {
    width: 48px;
    height: 48px;
    background: white;
    border-radius: 50%;
    padding: 2px;
    object-fit: contain;
    /* flex-shrink: 0; */
}

.school-text-container {
    text-align: center;
    /* flex-grow: 1; */
    color: white;
}

.school-name-header {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    line-height: 1.1;
    margin: 0;
}

.school-address-header {
    font-size: 8px;
    font-weight: 500;
    margin: 2px 0 0 0;
    opacity: 0.9;
}

/* Sub-header for ID Card Title */
.card-subheader {
    text-align: center;
    background: #f0fdf4;
    padding: 4px 0;
    border-bottom: 1px solid #ddd;
}

.card-title {
    font-size: 10px;
    font-weight: 700;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Main Content Area */
.card-content {
    background: white;
    margin: 0;
    border-radius: 0;
    padding: 10px 15px;
    height: calc(100% - 100px);
    /* Adjust based on header/footer */
    display: flex;
    gap: 12px;
    align-items: flex-start;
    position: relative;
}

/* Watermark */
.card-content::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60%;
    height: 60%;
    background-image: var(--watermark-url);
    /* Will need to set this via inline style or JS */
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    opacity: 0.1;
    pointer-events: none;
    z-index: 0;
}

/* Photo Section */
.card-photo-section {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 1;
}

.card-photo-frame {
    width: 85px;
    height: 105px;
    border: 1px solid #ccc;
    border-radius: 4px;
    overflow: hidden;
    background: #f3f4f6;
    box-shadow: none;
}

/* Details Section */
.card-details-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    z-index: 1;
    font-family: 'Arial', sans-serif;
}

.card-student-name {
    display: none;
    /* Name is now part of the grid */
}

.card-info-grid {
    display: grid;
    gap: 4px;
}

.card-info-row {
    display: grid;
    grid-template-columns: 75px 1fr;
    align-items: baseline;
    gap: 4px;
    border: none;
    padding: 0;
    margin: 0;
}

.card-info-label {
    font-size: 9px;
    font-weight: 600;
    color: #4b5563;
    text-transform: none;
    /* Not all caps */
}

.card-info-value {
    font-size: 9px;
    font-weight: 700;
    color: #111827;
    text-transform: uppercase;
}

/* QR Code Section */
.card-qr-section {
    width: 50px;
    height: 50px;
    background: white;
    flex-shrink: 0;
    z-index: 1;
}

.card-qr-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Footer Section with Signatures */
.card-footer-signatures {
    position: absolute;
    bottom: 25px;
    left: 15px;
    right: 15px;
    display: flex;
    justify-content: end;
    gap: 20px;
    align-items: flex-end;
    z-index: 1;
}

.signature-block {
    text-align: center;
    width: 120px;
}

.signature-img {
    height: 30px;
    object-fit: contain;
    margin-bottom: 2px;
}

.signature-line {
    font-size: 8px;
    color: #374151;
    border-top: 1px solid #9ca3af;
    padding-top: 2px;
}

/* Footer Colored Strip */
.card-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 15px;
    background: #ef4444;
    /* Red */
    padding: 0;
    display: block;
    border-bottom: 6px solid #111827;
    /* Black bottom border */
}

.card-footer-text {
    display: none;
    /* Removed text from footer strip */
}

/* ========================================
   BACK CARD DESIGN - Blue/White Theme
   ======================================== */

/* ========================================
   BACK CARD DESIGN - Malawi Theme
   ======================================== */

.id-card-back {
    background: white;
    display: flex;
    flex-direction: column;
    padding: 20px;
    text-align: center;
    justify-content: space-between;
    font-family: 'Arial', sans-serif;
}

.maneb-back-header {
    font-size: 10px;
    color: #374151;
    line-height: 1.4;
    font-weight: 600;
}

.maneb-back-logo-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.2;
    /* Watermark style as seen in some cards, or full if main logo */
}

/* Actually image 2 shows a sharp black/white logo, not watermark. Let's make it clear. */
.maneb-back-logo {
    width: 150px;
    height: 80px;
    object-fit: contain;
    opacity: 0.8;
}

.maneb-director-signature {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.director-sig-img {
    height: 30px;
    object-fit: contain;
    margin-bottom: 5px;
}

.director-sig-line {
    border-top: 1px solid #9ca3af;
    width: 200px;
    padding-top: 5px;
    font-size: 9px;
    font-weight: 700;
    color: #4b5563;
    text-transform: uppercase;
}

.maneb-back-footer {
    font-size: 9px;
    color: #4b5563;
    margin-top: 15px;
    line-height: 1.4;
}

.school-logo-container {
    width: 60px;
    height: 60px;
    margin: 0 auto 8px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.school-logo-container img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

.school-logo-placeholder {
    font-size: 24px;
    color: #3b82f6;
    font-weight: 900;
}

.school-name-back {
    font-size: 13px;
    font-weight: 900;
    color: white;
    text-transform: uppercase;
    margin: 0;
}

/* Back Content */
.card-back-content {
    flex: 1;
    background: white;
    margin: 15px;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.back-info-section {
    display: grid;
    gap: 10px;
    text-align: center;
}

.back-info-item {
    display: flex;
    gap: 8px;
}

.back-info-icon {
    width: 16px;
    height: 16px;
    color: #3b82f6;
    flex-shrink: 0;
}

.back-info-text {
    flex: 1;
}

.back-info-label {
    font-size: 8px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 2px;
}

.back-info-value {
    font-size: 10px;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.4;
}

/* Signature Section */
/* Signature Section */
.card-signature-section {
    border-top: 1px solid #e2e8f0;
    padding-top: 12px;
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.signature-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 40px;
    margin-bottom: 8px;
}

.signature-container img {
    max-height: 100%;
    max-width: 150px;
    margin: 0 auto;
    object-fit: contain;
}

.signature-label {
    text-align: center;
    font-size: 9px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-top: 1px solid #cbd5e1;
    padding-top: 4px;
    display: inline-block;
    margin: 0 auto;
    width: 150px;
}

/* Back Footer */
.card-back-footer {
    background: #1e3a8a;
    padding: 8px 15px;
    text-align: center;
}

.card-back-footer-text {
    font-size: 8px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 600;
    margin: 0;
}

/* ========================================
   Flip Button
   ======================================== */

.flip-button {
    margin-top: 20px;
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.flip-button:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

.flip-button:active {
    transform: translateY(0);
}

/* ========================================
   Print Styles
   ======================================== */

@media print {
    .id-card-container {
        page-break-inside: avoid;
        break-inside: avoid;
    }

    .flip-button {
        display: none !important;
    }

    /* Show both sides side-by-side when printing */
    .print-both-sides {
        display: flex !important;
        gap: 20px;
        justify-content: center;
    }

    .print-both-sides .id-card-container {
        width: 520px;
    }

    .print-both-sides .id-card-flipper {
        transform: none !important;
    }

    .print-both-sides .id-card-front,
    .print-both-sides .id-card-back {
        position: relative !important;
        backface-visibility: visible !important;
    }
}

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 640px) {
    .id-card-container {
        width: 100%;
        max-width: 520px;
        height: auto;
        aspect-ratio: 520 / 340;
    }

    .id-card-front,
    .id-card-back {
        font-size: 14px;
    }

    .card-photo-frame {
        width: 90px;
        height: 110px;
    }

    .card-student-name {
        font-size: 14px;
    }
}