/* =============================================
   PDF TEMPLATE STYLES
   EXACT match to official FTF Match Sheet
   ============================================= */

.pdf-template-container {
    position: fixed;
    left: -9999px;
    top: 0;
    font-family: 'Cairo', 'Noto Sans Arabic', 'Tahoma', sans-serif;
    direction: rtl;
}

/* When rendering PDF, make it visible but off-screen */
.pdf-template-container.rendering {
    position: absolute;
    left: 0;
    top: 0;
    z-index: -1;
    visibility: visible;
}

.pdf-document {
    width: 210mm;
    min-height: 297mm;
    max-height: 297mm;
    background: #ffffff;
    font-family: 'Cairo', 'Noto Sans Arabic', 'Tahoma', 'Arial', sans-serif;
    direction: rtl;
    text-align: right;
    padding: 5mm 8mm;
    box-sizing: border-box;
    color: #000;
    font-size: 10px;
    overflow: hidden;
    unicode-bidi: bidi-override;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   HEADER SECTION WITH IMAGE
   ============================================ */
.pdf-header-section {
    position: relative;
    margin-bottom: 5px;
}

.pdf-header-image {
    width: 100%;
    height: auto;
    display: block;
}

.pdf-season-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    left: auto;
    background: linear-gradient(135deg, #C8102E 0%, #9B0D24 100%);
    color: #fff;
    padding: 8px 20px;
    font-family: 'Arial', sans-serif;
    font-size: 20px;
    font-weight: 900;
    border-radius: 5px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    border: 2px solid rgba(255,255,255,0.2);
}

/* ============================================
   MATCH INFO TABLE
   ============================================ */
.pdf-info-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 3px;
    border: 1px solid #000;
}

.pdf-info-table td {
    border: 1px solid #000;
    padding: 4px 8px;
    font-size: 10px;
    vertical-align: middle;
}

.pdf-info-left {
    width: 40%;
    text-align: center;
}

.pdf-info-right {
    width: 60%;
    text-align: right;
}

.pdf-round-cell {
    font-size: 11px;
    font-weight: 600;
}

.pdf-round-value {
    font-weight: 700;
    color: #C8102E;
}

/* ============================================
   REFEREES TABLE
   ============================================ */
.pdf-referees-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 3px;
    border: 1px solid #000;
}

.pdf-ref-cell {
    border: 1px solid #000;
    padding: 3px 8px;
    font-size: 9px;
    width: 50%;
    text-align: right;
}

/* ============================================
   TEAMS TABLE - Main container
   ============================================ */
.pdf-teams-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #000;
}

.pdf-team-cell {
    width: 50%;
    border: 1px solid #000;
    vertical-align: top;
    padding: 0;
}

/* Team Name Header */
.pdf-team-name {
    background: #f0f0f0;
    padding: 5px 8px;
    font-weight: 700;
    font-size: 10px;
    text-align: center;
    border-bottom: 1px solid #000;
}

/* ============================================
   PLAYERS TABLE
   ============================================ */
.pdf-players-grid {
    width: 100%;
    border-collapse: collapse;
    font-size: 8px;
}

.pdf-players-grid th {
    background: #e8e8e8;
    padding: 3px 2px;
    font-weight: 700;
    text-align: center;
    border: 1px solid #000;
    font-size: 8px;
}

.pdf-players-grid td {
    border: 1px solid #000;
    padding: 2px 3px;
    height: 16px;
    text-align: center;
    font-size: 8px;
}

/* Column widths */
.pdf-th-name, .pdf-player-name {
    width: 50%;
    text-align: right !important;
    padding-right: 5px !important;
}

.pdf-th-num, .pdf-player-num {
    width: 12%;
}

.pdf-th-sub, .pdf-player-sub {
    width: 12%;
}

.pdf-th-card, .pdf-player-card {
    width: 13%;
}

/* Card Colors */
.pdf-cell-yellow {
    background: #FFD700 !important;
    color: #000 !important;
}

.pdf-cell-red {
    background: #DC143C !important;
    color: #fff !important;
}

/* ============================================
   SUBSTITUTES HEADER
   ============================================ */
.pdf-subs-header {
    background: #f8f8f8;
    padding: 4px;
    text-align: center;
    font-weight: 700;
    font-size: 9px;
    border-top: 2px solid #C8102E;
    border-bottom: 1px solid #000;
}

/* ============================================
   COACH CELL
   ============================================ */
.pdf-coach-cell {
    background: #f5f5f5;
    padding: 5px 8px;
    font-weight: 700;
    font-size: 9px;
    text-align: center;
    border-top: 1px solid #000;
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    .pdf-document {
        width: 100%;
        height: auto;
        padding: 5mm;
    }

    .pdf-header-section,
    .pdf-teams-table,
    .pdf-referees-table {
        page-break-inside: avoid;
    }

    @page {
        size: A4 portrait;
        margin: 5mm;
    }
}

/* ============================================
   PREVIEW SCALING
   ============================================ */
.preview-frame .pdf-document {
    box-shadow: 0 0 20px rgba(0,0,0,0.3);
    margin: 20px auto;
}
