/**
 * ================================================================================
 * PRINT-OPTIMIZED ADMISSION DOCUMENT STYLES
 * ================================================================================
 * File: css/admission-letter.css
 * Purpose: Professional styling for admission letters with print-specific rules
 *
 * KEY FEATURES:
 * ✅ Professional layout with letterhead space
 * ✅ Proper margins and page breaks
 * ✅ Print-optimized colors (no grays that print light)
 * ✅ Signature blocks with proper spacing
 * ✅ QR code verification section
 * ✅ Responsive scaling for different paper sizes
 * ================================================================================
 */

/* ========================================
   PRINT-SAFE COLOR PALETTE
   ======================================== */
:root {
    --primary-color: #003580;      /* Deep blue (prints dark) */
    --text-color: #222222;          /* Dark gray (prints crisp) */
    --light-bg: #f9f9f9;           /* Very light gray */
    --border-color: #cccccc;       /* Visible when printed */
    --header-bg: #003580;          /* Signature header */
    --accent-orange: #ff9900;      /* Warning accent */
}

/* ========================================
   BASE TYPOGRAPHY
   ======================================== */
body {
    font-family: 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 11pt;
    line-height: 1.6;
    color: var(--text-color);
    background: white;
    margin: 0;
    padding: 0;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--primary-color);
    margin: 15px 0 10px;
    font-weight: 700;
}

h1 { font-size: 18pt; }
h2 { font-size: 16pt; }
h3 { font-size: 13pt; }
h4 { font-size: 12pt; }

p {
    margin: 12px 0;
    text-align: justify;
    line-height: 1.8;
}

a {
    color: var(--primary-color);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

strong, .emphasis {
    font-weight: 600;
    color: var(--primary-color);
}

/* ========================================
   LETTER CONTAINER & PAGE LAYOUT
   ======================================== */
.letter-container {
    max-width: 8.5in;
    width: 100%;
    margin: 0 auto;
    background: white;
    color: var(--text-color);
    position: relative;
    page-break-after: always;
}

/* Reserve space for physical letterhead */
.letterhead-space {
    height: 1.2in;
    margin-bottom: 0.3in;
}

.letterhead-logo {
    max-width: 6in;
    max-height: 1in;
    margin: 0 auto;
    display: block;
}

/* ========================================
   HEADER SECTION (School Identity)
   ======================================== */
.header {
    text-align: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 3px solid var(--primary-color);
}

.school-logo {
    height: 60px;
    margin-bottom: 10px;
    display: inline-block;
}

.school-name {
    font-size: 18pt;
    font-weight: 700;
    color: var(--primary-color);
    margin: 10px 0 5px;
    letter-spacing: 0.5pt;
}

.school-motto {
    font-size: 9pt;
    color: #666;
    font-style: italic;
    margin-bottom: 8px;
}

.school-contact {
    font-size: 8.5pt;
    color: #555;
    margin: 3px 0;
}

/* ========================================
   DOCUMENT METADATA
   ======================================== */
.doc-header {
    text-align: center;
    margin: 30px 0 25px;
}

.doc-title {
    font-size: 16pt;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1pt;
}

.ref-info {
    font-size: 9pt;
    color: #666;
}

.ref-info div {
    margin: 3px 0;
}

.ref-info strong {
    color: var(--text-color);
}

/* ========================================
   SALUTATION
   ======================================== */
.salutation {
    margin: 20px 0 15px;
    font-size: 11pt;
}

/* ========================================
   LETTER BODY
   ======================================== */
.letter-body {
    margin: 20px 0;
}

.letter-body p {
    margin: 12px 0;
}

.opening-para {
    font-weight: 600;
    color: var(--primary-color);
}

/* ========================================
   DETAILS TABLE
   ======================================== */
.details-table {
    width: 100%;
    border-collapse: collapse;
    margin: 25px 0;
    font-size: 10pt;
    page-break-inside: avoid;
}

.details-table thead {
    display: table-header-group;
}

.details-table th {
    background: var(--primary-color);
    color: white;
    padding: 10px;
    text-align: left;
    font-weight: 600;
    border: 1px solid #000;
}

.details-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-color);
}

.details-table tr:nth-child(even) {
    background: #fafafa;
}

.details-table .label {
    width: 40%;
    font-weight: 600;
    color: var(--text-color);
}

.details-table .value {
    width: 60%;
}

/* ========================================
   CREDENTIALS & PASSWORD SECTION
   ======================================== */
.credentials-box {
    background: #f5f5f5;
    border: 1px solid var(--border-color);
    border-radius: 3px;
    padding: 15px;
    margin: 20px 0;
    font-size: 9.5pt;
    page-break-inside: avoid;
}

.credentials-box h4 {
    color: var(--primary-color);
    margin: 0 0 12px;
    font-size: 11pt;
}

.cred-row {
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
}

.cred-label {
    font-weight: 600;
    width: 40%;
}

.cred-value {
    width: 60%;
}

.password-box {
    background: white;
    border: 2px solid var(--primary-color);
    border-radius: 3px;
    padding: 10px;
    font-family: 'Courier New', 'Monaco', monospace;
    font-weight: 700;
    font-size: 11pt;
    text-align: center;
    color: var(--primary-color);
    margin: 10px 0;
    letter-spacing: 2px;
    page-break-inside: avoid;
}

.password-warning {
    background: #fff0f0;
    border-left: 3px solid #cc0000;
    padding: 10px;
    margin: 10px 0;
    font-size: 9pt;
    color: #990000;
    page-break-inside: avoid;
}

/* ========================================
   STEPS SECTION (Numbered List)
   ======================================== */
.steps-section {
    background: #fafafa;
    border: 1px solid var(--border-color);
    border-radius: 3px;
    padding: 15px;
    margin: 20px 0;
    page-break-inside: avoid;
}

.steps-section h4 {
    color: var(--primary-color);
    margin: 0 0 15px;
    font-size: 11pt;
}

.step-item {
    margin-left: 35px;
    margin-bottom: 10px;
    font-size: 10pt;
    position: relative;
    padding-left: 15px;
    line-height: 1.5;
}

.step-item::before {
    content: attr(data-n);
    position: absolute;
    left: -30px;
    top: -2px;
    background: var(--primary-color);
    color: white;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    text-align: center;
    line-height: 22px;
    font-weight: 700;
    font-size: 9.5pt;
    border: 1px solid #000;
}

/* ========================================
   CALL-TO-ACTION BUTTON
   ======================================== */
.portal-cta {
    display: inline-block;
    background: var(--primary-color);
    color: white;
    text-align: center;
    padding: 12px 20px;
    margin: 20px 0;
    text-decoration: none;
    border-radius: 3px;
    font-weight: 600;
    font-size: 11pt;
    border: 1px solid var(--primary-color);
    width: 100%;
}

.portal-cta:visited {
    color: white;
}

/* ========================================
   CONDITIONS & WARNINGS
   ======================================== */
.conditions {
    background: #fffbf0;
    border-left: 4px solid var(--accent-orange);
    padding: 12px;
    margin: 20px 0;
    font-size: 9.5pt;
    line-height: 1.7;
    page-break-inside: avoid;
}

/* ========================================
   CLOSING STATEMENTS
   ======================================== */
.closing {
    margin: 25px 0 20px;
    text-align: justify;
    font-size: 10.5pt;
}

.closing p {
    margin: 12px 0;
}

.closing-signature {
    margin: 30px 0 5px;
    font-weight: 600;
}

/* ========================================
   SIGNATURE FOOTER
   ======================================== */
.sig-footer {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 2px solid var(--primary-color);
    page-break-inside: avoid;
}

.sig-table {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
    font-size: 9.5pt;
    gap: 15px;
}

.sig-block {
    width: 30%;
    text-align: center;
    flex: 1;
}

.sig-image {
    height: 60px;
    margin-bottom: 10px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    min-width: 100%;
}

.sig-image img {
    max-width: 100%;
    max-height: 60px;
    object-fit: contain;
}

.sig-line {
    border-top: 1.5px solid var(--text-color);
    margin: 12px 0;
    min-height: 2px;
}

.sig-name {
    font-weight: 700;
    margin-top: 10px;
    font-size: 10pt;
}

.sig-title {
    font-size: 8.5pt;
    color: #555;
    line-height: 1.4;
    margin: 2px 0;
}

.sig-date {
    font-size: 8pt;
    color: #888;
    margin-top: 5px;
}

/* Official Stamp Area */
.stamp-area {
    text-align: center;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed #999;
    border-radius: 50%;
    width: 100%;
    aspect-ratio: 1;
}

.stamp-text {
    font-size: 8pt;
    color: #999;
    font-weight: 700;
    line-height: 1.2;
}

/* ========================================
   QR CODE VERIFICATION
   ======================================== */
.qr-section {
    text-align: center;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    page-break-inside: avoid;
}

.qr-section p {
    font-size: 9pt;
    color: #666;
    margin: 5px 0;
}

.qr-code-img {
    width: 100px;
    height: 100px;
    margin: 10px auto;
    border: 1px solid #ddd;
    padding: 5px;
}

.qr-verify-text {
    font-size: 8pt;
    color: #888;
    font-family: 'Courier New', monospace;
}

/* ========================================
   FOOTER NOTES & DISCLAIMERS
   ======================================== */
.footer-note {
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px dashed #ccc;
    font-size: 8pt;
    color: #888;
    text-align: center;
    line-height: 1.5;
}

/* ========================================
   PRINT MEDIA QUERIES
   ======================================== */
@media print {
    * {
        margin: 0;
        padding: 0;
        background: white !important;
    }
    
    body {
        font-size: 11pt;
        line-height: 1.6;
        color: #000;
    }
    
    .letter-container {
        max-width: 100%;
        margin: 0;
        padding: 0;
        page-break-after: always;
    }
    
    /* Ensure signatures and headers print */
    .header, .details-table, .sig-footer, .qr-section {
        page-break-inside: avoid;
    }
    
    /* Remove screen-only elements */
    .no-print, .screen-only {
        display: none !important;
    }
    
    /* Print links as plain text */
    a {
        text-decoration: none;
        color: var(--primary-color);
    }
    
    a::after {
        content: none;
    }
    
    /* Ensure borders print */
    table, th, td {
        border: 1px solid #000 !important;
    }
    
    /* Optimize page breaks */
    h1, h2, h3, h4, h5, h6 {
        page-break-after: avoid;
    }
    
    /* Background colors print correctly */
    .details-table thead {
        background: var(--primary-color) !important;
        color: white !important;
    }
    
    /* Prevent widow/orphan text */
    p {
        orphans: 3;
        widows: 3;
    }
}

/* ========================================
   RESPONSIVE ADJUSTMENTS
   ======================================== */
@media screen and (max-width: 768px) {
    body {
        font-size: 10pt;
    }
    
    .sig-table {
        flex-direction: column;
    }
    
    .sig-block {
        width: 100%;
        margin-bottom: 20px;
        page-break-inside: avoid;
    }
    
    .details-table {
        font-size: 9pt;
    }
    
    .doc-title {
        font-size: 14pt;
    }
}

/* ========================================
   ACCESSIBILITY
   ======================================== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus styles for keyboard navigation */
a:focus, button:focus, input:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}