/**
 * 今日機電 - 前台樣式
 */

/* 容器 */
.emf-journal-viewer {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 選擇器 */
.emf-journal-selector {
    margin-bottom: 30px;
}

.emf-journal-selector label {
    display: block;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 10px;
    color: #333;
}

.emf-journal-select {
    width: 100%;
    padding: 12px 15px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 8px;
    background-color: #fff;
    cursor: pointer;
    transition: border-color 0.3s;
}

.emf-journal-select:hover,
.emf-journal-select:focus {
    border-color: #0073aa;
    outline: none;
}

/* Grid View - 固定 4 格一行 */
.emf-journal-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 25px;
    margin-top: 20px;
}

.emf-journal-item {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.emf-journal-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    border-color: #0073aa;
}

.emf-journal-item-thumbnail {
    width: 100%;
    height: 180px;
    overflow: hidden;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.emf-journal-item-thumbnail img {
    min-width: 100%;
    min-height: 100%;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    transition: transform 0.3s ease;
}

.emf-journal-item:hover .emf-journal-item-thumbnail img {
    transform: scale(1.05);
}

/* PDF Placeholder */
.emf-journal-item-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
    color: #666;
}

.emf-journal-item-placeholder svg {
    margin-bottom: 10px;
    opacity: 0.8;
}

.emf-journal-item-placeholder span {
    font-size: 14px;
    font-weight: 600;
    color: #999;
}

.emf-journal-item-title {
    padding: 15px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    text-align: center;
    background: #fafafa;
    border-top: 1px solid #eee;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 空狀態 */
.emf-journal-empty {
    text-align: center;
    padding: 60px 20px;
    color: #666;
    font-size: 16px;
    background: #f9f9f9;
    border-radius: 10px;
}

/* 彈窗 */
.emf-journal-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.emf-journal-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
}

.emf-journal-modal-content {
    position: relative;
    background: #fff;
    width: 90%;
    max-width: 650px;
    max-height: 95vh;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.emf-journal-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    border: none;
    background: #f0f0f0;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.emf-journal-modal-close:hover {
    background: #e0e0e0;
    transform: rotate(90deg);
}

.emf-journal-modal-title {
    padding: 20px 60px 20px 20px;
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    border-bottom: 1px solid #eee;
    background: #fafafa;
    flex-shrink: 0;
}

.emf-journal-modal-iframe-wrapper {
    flex: 1;
    overflow: hidden;
    background: #f0f0f0;
}

.emf-journal-modal-iframe-wrapper iframe {
    width: 100%;
    height: 75vh;
    max-height: 800px;
    border: none;
}

.emf-journal-modal-actions {
    padding: 20px;
    display: flex;
    gap: 15px;
    justify-content: center;
    border-top: 1px solid #eee;
    background: #fafafa;
    flex-shrink: 0;
}

.emf-journal-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.3s;
}

.emf-journal-download-btn {
    background: #0073aa;
    color: #fff;
}

.emf-journal-download-btn:hover {
    background: #005a87;
    color: #fff;
}

.emf-journal-view-btn {
    background: #f0f0f0;
    color: #333;
}

.emf-journal-view-btn:hover {
    background: #e0e0e0;
    color: #333;
}

/* Loading */
.emf-journal-loading {
    text-align: center;
    padding: 40px;
}

.emf-journal-loading::after {
    content: '';
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid #f0f0f0;
    border-top-color: #0073aa;
    border-radius: 50%;
    animation: emf-spin 0.8s linear infinite;
}

@keyframes emf-spin {
    to { transform: rotate(360deg); }
}

/* 響應式 */
@media (max-width: 1024px) {
    .emf-journal-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .emf-journal-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .emf-journal-modal-content {
        width: 95%;
        max-height: 95vh;
    }
    
    .emf-journal-modal-actions {
        flex-direction: column;
    }
    
    .emf-journal-btn {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .emf-journal-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .emf-journal-item-title {
        font-size: 12px;
        padding: 10px;
    }
}
