/**
 * Five Pillars Sync System - Styles
 * Styling for unified pillar document cards, modals, and UI components
 */

/* Pillar Section Styling */
.pillar-section {
    margin: 2rem 0;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.pillar-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    margin-bottom: 1.5rem;
    background: white;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.pillar-section-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: #2c3e50;
}

.document-count {
    background: #ecf0f1;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    color: #7f8c8d;
    font-weight: 600;
}

/* Subject Sections */
.pillar-subjects-container {
    padding: 1rem 0;
}

.subject-section {
    margin-bottom: 2.5rem;
}

.subject-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 8px;
    margin-bottom: 1rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.subject-name {
    font-size: 1.1rem;
    font-weight: 600;
}

.subject-doc-count {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
}

/* Document Cards Grid */
.pillar-documents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    padding: 1rem 0;
}

.subject-grid {
    padding: 0;
}

/* Document Card */
.pillar-document-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.pillar-document-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

/* Card Header */
.document-card-header {
    padding: 1rem;
    background: #f8f9fa;
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.pillar-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    color: white;
    font-weight: bold;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

.document-type-badge {
    padding: 0.25rem 0.75rem;
    background: #34495e;
    color: white;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.year-badge {
    padding: 0.25rem 0.75rem;
    background: #95a5a6;
    color: white;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* Card Body */
.document-card-body {
    padding: 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.subject-tag {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.document-title {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: #2c3e50;
    line-height: 1.4;
}

.document-series {
    margin: 0 0 0.75rem 0;
    font-size: 0.85rem;
    color: #7f8c8d;
    font-family: 'Courier New', monospace;
}

.document-summary {
    margin: 0 0 1rem 0;
    font-size: 0.9rem;
    color: #555;
    line-height: 1.5;
    flex: 1;
}

/* Keywords */
.document-keywords {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.keyword-tag {
    padding: 0.25rem 0.5rem;
    background: #e8f4f8;
    color: #2980b9;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Card Footer */
.document-card-footer {
    padding: 1rem;
    background: #f8f9fa;
    border-top: 1px solid #ecf0f1;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.document-card-footer button {
    flex: 1;
    min-width: 140px;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-view-content {
    background: #3498db;
    color: white;
}

.btn-view-content:hover {
    background: #2980b9;
    transform: translateY(-1px);
}

.btn-view-pdf {
    background: #e74c3c;
    color: white;
}

.btn-view-pdf:hover {
    background: #c0392b;
    transform: translateY(-1px);
}

/* Modal Styling */
.five-pillars-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.five-pillars-modal .modal-content {
    background-color: #fefefe;
    margin: 2% auto;
    padding: 0;
    border: none;
    border-radius: 12px;
    width: 90%;
    max-width: 1000px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.five-pillars-modal .modal-header {
    padding: 1.5rem 2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.five-pillars-modal .modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.five-pillars-modal .modal-close {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    font-size: 2rem;
    font-weight: 300;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.five-pillars-modal .modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.five-pillars-modal .modal-body {
    padding: 2rem;
    overflow-y: auto;
    flex: 1;
}

.content-meta {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    border-left: 4px solid #667eea;
}

.content-meta p {
    margin: 0.5rem 0;
    font-size: 0.95rem;
}

.content-meta strong {
    color: #2c3e50;
    min-width: 100px;
    display: inline-block;
}

.content-text {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.content-text pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Georgia', serif;
    font-size: 1rem;
    line-height: 1.8;
    color: #333;
    margin: 0;
}

.five-pillars-modal .modal-footer {
    padding: 1rem 2rem;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
    border-radius: 0 0 12px 12px;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

.five-pillars-modal .modal-footer button {
    padding: 0.75rem 2rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    background: #667eea;
    color: white;
}

.five-pillars-modal .modal-footer button:hover {
    background: #5568d3;
    transform: translateY(-1px);
}

/* Responsive Design */
@media (max-width: 768px) {
    .pillar-documents-grid {
        grid-template-columns: 1fr;
    }

    .pillar-section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .document-card-footer {
        flex-direction: column;
    }

    .document-card-footer button {
        width: 100%;
    }

    .five-pillars-modal .modal-content {
        width: 95%;
        margin: 5% auto;
    }

    .five-pillars-modal .modal-body {
        padding: 1rem;
    }

    .content-meta {
        padding: 1rem;
    }
}

/* Loading State */
.pillar-section.loading::after {
    content: "Loading...";
    display: block;
    text-align: center;
    padding: 2rem;
    color: #7f8c8d;
    font-size: 1.1rem;
}

/* Empty State */
.pillar-section.empty::after {
    content: "No documents found";
    display: block;
    text-align: center;
    padding: 2rem;
    color: #95a5a6;
    font-size: 1rem;
}

/* Search and Filter Bar */
.pillars-search-bar {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.pillars-search-bar input[type="text"],
.pillars-search-bar select {
    padding: 0.75rem 1rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    width: 100%;
    box-sizing: border-box;
}

.pillars-search-bar input[type="text"]:focus,
.pillars-search-bar select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Statistics Dashboard */
.pillars-stats-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    text-align: center;
}

.stat-card h3 {
    margin: 0 0 0.5rem 0;
    font-size: 2rem;
    color: #667eea;
}

.stat-card p {
    margin: 0;
    color: #7f8c8d;
    font-size: 0.9rem;
}

/* Print Styles */
@media print {
    .document-card-footer,
    .modal-close,
    .modal-footer {
        display: none !important;
    }

    .content-text pre {
        white-space: pre-wrap;
        page-break-inside: avoid;
    }
}
