/**
 * PHNTM Report Styles
 * Professional report formatting for score reports
 */

/* Report Container */
.phntm-report-container {
    max-width: 8.5in;
    margin: 0 auto;
    padding: 0.5in;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: white;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

/* Header */
.phntm-report-header {
    text-align: left;
    border-bottom: 3px solid #135e96;
    padding-bottom: 20px;
    margin-bottom: 30px;
}

.phntm-logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.phntm-logo-image {
    height: 80px;
    width: auto;
}

.phntm-logo-text h1 {
    font-size: 2.5em;
    font-weight: bold;
    color: #135e96;
    margin: 0;
    letter-spacing: 2px;
}

.phntm-logo-text p {
    font-size: 1.1em;
    color: #666;
    margin: 5px 0 0 0;
    font-style: italic;
}

/* Content */
.phntm-report-content h1 {
    font-size: 2em;
    color: #135e96;
    text-align: center;
    margin: 30px 0;
    border-bottom: 2px solid #135e96;
    padding-bottom: 10px;
}

.phntm-report-content h2 {
    font-size: 1.3em;
    color: #135e96;
    margin: 25px 0 15px 0;
    border-left: 4px solid #135e96;
    padding-left: 15px;
}

.phntm-report-content p {
    margin: 15px 0;
    text-align: justify;
    font-size: 0.95em;
}

/* Information Tables */
.phntm-info-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 0.95em;
}

.phntm-info-table td {
    padding: 8px 0;
    vertical-align: top;
}

.phntm-info-table td:first-child {
    width: 30%;
    font-weight: bold;
}

.phntm-info-table td.spacer {
    width: 5%;
}

.phntm-info-table td:last-child {
    width: 65%;
}

/* Results Table */
.phntm-results-table {
    width: 100%;
    border-collapse: collapse;
    margin: 25px 0;
    font-size: 0.9em;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.phntm-results-table th {
    background: #135e96;
    color: white;
    padding: 12px 8px;
    text-align: center;
    font-weight: bold;
    border: 1px solid #0e4d7a;
}

.phntm-results-table td {
    padding: 10px 8px;
    text-align: center;
    border: 1px solid #ddd;
    background: #f9f9f9;
}

.phntm-results-table td:first-child {
    background: #e8f4f8;
    font-weight: bold;
    text-align: left;
}

.phntm-results-table tr:nth-child(even) td {
    background: #f1f1f1;
}

.phntm-results-table tr:nth-child(even) td:first-child {
    background: #ddeef3;
}

/* Outcome Cells */
.outcome-cell {
    font-weight: bold !important;
    color: white !important;
}

.outcome-cell.pass {
    background: #46b450 !important;
}

.outcome-cell.fail {
    background: #dc3232 !important;
}

/* Footer */
.phntm-report-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 2px solid #135e96;
    font-size: 0.85em;
}

.footer-left .cognaid-logo {
    font-size: 1.5em;
    font-weight: bold;
    color: #135e96;
}

.cognaid-logo-image {
    height: 40px;
    width: auto;
}

.footer-right {
    text-align: right;
    color: #666;
    line-height: 1.4;
}

/* PDF-specific styles */
.phntm-page-break {
    display: none; /* Hidden in normal view */
    page-break-before: always;
    height: 0;
    border: none;
    margin: 0;
    padding: 0;
}

.phntm-page-2 {
    /* Second page content */
}

/* PDF generation styles */
.phntm-pdf-generating {
    position: relative;
}

.phntm-pdf-generating::before {
    content: 'Generating PDF...';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
}

/* Report Button */
.phntm-report-btn,
.phntm-report-button {
    background: #135e96;
    border: 1px solid #135e96;
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    margin: 0 5px;
    transition: all 0.2s ease;
}

.phntm-report-btn:hover,
.phntm-report-button:hover {
    background: #0e4d7a;
    border-color: #0e4d7a;
    color: white;
}

.phntm-report-btn:focus,
.phntm-report-button:focus {
    box-shadow: 0 0 0 2px #135e96;
    outline: 2px solid transparent;
}

.phntm-report-btn:disabled,
.phntm-report-button:disabled {
    background: #6c757d;
    border-color: #6c757d;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Modal Styles for Report Display */
.phntm-modal {
    display: none;
    position: fixed;
    z-index: 100000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.8);
}

.phntm-modal-content {
    background-color: white;
    margin: 2% auto;
    padding: 0;
    width: 90%;
    max-width: 1000px;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
}

.phntm-modal-header {
    background: #135e96;
    color: white;
    padding: 15px 20px;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.phntm-modal-header h3 {
    margin: 0;
    font-size: 1.3em;
}

.phntm-modal-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.phntm-modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    padding: 0 8px;
    border-radius: 4px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.phntm-modal-close:hover {
    background: rgba(255,255,255,0.2);
}

.phntm-modal-body {
    padding: 0;
    overflow-y: auto;
    flex: 1;
}

.phntm-report-modal-actions {
    padding: 15px 20px;
    border-top: 1px solid #ddd;
    text-align: right;
    background: #f8f9fa;
    border-radius: 0 0 8px 8px;
}

.phntm-report-modal-actions button {
    margin-left: 10px;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.phntm-report-print-btn {
    background: #28a745;
    color: white;
}

.phntm-report-print-btn:hover {
    background: #218838;
}

.phntm-report-download-btn {
    background: #007bff;
    color: white;
}

.phntm-report-download-btn:hover {
    background: #0056b3;
}

.phntm-report-close-btn {
    background: #6c757d;
    color: white;
}

.phntm-report-close-btn:hover {
    background: #545b62;
}

/* Loading States */
.phntm-report-loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.phntm-report-loading:before {
    content: "";
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #135e96;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
    vertical-align: middle;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.phntm-report-error {
    background: #fbeaea;
    border-left: 4px solid #dc3232;
    padding: 15px;
    margin: 20px;
    color: #dc3232;
    border-radius: 4px;
}

/* Print Styles */
@media print {
    body * {
        visibility: hidden;
    }
    
    .phntm-report-container,
    .phntm-report-container * {
        visibility: visible;
    }
    
    .phntm-report-container {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        box-shadow: none;
        margin: 0;
        padding: 0.5in;
    }
    
    .phntm-report-modal,
    .phntm-report-modal-header,
    .phntm-report-modal-actions,
    .phntm-report-btn {
        display: none !important;
    }
    
    .phntm-results-table,
    .phntm-info-table {
        page-break-inside: avoid;
    }
    
    .phntm-logo-image,
    .cognaid-logo-image {
        max-width: 100%;
        height: auto;
    }
    
    .phntm-logo-image {
        height: 50px;
    }
    
    .cognaid-logo-image {
        height: 35px;
    }
    
    .phntm-report-content h2 {
        page-break-after: avoid;
    }
    
    .phntm-report-footer {
        position: fixed;
        bottom: 0;
        width: 100%;
        margin-top: 0;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .phntm-report-container {
        padding: 15px;
        font-size: 14px;
    }
    
    .phntm-report-modal-content {
        width: 95%;
        margin: 1% auto;
    }
    
    .phntm-results-table {
        font-size: 0.8em;
    }
    
    .phntm-results-table th,
    .phntm-results-table td {
        padding: 6px 4px;
    }
    
    .phntm-info-table td:first-child {
        width: 40%;
    }
    
    .phntm-info-table td:last-child {
        width: 55%;
    }
    
    .phntm-report-footer {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .footer-right {
        text-align: center;
    }
}

/* Admin Table Integration */
.wp-list-table .phntm-report-btn {
    margin: 2px;
    font-size: 11px;
    padding: 4px 8px;
}

/* Status Indicators */
.phntm-test-status {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
}

.phntm-test-status.completed {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.phntm-test-status.incomplete {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.phntm-test-status.discontinued {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Accessibility Improvements */
.phntm-report-container *:focus {
    outline: 2px solid #135e96;
    outline-offset: 2px;
}

.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Animation for smooth transitions */
.phntm-report-modal {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.phntm-report-modal.show {
    opacity: 1;
}

.phntm-report-modal-content {
    transform: translateY(-50px);
    transition: transform 0.3s ease;
}

.phntm-report-modal.show .phntm-report-modal-content {
    transform: translateY(0);
}