/* Shared card print styles — static layout covered by CSP style-src 'self'. */

@import url("https://fonts.bunny.net/css?family=tajawal:400,500,700|amiri:400,700&display=swap");

.card-print-root {
    direction: rtl;
    unicode-bidi: embed;
    font-family: "Cairo", "Tajawal", "Amiri", system-ui, -apple-system, sans-serif;
    letter-spacing: 0;
    font-feature-settings: "liga" 1, "calt" 1;
    min-height: 100vh;
}

.card-print-root * {
    letter-spacing: 0;
    box-sizing: border-box;
}

.card-print-root.card-print-screen {
    background: #f5f5f5;
}

.card-print-empty {
    text-align: center;
    padding: 3rem 1.5rem;
    color: #64748b;
    font-size: 0.95rem;
}

/* Professional card (CR80) */
.card-print-root .card-k {
    width: 85.6mm;
    height: 54mm;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    position: relative;
    display: flex;
    flex-direction: column;
}

.card-print-root .card-k-h {
    background: var(--card-bg, #1e3a5f);
    padding: 5mm 5mm 3mm;
    display: flex;
    align-items: center;
    gap: 3mm;
    flex-shrink: 0;
}

.card-print-root .card-k-b {
    background: white;
    flex: 1;
    display: flex;
    align-items: center;
    padding: 3mm 5mm;
    gap: 4mm;
}

.card-print-root .card-k-f {
    background: var(--card-accent, #2e5f8a);
    padding: 2mm 5mm;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.card-print-root .photo-k {
    width: 16mm;
    height: 16mm;
    border-radius: 50%;
    border: 2px solid var(--card-bg, #1e3a5f);
    object-fit: cover;
    flex-shrink: 0;
}

.card-print-root .photo-ph {
    width: 16mm;
    height: 16mm;
    border-radius: 50%;
    background: color-mix(in srgb, var(--card-bg, #1e3a5f) 12%, transparent);
    border: 2px solid color-mix(in srgb, var(--card-bg, #1e3a5f) 25%, transparent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14pt;
    font-weight: bold;
    color: var(--card-bg, #1e3a5f);
    flex-shrink: 0;
}

/* Tutoring batch print grid */
.card-print-root .card-print-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    max-width: 180mm;
    margin-inline: auto;
    padding: 1rem;
}

@media (min-width: 640px) {
    .card-print-root .card-print-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Tutoring student card — self-contained (no Tailwind required) */
.card-print-root .tcard {
    width: 86mm;
    height: 54mm;
    border: 1px solid #cbd5e1;
    overflow: hidden;
    background: #fff;
    position: relative;
    display: flex;
    flex-direction: column;
    page-break-inside: avoid;
}

.card-print-root .tcard--rounded {
    border-radius: 0.75rem;
}

.card-print-root .tcard--square {
    border-radius: 0;
}

.card-print-root .tcard-header {
    padding: 0.375rem 0.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    color: #fff;
    background: var(--tutoring-accent, #1e3a8a);
    flex-shrink: 0;
}

.card-print-root .tcard-header-start {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    flex: 1;
}

.card-print-root .tcard-logo {
    width: 1.5rem;
    height: 1.5rem;
    object-fit: contain;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 0.25rem;
}

.card-print-root .tcard-center-name {
    font-size: 9px;
    font-weight: 500;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-print-root .tcard-subtitle {
    font-size: 7px;
    color: rgba(255, 255, 255, 0.8);
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-print-root .tcard-badge-label {
    font-size: 8px;
    color: rgba(255, 255, 255, 0.8);
    font-family: ui-monospace, monospace;
    flex-shrink: 0;
}

.card-print-root .tcard-body {
    flex: 1;
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    min-height: 32mm;
    overflow: hidden;
}

.card-print-root .tcard-body--minimal {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.card-print-root .tcard-body-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.card-print-root .tcard-name {
    font-size: 11px;
    font-weight: 700;
    color: #1e293b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin: 0;
}

.card-print-root .tcard-body--minimal .tcard-name {
    font-size: 12px;
    white-space: normal;
    line-height: 1.25;
}

.card-print-root .tcard-matricule {
    font-size: 8px;
    color: #64748b;
    font-family: ui-monospace, monospace;
    margin: 0.125rem 0 0;
}

.card-print-root .tcard-phone {
    font-size: 8px;
    color: #475569;
    margin: 0.125rem 0 0;
}

.card-print-root .tcard-package {
    font-size: 8px;
    font-weight: 500;
    color: var(--tutoring-accent, #1e3a8a);
    margin: 0.125rem 0 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-print-root .tcard-stats {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 0.25rem;
}

.card-print-root .tcard-stat {
    font-size: 8px;
    color: #64748b;
}

.card-print-root .tcard-stat strong {
    color: #334155;
}

.card-print-root .tcard-photo {
    width: 3.5rem;
    height: 3.5rem;
    object-fit: cover;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    flex-shrink: 0;
}

.card-print-root .tcard-photo-ph {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 0.5rem;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.125rem;
    font-weight: 700;
    color: #94a3b8;
}

.card-print-root .tcard-qr-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    flex-shrink: 0;
}

.card-print-root .tcard-footer {
    border-top: 1px solid #e2e8f0;
    padding: 0.375rem 0.75rem;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: auto;
    flex-shrink: 0;
}

.card-print-root .tcard-footer-label {
    font-size: 7px;
    color: #94a3b8;
    display: block;
}

.card-print-root .tcard-footer-value {
    font-size: 9px;
    font-family: ui-monospace, monospace;
    font-weight: 700;
    color: #334155;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
}

@media print {
    html[lang="ar"],
    .card-print-root {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    body {
        margin: 0;
        padding: 0;
        background: #fff !important;
    }

    .card-print-root .no-print,
    .print\\:hidden {
        display: none !important;
    }

    .card-print-root .card-item,
    .card-print-root .tcard {
        box-shadow: none;
    }

    .card-print-root .card-print-grid {
        gap: 0.5rem;
        padding: 0;
    }

    .card-print-root.card-print-professional .card-k {
        box-shadow: none;
    }
}
