/* Handout Viewing Pages - Styles for PEN Nutrition handout displays */

/* Common handout styles */
.handout-container {
    max-width: 1000px;
    margin: 0 auto;
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
}

.handout-header {
    background: #2c5aa0;
    color: white;
    padding: 2rem;
    text-align: center;
}

.handout-header h1 {
    margin: 0 0 0.5rem 0;
    font-size: 2rem;
    font-weight: bold;
}

.handout-meta {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    font-size: 0.9rem;
    opacity: 0.9;
    margin-top: 1rem;
}

.handout-content {
    padding: 3rem;
    line-height: 1.7;
}

.handout-content h2 {
    color: #2c5aa0;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 0.5rem;
    margin: 2rem 0 1rem 0;
}

.handout-content h3 {
    color: #495057;
    margin: 1.5rem 0 0.75rem 0;
}

.handout-content ul, 
.handout-content ol {
    margin: 1rem 0;
    padding-left: 2rem;
}

.handout-content li {
    margin-bottom: 0.5rem;
}

.handout-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
}

.handout-content th,
.handout-content td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
}

.handout-content th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #495057;
}

.handout-content blockquote {
    border-left: 4px solid #2c5aa0;
    background: #f8f9fa;
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    font-style: italic;
}

/* Access control messages */
.access-message {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    margin: 2rem 0;
}

.access-message.premium {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
}

.access-message h3 {
    margin: 0 0 1rem 0;
    color: inherit;
}

.access-message .btn {
    margin: 0.5rem;
}

/* Action buttons */
.handout-actions {
    background: #f8f9fa;
    padding: 1.5rem 3rem;
    border-top: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.action-group {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.print-btn {
    background: #28a745;
    border-color: #28a745;
}

.print-btn:hover {
    background: #218838;
    border-color: #218838;
}

/* Copyright and attribution */
.handout-footer {
    background: #e9ecef;
    padding: 2rem 3rem;
    font-size: 0.875rem;
    color: #666;
    border-top: 1px solid #dee2e6;
}

.copyright-notice {
    margin-bottom: 1rem;
}

.handout-reference {
    font-style: italic;
    color: #495057;
}

/* Topic grid for current topics */
.topics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.topic-card {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
    position: relative;
}

.topic-card:hover {
    box-shadow: 0 4px 15px rgba(44, 90, 160, 0.15);
    transform: translateY(-2px);
}

.topic-card-header {
    background: linear-gradient(135deg, #2c5aa0 0%, #1e3a5f 100%);
    color: white;
    padding: 1.25rem;
}

.topic-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
    line-height: 1.3;
}

.topic-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    opacity: 0.9;
    flex-wrap: wrap;
}

.topic-content {
    padding: 1.25rem;
}

.topic-summary {
    color: #666;
    line-height: 1.5;
    margin-bottom: 1rem;
}

.topic-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #f0f0f0;
}

.content-type-badge {
    background: #f8f9fa;
    color: #495057;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.content-type-badge.handout {
    background: #e3f2fd;
    color: #1976d2;
}

.content-type-badge.pathway {
    background: #f3e5f5;
    color: #7b1fa2;
}

/* Subscription overlay for restricted content */
.subscription-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(44, 90, 160, 0.95);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
    transition: opacity 0.3s ease;
}

.subscription-overlay .overlay-content {
    max-width: 250px;
}

.subscription-overlay h4 {
    margin: 0 0 1rem 0;
    font-size: 1.1rem;
}

.subscription-overlay p {
    margin: 0 0 1.5rem 0;
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Table of contents specific styles */
.toc-category-section {
    margin-bottom: 2rem;
}

.category-header {
    background: #2c5aa0;
    color: white;
    padding: 1rem 1.5rem;
    margin: 0;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-radius: 8px 8px 0 0;
}

.toc-items {
    background: white;
    border: 1px solid #dee2e6;
    border-top: none;
    border-radius: 0 0 8px 8px;
}

.toc-item {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #f0f0f0;
}

.toc-item:last-child {
    border-bottom: none;
}

.item-title {
    color: #2c5aa0;
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
}

.item-title a {
    color: inherit;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.item-title a:hover {
    text-decoration: underline;
}

/* Responsive design */
@media (max-width: 768px) {
    .handout-container {
        margin: 1rem;
        border-radius: 0;
    }
    
    .handout-header,
    .handout-content,
    .handout-actions,
    .handout-footer {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
    
    .handout-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .action-group {
        justify-content: center;
    }
    
    .topics-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .handout-meta {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .subscription-overlay {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .handout-header h1 {
        font-size: 1.5rem;
    }
    
    .handout-header,
    .handout-content {
        padding-top: 1.5rem;
        padding-bottom: 1.5rem;
    }
    
    .topic-card-header,
    .topic-content {
        padding: 1rem;
    }
}

/* Print styles */
@media print {
    body {
        font-family: 'Times New Roman', serif;
        font-size: 12pt;
        line-height: 1.5;
        color: #000;
    }
    
    .handout-container {
        box-shadow: none;
        border-radius: 0;
        margin: 0;
        max-width: none;
    }
    
    .handout-header {
        background: none !important;
        color: #000 !important;
        border-bottom: 2px solid #000;
        padding: 1rem 0;
    }
    
    .handout-actions,
    .subscription-overlay,
    .btn,
    .access-message,
    nav,
    footer {
        display: none !important;
    }
    
    .handout-content {
        padding: 1rem 0;
    }
    
    .handout-content h2 {
        color: #000;
        page-break-after: avoid;
        margin-top: 1.5rem;
    }
    
    .handout-content h3 {
        color: #000;
        page-break-after: avoid;
    }
    
    .handout-content table {
        page-break-inside: avoid;
    }
    
    .handout-content blockquote {
        background: none;
        border-left: 2px solid #000;
        page-break-inside: avoid;
    }
    
    .handout-footer {
        background: none;
        border-top: 1px solid #000;
        padding: 1rem 0;
        margin-top: 2rem;
    }
    
    .copyright-notice,
    .handout-reference {
        color: #000;
        font-size: 10pt;
    }
    
    /* Ensure proper page breaks */
    .topic-card,
    .toc-item {
        page-break-inside: avoid;
        break-inside: avoid;
    }
    
    /* Print URLs for links */
    a[href]:after {
        content: " (" attr(href) ")";
        font-size: 10pt;
        color: #666;
    }
    
    /* Don't print URLs for internal navigation */
    a[href^="#"]:after,
    a[href^="/"]:after {
        content: "";
    }
    
    @page {
        margin: 1in;
        size: letter;
    }
}